Gentee Programming Language > Documentation > Libraries Download documentation

Data Access Using ODBC

This library is applied for running SQL queries on a database using ODBC. For using this library, it is required to specify the file odbc.ge (from Lib subfolder) with include command.
The queries with parameters are not supported by the current version.

The object of the odbc type provides connection to a database.
The objects of the odbcquery type are used to run SQL queries and move the cursor through a result set. This object has got the arr fields[] of odbcfield array that contains result set fields odbcfield; furthermore, the number of elements of the array equals the number of the fields.
The objects of the odbcfield type make it possible to get the required information of the field as well as the field's value (depending on the current position of the cursor in the result set).

The sequence of operations for working with the database:

There are some peculiarities to keep in mind when working with ODBC drivers:
while running a SQL query with the help of multiple sequential statements of the "INSERT ..." type, only some of the query statements are being executed (there can be from 300 to 1000 statements used for the "SQL server" driver) and no error message is displayed. In this case, you had better divide such queries into several parts;
some types of drivers do not make it possible to calculate the total number of messages received by the SQL query.

  • Methods
  • SQL query methods.
  • Field methods

    Methods

    odbc.connectCreate a database connection
    odbc.disconnectDisconnect from a database
    odbc.geterrorGet the last error message.
    odbc.newqueryCreate a new ODBC query

    SQL query methods.

    odbcquery.activeCheck whether a result set exists after the SQL query execution
    odbcquery.closeClose a result set
    odbcquery.fieldbynameFind a field based on a specified field name
    odbcquery.firstMove the cursor to the first record in the result set
    odbcquery.geterrorGet the last error message
    odbcquery.getrecordcountGet the total number of records in a result set
    odbcquery.lastMove the cursor to the last record in the result set
    odbcquery.movebyMove the cursor to a position relative to its current position
    odbcquery.nextMove the cursor to the next record in the result set
    odbcquery.priorMove the cursor to the prior record in the result set
    odbcquery.runSQL query execution
    odbcquery.settimeoutSet query timeout

    Field methods

    odbcfield.getbufGet the field's value as a value of the buf type (the binary data)
    odbcfield.getdatetimeGet the field's value as a value of the datetime type
    odbcfield.getdoubleGet the field's value as a floating-point number of the ulong type
    odbcfield.getindexGet the field index number
    odbcfield.getintGet the field's value as an integer of the int type
    odbcfield.getlongGet the field's value as an integer of the long type
    odbcfield.getnameGet the field's name
    odbcfield.getnumericGet the field's value as a fixed point number of the numeric type
    odbcfield.getstrGet the field's value as a string of the str type
    odbcfield.gettypeGet a type of the field's value
    odbcfield.getuintGet the field's value as an unsigned integer of the uint type
    odbcfield.getulongGet the field's value as an unsigned integer of the ulong type
    odbcfield.isnullDetermine if the field contains the NULL value


     Copyright © 2004-2006 Gentee Inc. All rights reserved.