This topic lists the FairCom DB Direct SQL Programmatic API broken into functional groupings: Initialization, Command and Parameter Functions, Table Management Functions and Data Type Functions. Each of these groupings sub-groups as described below.
Initialization
The initialization functions prepares the environment for the database operation and manages transactions. These functions involve the use or definition of the connection handle.
- ctsqlNewConnection
- ctsqlDisconnect
- ctsqlBegin
- ctsqlAbort
- ctsqlSetAutoCommit
- ctsqlGetIsolationLevel
- ctsqlIsActiveConn
- ctsqlGetErrorMessage
- ctsqlFreeConnection
- ctsqlConnect
- ctsqlGetUsername
- ctsqlCommit
- ctsqlGetAutoCommit
- ctsqlClearAutoCommit
- ctsqlSetIsolationLevel
- ctsqlGetDatabase
- ctsqlGetError
- ctsqlSetTLSClientAuth
Command and Parameter Functions
These functions prepare and execute FairCom DB SQL statements. They involve one command handle.
- ctsqlNewCommand
- ctsqlFreeCommand
- ctsqlAffectedRows
- ctsqlExecute
- ctsqlExecuteDirect
- ctsqlPrepare
- ctsqlPrepareBatch
- ctsqlGetParameter
- ctsqlSetParameter
- ctsqlSetBigIntParameter
- ctsqlSetBinaryParameter
- ctsqlSetCharParameter
- ctsqlSetDateParameter
- ctsqlSetFloatParameter
- ctsqlSetIntegerParameter
- ctsqlSetNCharParameter
- ctsqlSetNumericParameter
- ctsqlGetNumericParameterAsString
- ctsqlSetNumericParameterAsString
- ctsqlSetParameterAsString
- ctsqlSetParameterPrecision
- ctsqlSetParameterScale
- ctsqlSetTimeParameter
- ctsqlSetTimeStampParameter
- ctsqlGetParameterCount
- ctsqlGetParameterIndexByName
- ctsqlGetParameterLength
- ctsqlGetParameterName
- ctsqlGetParameterNullFlag
- ctsqlGetParameterPrecision
- ctsqlSetParameterPrecision
- ctsqlGetParameterScale
- ctsqlSetParameterScale
- ctsqlGetParameterType
Table Management Functions
The Table Management functions define and retrieve the table structure definition. These functions involve the use or definition of one cursor handle.
- ctsqlClose
- ctsqlFreeCursor
- ctsqlGetColumnCount
- ctsqlGetColumnLength
- ctsqlGetColumnName
- ctsqlGetColumnNameLen
- ctsqlGetColumnPrecision
- ctsqlGetColumnScale
- ctsqlGetColumnType
- ctsqlGetParameterIndexByName
- ctsqlIsColumnNull
- ctsqlIsNullable
- ctsqlNewCursor
- ctsqlNext
Data Type Functions
The data type functions define and retrieve the data types of the tables involved in the FairCom DB SQL database. Most of the functions involve the use of one cursor handle. ctsqlSetBlob() involves a command handle, and there are no handles involved with some other functions in this category.
Note: Be sure to choose a function of the correct data type for your specific field type. Using a different data type (for example using only 1 byte of a ctsqlGetSmallInt for a bit field) could produce unexpected results.
- ctsqlGetNChar
- ctsqlGetNumeric
- ctsqlGetSmallInt
- ctsqlGetInteger
- ctsqlGetReal
- ctsqlGetFloat
- ctsqlGetMoney
- ctsqlGetDate
- ctsqlGetTime
- ctsqlGetTimeStamp
- ctsqlGetTinyInt
- ctsqlGetBinary
- ctsqlGetBit
- ctsqlGetBigInt
- ctsqlGetBlob
- ctsqlSetBlob
- ctsqlCompare
- ctsqlConvert
- ctsqlDayOfWeek
- ctsqlAddNumeric
- ctsqlSubNumeric
- ctsqlMulNumeric
- ctsqlDivNumeric
- ctsqlRoundNumeric
FairCom DB DSQL Field Types
| Type Mnemonic | Type Number |
|---|---|
| CTSQL_CHAR | 1 |
| CTSQL_NUMERIC | 2 |
| CTSQL_SMALLINT | 3 |
| CTSQL_INTEGER | 4 |
| CTSQL_REAL | 5 |
| CTSQL_FLOAT | 6 |
| CTSQL_DATE | 7 |
| CTSQL_MONEY | 8 |
| CTSQL_TIME | 9 |
| CTSQL_TIMESTAMP | 10 |
| CTSQL_TINYINT | 11 |
| CTSQL_BINARY | 12 |
| CTSQL_BIT | 13 |
| CTSQL_LVC | 14 |
| CTSQL_LVB | 15 |
| CTSQL_BIGINT | 16 |
| CTSQL_NCHAR* | 17 |
| CTSQL_NVARCHAR* | 18 |
| CTSQL_NCHAR_CS* | 19 |
| CTSQL_NVARCHAR_CS* | 20 |
| CTSQL_VARCHAR | 21 |
| CTSQL_BLOB | 22 |
| CTSQL_CLOB | 23 |
| CTSQL_NLVC | 24 |
| CTSQL_NCLOB | 25 |
| CTSQL_VARBINARY | 26 |
*National character fields are only supported in the Unicode version of FairCom DB SQL.
FairCom DB DSQL Transaction Isolation Levels
| CTSQL_ISOLEVEL Mnemonic | Value |
| CTSQL_READ_UNCOMMITTED* | 0 |
| CTSQL_READ_COMMITTED | 1 |
| CTSQL_REPEATABLE_READ | 2 |
| CTSQL_SERIALIZABLE* | 3 |
*Levels CTSQL_READ_UNCOMMITTED and CTSQL_SERIALIZABLE are not currently supported by FairCom DB SQL