GXGOLEDB class¶
-
class
geosoft.gx.
GXGOLEDB
¶ Geosoft OLE DB connectivity to relational database
-
build_record_set
((str)arg1) → None:¶ Build a recordset from a SQL SELECT statement
Parameters: arg1 (str) – SELECT SQL statement Returns: Nothing Return type: None New in version 6.0.0.
Note:
Recordset as built remains in the GOLEDB object until (1) the GOLEDB object is destroyed, (2) recordset deleted by a function call of
geosoft.gx.GXGOLEDB.delete_record_set()
(3)'over-written' by a new recordset by another call of the build functionSee also
Use
geosoft.gx.GXGOLEDB.get_record_set_rows()
, iGetRecordsetCols_GOLEDB, GetOneRow_GOLEDB and GetNextRow_GOLEDB etc. to retrieve values in the recordset
-
static
create
((GXContext)ctx, (int)arg1, (str)arg2, (str)arg3, (str)arg4) → GXGOLEDB:¶ Create GOLEDB.
Parameters: - ctx (
geosoft.gx.GXContext
) – The GX execution context - arg1 (int) – GOLEDB_PROVIDER constants
- arg2 (str) – Database file name
- arg3 (str) – User ID, “” if user id not required
- arg4 (str) – Password. “” if password not required to connect to database
Returns: GOLEDB Object
Return type: New in version 6.0.0.
Note:
1. Use the following quidance to choose right provider MS Access database, GOLEDB_PROVIDER_MSJET MS SQL Server database, GOLEDB_PROVIDER_SQL Oracle database, GOLEDB_PROVIDER_ORACLE Any other relational database, GOLEDB_PROVIDER_ODBC 2. This class works with relational databases and related providers which support COMMAND objects. Command object is used to fetch recordsets and execute SQL statements. 3. A DSN name is needed with the full database file name embedded if ODBC provider is applied.
- ctx (
-
delete_record_set
() → None:¶ Free resource occupied by existing rowset and its related database locking
Returns: Nothing Return type: None New in version 6.0.0.
-
execute_sql_command
((str)arg1) → None:¶ Execute a SQL command (DML,DDL) statement
Parameters: arg1 (str) – SQL DDL, DML statement Returns: Nothing Return type: None New in version 6.0.1.
Note:
1. Use this function to create tables, fields in a table update records and insert new records 2. No recordset will be returned if a SELECT statement is applied. 3. Typical SQL statements: CREATE, ALTER, UPDATE, INSERT. Example SQL statements: CREATE TABLE [myTable] (myCol1 TEXT (15),myCol2 TEXT (20)) ALTER TABLE [myTable] ADD COLUMN myID SHORT ALTER TABLE [myTable] DROP COLUMN myID DROP TABLE myTable UPDATE myTable SET myTable.myCol1 = 'Hello' WHERE myTable.myCol2 = 'World' INSERT INTO myTable (myCol1,myCol2,myID) VALUES ('My ID','is',5)
-
get_col_name
((int)arg1, (str_ref)arg2) → None:¶ Get name of a column (field) in the recordset
Parameters: - arg1 (int) – Index (1st column index is 0) of the column to get name
- arg2 (
geosoft.gx.str_ref
) – Returned string containing name of the column
Returns: Nothing
Return type: None
New in version 6.0.0.
Note:
An empty string will be returned if the column index is outside of range
-
get_next_row
((str_ref)arg1) → None:¶ Get one entire row of data in the recordset
Parameters: arg1 ( geosoft.gx.str_ref
) – Returned string containing one row of data, separated by commasReturns: Nothing Return type: None New in version 6.0.0.
Note:
This function should be used if all data in the recordset is to be obtained. This functioin will first the data in the first row and automatically increase the referece count of row number. Use GetOneRow_GOLEDB if data in one row is needed.
-
get_one_row
((int)arg1, (str_ref)arg2) → None:¶ Get one entire row of data in the recordset
Parameters: - arg1 (int) – Row number to retrieve data
- arg2 (
geosoft.gx.str_ref
) – Returned string containing one row of data, separated by commas
Returns: Nothing
Return type: None
New in version 6.0.0.
Note:
An emptry string is returned if the row number is outside of range
-
get_record_set_cols
() → int:¶ Get the number of columns in the existing recordset
Returns: Number of columns -1 if recordset does not exist Return type: int New in version 6.0.0.
Note:
No records in the recordset if number of columns is 0
-
get_record_set_rows
() → int:¶ Get the number of rows in the existing recordset
Returns: Number of rows -1 if recordset does not exist Return type: int New in version 6.0.0.
Note:
No records in the recordset if number of rows is 0
-
is_null
() → bool¶ Check if the instance of
geosoft.gx.GXGOLEDB is null (undefined)
Returns: True if this is a null instance of geosoft.gx.GXGOLEDB
, False otherwise.Return type: bool`
-
static
null
() → GXGOLEDB¶ A null (undefined) instance of
geosoft.gx.GXGOLEDB
Returns: A null geosoft.gx.GXGOLEDB
Return type: geosoft.gx.GXGOLEDB
-