database_doc: Concept

Next: SQL data types, Previous: Top, Up: Top [Index]

## 1 Introduction and package concept

To enable scripting of SQL access, particularly combinations of SQL commands with temporary local storage or local processing of data, for almost each SQL data type a corresponding representation of the data in Octave is defined. This includes the SQL array types and user-defined SQL composite types (row types) of arbitrary nesting depth. Octave variables containing these corresponding representations are created by the package if data is received from a database by a `select` query, and correspondingly are used for sending data to the database. This data exchange is lossless if the database backend allows it (which is the case for Postgresql).

The representations of SQL types in Octave are the ’naturally’ corresponding Octave types, if possible. They can also be created directly in Octave and sent to a database.

The package keeps a notion of all SQL types available in a database. This information is automatically retrieved after connecting. If the user creates new types with SQL commands, a package function for refreshing the packages information on types must be called for the type to be available within the same session. The same function should be called if the session continues after deletion of types.

The package provides functions for issuing SQL commands whose text is provided by the user. The command text can contain placeholders for data. The data, corresponding to these placeholders, can be passed to the function in separate arguments.

In queries, not only data is returned, but also information on data type and column names.