database/ database.bi

Summary
database/ database.bi
LicenseCopyright © 2009, FreeBASIC Extended Library Development Group
ext. database
StatementRepresents a prepared statement and allows access to the results of a statement passed to the database.
Functions
executeExecutes the prepared statement on the database and steps through the resulting rows (if any).
numColumnsReturns the number of columns in the result set.
columnName
columnValue
finalizeReleases memory held by the statement.
handleDatabase dependant handle to this prepared statement.
ConnectionRepresents a connection to a database and provides a facility for prepared statements.
Functions
Component ConstructorInitializes a connection to a database using a connection string and a ext.database.DatabaseDriver.
Component ConstructorInitializes a database connection with only a ext.database.DatabaseDriver.
Copy ConstructorCopies the ext.database.DatabaseDriver and connect string from another Connection
connectConnects to the database using the passed connection string or the connection string passed to the constructor.
prepareFactory method to create Statements
closeCloses the connection to the database.
handleReturns a pointer to the database dependant handle for this connection.

License

Copyright © 2009, FreeBASIC Extended Library Development Group

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com- /p- /fb-extended-lib- /wiki- /License

ext. database

Statement

Represents a prepared statement and allows access to the results of a statement passed to the database.  This class is not meant to be created manually, only returned from the Connection.prepare function.

Summary
Functions
executeExecutes the prepared statement on the database and steps through the resulting rows (if any).
numColumnsReturns the number of columns in the result set.
columnName
columnValue
finalizeReleases memory held by the statement.
handleDatabase dependant handle to this prepared statement.

Functions

execute

declare function execute( ) as integer

Executes the prepared statement on the database and steps through the resulting rows (if any).

Returns

Database dependant error code.

numColumns

declare function numColumns( ) as integer

Returns the number of columns in the result set.

columnName

declare function columnName(byval iCol as integer) as string

Parameters

iColinteger number of column

Returns

The name of the column passed.

columnValue

declare function columnValue(byval iCol as integer) as string

Parameters

iColinteger number of column

Returns

The value in the column passed.

finalize

declare function finalize( ) as integer

Releases memory held by the statement.

Returns

Database dependant error code.

handle

declare function handle() as any ptr

Returns

Database dependant handle to this prepared statement.

Connection

Represents a connection to a database and provides a facility for prepared statements.

Summary
Functions
Component ConstructorInitializes a connection to a database using a connection string and a ext.database.DatabaseDriver.
Component ConstructorInitializes a database connection with only a ext.database.DatabaseDriver.
Copy ConstructorCopies the ext.database.DatabaseDriver and connect string from another Connection
connectConnects to the database using the passed connection string or the connection string passed to the constructor.
prepareFactory method to create Statements
closeCloses the connection to the database.
handleReturns a pointer to the database dependant handle for this connection.

Functions

Component Constructor

Initializes a connection to a database using a connection string and a ext.database.DatabaseDriver.

Parameters

connectsta database dependant connection string.
da pointer to a ext.database.DatabaseDriver

Component Constructor

Initializes a database connection with only a ext.database.DatabaseDriver.  You must pass a connection string to the connect function.

Parameters

da pointer to a ext.database.DatabaseDriver

Copy Constructor

Copies the ext.database.DatabaseDriver and connect string from another Connection

connect

declare function connect(byref connectst as string =  "") as integer

Connects to the database using the passed connection string or the connection string passed to the constructor.

Parameters

connectstoptional (if passed to constructor) database dependant connection string

Returns

Database dependant error code.

prepare

declare function prepare(byref sql as string) as Statement ptr

Factory method to create Statements

Parameters

sqlthe SQL statement you want to pass to the database.

Returns

Pointer to a Statement.  You must delete this when you are done.

close

declare function close() as integer

Closes the connection to the database.  This invalidates any remaining <Statment> objects.

Returns

Database dependant error code

handle

declare function handle() as any ptr

Returns a pointer to the database dependant handle for this connection.

declare function execute( ) as integer
Executes the prepared statement on the database and steps through the resulting rows (if any).
declare function numColumns( ) as integer
Returns the number of columns in the result set.
declare function columnName(byval iCol as integer) as string
declare function columnValue(byval iCol as integer) as string
declare function finalize( ) as integer
Releases memory held by the statement.
declare function handle() as any ptr
Database dependant handle to this prepared statement.
type DatabaseDriver
A group of function pointers to enable access to a database.
Represents a connection to a database and provides a facility for prepared statements.
declare function connect(byref connectst as string =  "") as integer
Connects to the database using the passed connection string or the connection string passed to the constructor.
declare function prepare(byref sql as string) as Statement ptr
Factory method to create Statements
Represents a prepared statement and allows access to the results of a statement passed to the database.
declare function close() as integer
Closes the connection to the database.
declare function handle() as any ptr
Returns a pointer to the database dependant handle for this connection.