Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Wildcard Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
SQL base Source Code
 previous   up   next 

Types
dbCategory
Enumeration type to descibe database drivers.
database
Abstract data type to store database connections.
sqlStatement
Abstract data type to store a prepared sql statement.

dbCategory

const type: dbCategory

Enumeration type to descibe database drivers.

  • NO_DB No database
  • DB_MYSQL MySql/MariaDb
  • DB_SQLITE SQLLite
  • DB_POSTGRESQL PostgreSQL
  • DB_OCI Oracle
  • DB_ODBC Odbc

database

const type: database

Abstract data type to store database connections.


sqlStatement

const type: sqlStatement

Abstract data type to store a prepared sql statement.


Function Summary
database
openDatabase (in dbCategory: driver, in string: dbName, in string: user, in string: password)
Open the database dbName with the specified user and password.
database
openDatabase (in dbCategory: driver, in string: connectStri)
Open a database with the specified driver and connectStri.
void
close (in database: db)
Close the specified database db.
sqlStatement
prepare (in database: db, in string: sqlStatementStri)
Create a prepared statement for the given database db.
void
bind (inout sqlStatement: statement, in integer: pos, in bigInteger: num)
Bind a bigInteger parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, in bigRational: bigRatData)
Bind a bigRational parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, in boolean: flag)
Bind a boolean parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, in bstring: bstri)
Bind a bstring parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, in float: number)
Bind a float parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, in integer: number)
Bind an integer parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, NULL)
Bind a NULL parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, in string: stri)
Bind a string parameter to a prepared SQL statement.
void
bind (inout sqlStatement: statement, in integer: pos, in time: timeData)
Bind a time parameter to a prepared SQL statement.
void
execute (inout sqlStatement: statement)
Execute the specified prepared SQL statement.
boolean
fetch (in sqlStatement: statement)
Fetch a row from the result data of an executed statement.
bigInteger
column (in sqlStatement: statement, in integer: column, attr bigInteger)
Get the specified column of fetched data as bigInteger.
bigRational
column (in sqlStatement: statement, in integer: column, attr bigRational)
Get the specified column of fetched data as bigRational.
boolean
column (in sqlStatement: statement, in integer: column, attr boolean)
Get the specified column of fetched data as boolean.
bstring
column (in sqlStatement: statement, in integer: column, attr bstring)
Get the specified column of fetched data as bstring.
duration
column (in sqlStatement: statement, in integer: column, attr duration)
Get the specified column of fetched data as duration.
float
column (in sqlStatement: statement, in integer: column, attr float)
Get the specified column of fetched data as float.
integer
column (in sqlStatement: statement, in integer: column, attr integer)
Get the specified column of fetched data as integer.
string
column (in sqlStatement: statement, in integer: column, attr string)
Get the specified column of fetched data as string.
time
column (in sqlStatement: statement, in integer: column, attr time)
Get the specified column of fetched data as time.
boolean
isNull (in sqlStatement: statement, in integer: column)
Determined if the specified column of fetched data is NULL.
void
commit (in database: db)
Execute a commit statement for the specified database db.

Function Detail

openDatabase

const func database: openDatabase (in dbCategory: driver, in string: dbName, in string: user, in string: password)

Open the database dbName with the specified user and password.

Parameters:
driver - Database driver to be used.
dbName - Database name. The dbName can be specified with host name ("e.g.: "www.example.org/myDb"), or with IPv4 address in standard dot notation (e.g.: "192.0.2.235/myDb"). Operating systems supporting IPv6 may also accept an IPv6 address in colon notation.
user - Database user name.
password - Database password.
Returns:
the database connection.

openDatabase

const func database: openDatabase (in dbCategory: driver, in string: connectStri)

Open a database with the specified driver and connectStri. The connectStri must be in one of the forms

  • user:password@dbName
  • user@dbName
  • dbName

The dbName can be specified with host name ("e.g.: "www.example.org/myDb"), or with IPv4 address in standard dot notation (e.g.: "192.0.2.235/myDb"). Operating systems supporting IPv6 may also accept an IPv6 address in colon notation.

Parameters:
driver - Database driver to be used.
connectStri - Connection string in one of the forms user:password@dbName user@dbName or dbName When no user is specified the user "guest" is used. When no password is specified the password "guest" is used.
Returns:
the database connection.

close

const proc: close (in database: db)

Close the specified database db.

Parameters:
database - Database to be closed.
Raises:
RANGE_ERROR - When the database was not open.

prepare

const func sqlStatement: prepare (in database: db, in string: sqlStatementStri)

Create a prepared statement for the given database db.

Parameters:
db - Database connection for which the prepared statement should be created.
sqlStatementStri - SQL statement in a string. For bind variables use a question mark (?).

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in bigInteger: num)

Bind a bigInteger parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
num - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when num cannot be converted.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in bigRational: bigRatData)

Bind a bigRational parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
bigRatData - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when bigRatData cannot be converted.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in boolean: flag)

Bind a boolean parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
flag - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when flag cannot be converted.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in bstring: bstri)

Bind a bstring parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
bstri - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when bstri cannot be converted.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in float: number)

Bind a float parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
number - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when number cannot be converted.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in integer: number)

Bind an integer parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
number - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when number cannot be converted.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, NULL)

Bind a NULL parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in string: stri)

Bind a string parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
stri - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when stri cannot be converted.
FILE_ERROR - When a database function fails.

bind

const proc: bind (inout sqlStatement: statement, in integer: pos, in time: timeData)

Bind a time parameter to a prepared SQL statement.

Parameters:
statement - Prepared statement.
pos - Position of the bind variable (starting with 1).
timeData - Value for the binding.
Raises:
RANGE_ERROR - When the statement was not prepared or when pos is negative or too big or when timeData cannot be converted.
FILE_ERROR - When a database function fails.

execute

const proc: execute (inout sqlStatement: statement)

Execute the specified prepared SQL statement. Bind variable can be assigned with the function bind before execute is called.

Parameters:
statement - Prepared statement, which should be executed.
Raises:
FILE_ERROR - When a database function fails.

fetch

const func boolean: fetch (in sqlStatement: statement)

Fetch a row from the result data of an executed statement. After the statement has been executed successfully the function fetch can be used to get the first and further rows of the statements result data. The columns of the result data can be obtained with the column functions.

Parameters:
statement - Prepared statement, which has been executed.
Returns:
TRUE when a row of result data could be fetched successfully. FALSE when no more result data is available.
Raises:
FILE_ERROR - When a database function fails.

column

const func bigInteger: column (in sqlStatement: statement, in integer: column, attr bigInteger)

Get the specified column of fetched data as bigInteger.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a bigInteger.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func bigRational: column (in sqlStatement: statement, in integer: column, attr bigRational)

Get the specified column of fetched data as bigRational.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a bigRational.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func boolean: column (in sqlStatement: statement, in integer: column, attr boolean)

Get the specified column of fetched data as boolean.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a boolean.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func bstring: column (in sqlStatement: statement, in integer: column, attr bstring)

Get the specified column of fetched data as bstring.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a bstring.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func duration: column (in sqlStatement: statement, in integer: column, attr duration)

Get the specified column of fetched data as duration.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a duration.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func float: column (in sqlStatement: statement, in integer: column, attr float)

Get the specified column of fetched data as float.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a float.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func integer: column (in sqlStatement: statement, in integer: column, attr integer)

Get the specified column of fetched data as integer.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to an integer.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func string: column (in sqlStatement: statement, in integer: column, attr string)

Get the specified column of fetched data as string.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a string.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

column

const func time: column (in sqlStatement: statement, in integer: column, attr time)

Get the specified column of fetched data as time.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
the column converted to a time.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist or when the column cannot be converted.
FILE_ERROR - When a database function fails.

isNull

const func boolean: isNull (in sqlStatement: statement, in integer: column)

Determined if the specified column of fetched data is NULL.

Parameters:
statement - Prepared statement for which data was fetched.
column - Number of the column (starting with 1).
Returns:
TRUE when the column is NULL, FALSE otherwise.
Raises:
RANGE_ERROR - When the statement was not prepared or when no data was successfully fetched or when the specified column does not exist.

commit

const proc: commit (in database: db)

Execute a commit statement for the specified database db.



 previous   up   next