Skip to content

Octave SQLITE Toolkit

lostbard edited this page Oct 21, 2022 · 7 revisions

Introduction

The Octave SQLITE toolkit is a set of SQLITE routines for GNU Octave

Full documentation for using the toolkit is availble at https://gnu-octave.github.io/octave-sqlite/

Quick overview is below:

1 Installing and loading

The toolkit has a dependency on the SQLITE library (https://www.sqlite.org/), so it must be installed in order to successfully install the toolkit.

The toolkit must be then be loaded once per each GNU Octave session in order to use its functionality.

1.1 Install

With an internet connection available, the octave sqlite package can be installed from the octave-sqlite website using the following command within GNU Octave:

 pkg install https://github.com/gnu-octave/octave-sqlite/releases/download/v0.0.2/octave-sqlite-0.0.2.tar.gz

On Octave 7.2 and later, the package can be installed using the following command within GNU Octave:

 pkg install -forge sqlite

The latest released version of the toolkit will be downloaded and installed.

1.2 Loading

Regardless of the method of installing the toolkit, in order to use its functions, the toolkit must be loaded using the pkg load command:

 pkg load sqlite

The toolkit must be loaded on each GNU Octave session.

2 Basic Usage Overview

2.1 Connection to a sqlite database

Connection to the database is done using the sqlite function.

Example:

 db = sqlite('testdb.db')

 db =
     sqlite with properties
          Database: testdb.db
        IsReadOnly: 0
        AutoCommit: on

2.2 Read a table

To quickly read data from a table, use the sqlread function

Example:

 data = sqlread(db, "TestTable")

2.3 Close the database

To close the database, use the close function

Example:

 close(db)

3 Documentation

See the documentation (https://gnu-octave.github.io/octave-sqlite/) for full usage of the toolkit