Contents Up Previous Next

wxRecordSet is-a wxObject

Database classes overview


Not yet implemented.

Each recordset represents an ODBC database query. You can make multiple queries at a time by using multiple recordsets with a database or you can make your queries in sequential order using the same recordset.

wxRecordSet database
wxRecordSet type
wxRecordSet create
wxRecordSet delete
wxRecordSet execute-sql
wxRecordSet get-char-data
wxRecordSet get-col-name
wxRecordSet get-col-type
wxRecordSet get-columns
wxRecordSet get-data-sources
wxRecordSet get-error-code
wxRecordSet get-filter
wxRecordSet get-float-data
wxRecordSet get-foreign-keys
wxRecordSet get-int-data
wxRecordSet get-number-cols
wxRecordSet get-number-fields
wxRecordSet get-number-params
wxRecordSet get-number-records
wxRecordSet get-primary-keys
wxRecordSet get-result-set
wxRecordSet get-table-name
wxRecordSet get-tables
wxRecordSet goto
wxRecordSet is-bof
wxRecordSet is-field-dirty
wxRecordSet is-field-null
wxRecordSet is-col-nullable
wxRecordSet is-eof
wxRecordSet is-open
wxRecordSet move
wxRecordSet move-first
wxRecordSet move-last
wxRecordSet move-next
wxRecordSet move-prev
wxRecordSet query
wxRecordSet set-table-name


wxRecordSet database

wxDatabase database

The parent database.


wxRecordSet type

wxRecordSet type

The initial type of the recordset. Currently there are two possible values of type:


wxRecordSet create

void ( create)

Constructs a recordset object, and appends the recordset object to the parent database's list of recordset objects, for later destruction when the database is destroyed.

The following slots may be initialized.

Currently there are two possible values of type:


wxRecordSet delete

bool ( delete)

Deletes the recordset. All data except that stored in user-defined variables will be lost. It also unlinks the recordset object from the parent database's list of recordset objects.


wxRecordSet execute-sql

bool ( execute-sql string sql)

Directly executes a SQL statement. The data will be presented as a normal result set. Note that the recordset must have been created as a snapshot, not dynaset. Dynasets will be implemented in the near future.

Examples of common SQL statements are given in A selection of SQL commands.


wxRecordSet get-char-data

string ( get-char-data string-or-long col)

Returns the character (string) data for the current record at the specified column. The column can be a name or an integer position (starting from zero).


wxRecordSet get-col-name

string ( get-col-name long col)

Gets the name of the coumn at position col. Returns the empty string if col does not exist.


wxRecordSet get-col-type

string ( get-col-type string-or-long col)

Gets the name of the coumn at position col or name col. Returns "SQL_TYPE_NULL" if col does not exist.

See ODBC SQL data types for the possible return values from this function.


wxRecordSet get-columns

long ( get-columns optional string table = "")

Returns the columns of the table with the specified name. If no name is given, the internal class member table will be used. If both names are NULL nothing will happen. The data will be presented as a normal result set, organized as follows:

0 (VARCHAR) TABLE_QUALIFIER
1 (VARCHAR) TABLE_OWNER
2 (VARCHAR) TABLE_NAME
3 (VARCHAR) COLUMN_NAME
4 (SMALLINT) DATA_TYPE
5 (VARCHAR) TYPE_NAME
6 (INTEGER) PRECISION
7 (INTEGER) LENGTH
8 (SMALLINT) SCALE
9 (SMALLINT) RADIX
10 (SMALLINT) NULLABLE
11 (VARCHAR) REMARKS


wxRecordSet get-data-sources

bool ( get-data-sources)

Gets the currently-defined data sources via the ODBC manager. The data will be presented as a normal result set. See the documentation for the ODBC function SQLDataSources for how the data is organized. The name of the source is at column 0.


wxRecordSet get-error-code

string ( get-error-code)

Returns the error code of the last ODBC action. This will be a string containing one of:

SQL_ERROR General error.
SQL_INVALID_HANDLE An invalid handle was passed to an ODBC function.
SQL_NEED_DATA ODBC expected some data.
SQL_NO_DATA_FOUND No data was found by this ODBC call.
SQL_SUCCESS The call was successful.
SQL_SUCCESS_WITH_INFO The call was successful, but further information can be obtained from the ODBC manager.


wxRecordSet get-filter

string ( get-filter)

Returns the current filter.


wxRecordSet get-float-data

double ( get-float-data string-or-long col)

Returns the floating-point data for the current record at the specified column. The column can be a name or an integer position (starting from zero).


wxRecordSet get-foreign-keys

bool ( get-foreign-keys optional string ftable = "" optional string ktable = "")

Returns a list of foreign keys in the specified table (columns in the specified table that refer to primary keys in other tables), or a list of foreign keys in other tables that refer to the primary key in the specified table.

If ptable contains a table name, this function returns a result set containing the primary key of the specified table.

If ftable contains a table name, this functions returns a result set of containing all of the foreign keys in the specified table and the primary keys (in other tables) to which they refer.

If both ptable and ftable contain table names, this function returns the foreign keys in the table specified in ftable that refer to the primary key of the table specified in ptable. This should be one key at most.

GetForeignKeys returns results as a standard result set. If the foreign keys associated with a primary key are requested, the result set is ordered by FKTABLE_QUALIFIER, FKTABLE_OWNER, FKTABLE_NAME, and KEY_SEQ. If the primary keys associated with a foreign key are requested, the result set is ordered by PKTABLE_QUALIFIER, PKTABLE_OWNER, PKTABLE_NAME, and KEY_SEQ. The following table lists the columns in the result set.

0 (VARCHAR) PKTABLE_QUALIFIER
1 (VARCHAR) PKTABLE_OWNER
2 (VARCHAR) PKTABLE_NAME
3 (VARCHAR) PKCOLUMN_NAME
4 (VARCHAR) FKTABLE_QUALIFIER
5 (VARCHAR) FKTABLE_OWNER
6 (VARCHAR) FKTABLE_NAME
7 (VARCHAR) FKCOLUMN_NAME
8 (SMALLINT) KEY_SEQ
9 (SMALLINT) UPDATE_RULE
10 (SMALLINT) DELETE_RULE
11 (VARCHAR) FK_NAME
12 (VARCHAR) PK_NAME


wxRecordSet get-int-data

long ( get-int-data string-or-long col)

Returns the integer data for the current record at the specified column. The column can be a name or an integer position (starting from zero).


wxRecordSet get-number-cols

long ( get-number-cols)

Returns the number of columns in the result set.


wxRecordSet get-number-fields

long ( get-number-fields)

Not implemented.


wxRecordSet get-number-params

long ( get-number-params)

Not implemented.


wxRecordSet get-number-records

long ( get-number-records)

Returns the number of records in the result set.


wxRecordSet get-primary-keys

long ( get-primary-keys optional string table = "")

Returns the column names that comprise the primary key of the table with the specified name. If no name is given the class member tablename will be used. If both names are NULL nothing will happen. The data will be presented as a normal result set, organized as follows:

0 (VARCHAR) TABLE_QUALIFIER
1 (VARCHAR) TABLE_OWNER
2 (VARCHAR) TABLE_NAME
3 (VARCHAR) COLUMN_NAME
4 (SMALLINT) KEY_SEQ
5 (VARCHAR) PK_NAME


wxRecordSet get-result-set

bool ( get-result-set)

Copies the data presented by ODBC into the recordset. Depending on the recordset type all or only one record(s) will be copied. Usually this function will be called automatically after each successful database operation.


wxRecordSet get-table-name

string ( get-table-name)

Returns the name of the current table.


wxRecordSet get-tables

bool ( get-tables)

Gets the tables of a database. The data will be presented as a normal result set, organized as follows:

0 (VARCHAR) TABLE_QUALIFIER
1 (VARCHAR) TABLE_OWNER
2 (VARCHAR) TABLE_NAME
3 (VARCHAR) TABLE_TYPE (TABLE, VIEW, SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM, or database-specific type)
4 (VARCHAR) REMARKS


wxRecordSet goto

bool ( goto long n)

Moves the cursor to the record with the number n, where the first record has the number 0.


wxRecordSet is-bof

TRUE ( is-bof)

Returns TRUE if the user tried to move the cursor before the first record in the set.


wxRecordSet is-field-dirty

bool ( is-field-dirty string-or-long field)

Returns TRUE if the given field has been changed but not saved yet.


wxRecordSet is-field-null

bool ( is-field-null string-or-long field)

Returns TRUE if the given field has no data.


wxRecordSet is-col-nullable

bool ( is-col-nullable string-or-long field)

Returns TRUE if the given column may contain no data.


wxRecordSet is-eof

bool ( is-eof)

Returns TRUE if the user tried to move the cursor behind the last record in the set.


wxRecordSet is-open

bool ( is-open)

Returns TRUE if the parent database is open.


wxRecordSet move

bool ( move long rows)

Moves the cursor a given number of rows. Negative values are allowed.


wxRecordSet move-first

bool ( move-first)

Moves the cursor to the first record.


wxRecordSet move-last

bool ( move-last)

Moves the cursor to the last record.


wxRecordSet move-next

bool ( move-next)

Moves the cursor to the next record.


wxRecordSet move-prev

bool ( move-prev)

Moves the cursor to the previous record.


wxRecordSet query

bool ( query string columns string table optional string filter)

Start a query. An SQL string of the following type will automatically be generated and executed: "SELECT columns FROM table WHERE filter".


wxRecordSet set-table-name

bool ( set-table-name string table)

Specify the name of the table you want to use.