Contents

 
Developer's Guide
Copyright Notice
FairCom Typographical Conventions
Introduction
Overview
Layout of this Manual
Quick Tour
Introductory Tutorial
Init
Define
Manage
Done
Additional Resources
Relationships
Init
Define
Manage
Done
Additional Resources
Record/Row Locking
Init
Define
Manage
Done
Additional Resources
Transaction Processing
Init
Define
Manage
Done
Additional Resources
Programmer's Reference
Working with Sessions
Allocating a Session Handle
CTSESSION_SQL Limitations
Creating a new session dictionary
Session logon and logout
Session properties
Server, user name and password properties
Active property
Path property
Managing Databases
Creating a new Database
Adding an existing Database
Dropping a Database
Deleting a Database
First Database
Next Database
Find Database
First Active Database
Next Active Database
Find Active Database
Database UID (Unique IDentifier)
Find Database by UID
Find Active Database by UID
Session wide functions
Error Handling
Transaction Processing
Session Wide Locking
Default Date, Time and Float formats
User Defined Tags
Working with Sessions without Dictionary Support
Attach and Detach Existing Sessions
Session Dictionary
Working with Databases
Allocating a Database handle
Connecting to a database
Database properties
Database name
Table count
Database path
Managing Tables
Creating a new Table
Creating a new table under transaction control
Adding an existing table
Adding an existing table under transaction control
Dropping a table
Dropping a table under transaction control
Deleting a table
Deleting a table under transaction control
First Table
Next Table
Find Table
First Active Table
Next Active Table
Find Active Table
Table UID (Unique IDentifier)
Find Table by UID
Find Active Table by UID
Database Dictionary
Working with Tables
Allocating a table handle
Allocating a table handle without database support
Creating a new table
Adding, inserting or deleting fields
Field types
Fixed or variable length records
Hidden fields
Adding or deleting indices
Segment Modes
ROWID index
RECBYT index
Changing default properties
Creating the table
Creating a table under transaction control
Opening a table
Opening a table with password
Closing a table
Altering a table
Add, insert, delete, or edit fields
Add, edit or delete indices
Alter the table
Default Values
Adding an index to a table
Deleting an index from a table
Forcing an index rebuild
Forcing a table rebuild
Attach and Detach Open Tables
Table Properties
Table name
Table Path
Table file extension
Index file extension
Data file extent size
Index file extent size
Table password
Table group ID
Table permission mask
Number of fields
Number of indices
Field padding
Update create mode
Working with Records
Allocating a record handle
Sharing the same context
Record buffer layout
Resetting a record
Releasing a record handle
User managed record buffers
The default index
Selecting the RECBYT index
Selecting the ROWID index
Navigating records
First record
Last record
Next record
Previous record
Seek to record
Finding records
Find Modes
Building a target key
Finding records by target key
Finding records by ROWID
Record sets
Creating a record set
Terminating a record set
Record Filters
Filter expression syntax
Constants
Variables
Parentheses
Predefined Functions
String and Text Functions
Date and Time Functions
Mathematical Functions
Type Casting
Automatic Type Promotion
Operators
Record Batches
Batches with c-treeDB
Batch Modes
Starting a new batch operation
Retrieving records by partial key
Retrieving records by index range
Retrieving records by physical order
Deleting a group of records
Inserting a group of records
Retrieving records
Terminating a batch operation
Retrieving batch properties
Reading and writing field data to a record buffer
Automatic data type conversion
Null field support
Defined field size
Actual field length
Field address in record buffer
Field offset in record buffer
Check if field is fixed or variable length
Using field names
Clearing the record buffer
Clearing a field
Adding new records
Updating existing records
Deleting records
Record properties
New record flag
Edited record flag
Record offset
Record count
Record ROWID
Record Locking
Check if a record is locked
Demoting record locks
Data Types
Scalar Types
Date Types
Time Types
Date/Time (Timestamp) Types
Numeric Types
CTBIGINT
CTMONEY
CTCURRENCY
CTNUMBER
Data Integrity
Locking
Starting locks
Lock modes
Freeing locks
Freeing locks associated with a table
Transactions
Atomicity
Automatic Recovery
Creating tables for transaction processing
Starting a transaction
Terminating a transaction
Save Points
Working with Resources
Types of Resources
Resource Identification
Resource Type
Resource Number
Resource Name
c-treeDB C API - Working with Resources
Allocating and Releasing Resource Handles
Adding New Resources
Deleting Resources
Updating Existing Resources
Reading Resources
Get and Set Resource Properties with the c-treeDB C API
Resource Locks
Working with Callbacks
Callback Function Type
Callback Return Codes
Callback Handle Parameters
Sessions
Databases
Tables
Records
Callback Types
CTDB_ON_SESSION_LOGON
CTDB_ON_ SESSION_LOGOUT
CTDB_ON_DATABASE_CONNECT
CTDB_ON_DATABASE_DISCONNECT
CTDB_ON_TABLE_OPEN
CTDB_ON_TABLE_CLOSE
CTDB_ON_TABLE_GET_SCHEMA
CTDB_ON_TABLE_GET_DODA
CTDB_ON_TABLE_GET_RECLEN
CTDB_ON_TABLE_GET_EXT_INFO
CTDB_ON_TABLE_REBUILD
CTDB_ON_TABLE_ALTER
CTDB_ON_TABLE_REBUILD
CTDB_ON_RECORD_INIT
CTDB_ON_RECORD_RESET
CTDB_ON_RECORD_BEFORE_READ
CTDB_ON_RECORD_AFTER_READ
CTDB_ON_RECORD_BEFORE_BUILD_KEY
CTDB_ON_RECORD_AFTER_BUILD_KEY
CTDB_ON_RECORD_BEFORE_WRITE
CTDB_ON_RECORD_AFTER_WRITE
CTDB_ON_RECORD_MAPTOPARENT
CTDB_ON_RECORD_MAPTOCHILD
Working with Callbacks
Allocating and Freeing Memory Inside Callbacks
Working with Unicode
Unicode UTF-16
Unicode UTF-8
c-treeDB C/C++ API UTF-8 Compliance
Activating c-treeDB Unicode support
ICU - International Components for Unicode
Unicode Support
c-treeACE Unicode UTF-16 Field Types
Creating Tables with Unicode Field types
c-treeDB C API Example
Reading UTF-16 Field Data
Reading UTF-16 C Example
Writing UTF-16 Field Data
Writing UTF-16 Data C Example
Creating Key Segments based on Unicode Fields
How to Specify a Unicode Key Segment
Specifing a Unicode Key Segment C Example
Specifying a Unicode Key Segment with CTSEG_UNCSEG
CTSEG_UNCSEG C API Example
ICU Collation Option Overview
Storing UTF-8 Data
Converting from Unicode UTF-16 to UTF-8
Extended Key Segment Definition
c-treeDB C API Functions
Extended Key Segment Structure
ctKSEG_SSIZ_COMPUTED
ctKSEG_SSIZ PROVIDED
Compatibility with other c-tree API Technologies
Compatibility with c-treeACE ISAM and Low-level Data Files
Compatibility with c-treeACE SQL
Field mapping between c-treeACE SQL, c-treeDB and c-treeDB.NET
c-treeDB, ISAM, and Low-Level Integration
Overview
Switching c-tree instances
Switching ISAM contexts
Obtaining table data and file number
Obtaining data file number
Obtaining index file number
c-treeDB C API Function Reference
c-treeDB definitions
Field types
Find Modes
Index Key Types
Record Lock Modes
Session Wide Lock Modes
Segment Modes
Table Create Modes
Table Open Modes
Table Permissions
c-treeDB C API Summary
Initialization
Transaction Processing
Data Definition
Data Manipulation
Data Types
Data Structures
Utility
Function Descriptions
ctdbAbort
ctdbAddCriteria
ctdbAddDatabase
ctdbAddField
ctdbAddIndex
ctdbAddResource
ctdbAddSegment
ctdbAddSegmentByName
ctdbAddSegmentByNbr
ctdbAddSegmentEx
ctdbAddTable
ctdbAddTableXtd
ctdbAllocateResultSet
ctdbAllocDatabase
ctdbAllocRecord
ctdbAllocResource
ctdbAllocSession
ctdbAllocTable
ctdbAlterTable
ctdbAttachSession
ctdbAttachTable
ctdbAttachTableXtd
ctdbBatchLoaded
ctdbBatchLocked
ctdbBatchMode
ctdbBatchTotal
ctdbBegin
ctdbBeginImpersonation
ctdbBigIntToCurrency
ctdbBigIntToFloat
ctdbBigIntToLong
ctdbBigIntToNumber
ctdbBigIntToString
ctdbBlobAlloc
ctdbBlobClear
ctdbBlobCmp
ctdbBlobFree
ctdbBlobGetData
ctdbBlobGetSize
ctdbBlobSet
ctdbBuildTargetKey
ctdbClearAllCallback
ctdbClearAllFieldDefaultValue
ctdbClearCallback
ctdbClearFieldDefaultValue
ctdbClearError
ctdbClearField
ctdbClearRecord
ctdbClearSavePoint
ctdbCloneTable
ctdbCloseAll
ctdbCloseTable
ctdbCommit
ctdbConnect
ctdbCreateDatabase
ctdbCreateSession
ctdbCreateTable
ctdbCurrencyAbs
ctdbCurrencyAdd
ctdbCurrencyCmp
ctdbCurrencyDiv
ctdbCurrencyMul
ctdbCurrencyRound
ctdbCurrencySub
ctdbCurrencyToBigInt
ctdbCurrencyToFloat
ctdbCurrencyToLong
ctdbCurrencyToMoney
ctdbCurrencyToNumber
ctdbCurrencyToString
ctdbCurrentDate
ctdbCurrentDateTime
ctdbCurrentTime
ctdbDateCheck
ctdbDatePack
ctdbDateTimeGetDate
ctdbDateTimeGetTime
ctdbDateTimePack
ctdbDateTimeSetDate
ctdbDateTimeSetTime
ctdbDateTimeToString
ctdbDateTimeUnpack
ctdbDateToString
ctdbDateUnpack
ctdbDayOfWeek
ctdbDeleteDatabase
ctdbDeleteRecord
ctdbDeleteTable
ctdbDelField
ctdbDelFieldByName
ctdbDelIndex
ctdbDeleteResource
ctdbDelSegment
ctdbDelSegmentEx
ctdbDetachSession
ctdbDetachTable
ctdbDisconnect
ctdbDisconnectAll
ctdbDropDatabase
ctdbDropTable
ctdbDuplicateRecord
ctdbEndBatch
ctdbEndImpersonation
ctdbEstimateSpan
ctdbFilterRecord
ctdbFindActiveDatabase
ctdbFindActiveDatabaseByUID
ctdbFindActiveTable
ctdbFindActiveTableByUID
ctdbFindDatabase
ctdbFindDatabaseByUID
ctdbFindRecord
ctdbFindResource
ctdbFindResourceByName
ctdbFindRowid
ctdbFindTable
ctdbFindTableByUID
ctdbFindTarget
ctdbFirstDatabase
ctdbFirstRecord
ctdbFirstResource
ctdbFirstTable
ctdbFloatToBigInt
ctdbFloatToCurrency
ctdbFloatToMoney
ctdbFloatToNumber
ctdbFreeDatabase
ctdbFreeRecord
ctdbFreeResource
ctdbFreeResultSet
ctdbFreeSession
ctdbFreeTable
ctdbGetActiveDatabaseUID
ctdbGetActiveTableByUID
ctdbGetActiveTableUID
ctdbGetAttachMode
ctdbGetAutoCommit
ctdbGetCallback
ctdbGetCndxIndex
ctdbGetCndxIndexByName
ctdbGetCndxIndexLength
ctdbGetCndxIndexLengthByName
ctdbGetCtreeOWNER
ctdbGetDatabaseCount
ctdbGetDatabaseHandle
ctdbGetDatabaseName
ctdbGetDatabasePath
ctdbGetDatabaseUID
ctdbGetDatno
ctdbGetDay
ctdbGetDefaultIndex
ctdbGetDefaultIndexName
ctdbGetDefDateType
ctdbGetDefFloatFormat
ctdbGetDefTimeType
ctdbGetError
ctdbGetErrorIndex
ctdbGetField
ctdbGetFieldAddress
ctdbGetFieldAsBigint
ctdbGetFieldAsBinary
ctdbGetFieldAsBlob
ctdbGetFieldAsBool
ctdbGetFieldAsCurrency
ctdbGetFieldAsDate
ctdbGetFieldAsDateTime
ctdbGetFieldAsFloat
ctdbGetFieldAsMoney
ctdbGetFieldAsNumber
ctdbGetFieldAsSigned
ctdbGetFieldAsString
ctdbGetFieldAsTime
ctdbGetFieldAsUnsigned
ctdbGetFieldAsUTF16
ctdbGetFieldByName
ctdbGetFieldDataLength
ctdbGetFieldDefaultDateType
ctdbGetFieldDefaultTimeType
ctdbGetFieldDefaultValue
ctdbGetFieldHandle
ctdbGetFieldLength
ctdbGetFieldName
ctdbGetFieldNbr
ctdbGetFieldNullFlag
ctdbGetFieldNumber
ctdbGetFieldNumberByName
ctdbGetFieldOffset
ctdbGetFieldPrecision
ctdbGetFieldProperties
ctdbGetFieldScale
ctdbGetFieldSize
ctdbGetFieldStatus
ctdbGetFieldType
ctdbGetFilter
ctdbGetFirstActiveDatabase
ctdbGetFirstActiveTable
ctdbGetFirstPartition
ctdbGetHandleType
ctdbGetHour
ctdbGetIdentityFieldDetails
ctdbGetIdxnoByName
ctdbGetIdxno
ctdbGetIdxnoByNumber
ctdbGetIndex
ctdbGetIndexByName
ctdbGetIndexByUID
ctdbGetIndexDuplicateFlag
ctdbGetIndexEmptyChar
ctdbGetIndexExtension
ctdbGetIndexFileName
ctdbGetIndexHandle
ctdbGetIndexKeyLength
ctdbGetIndexKeyType
ctdbGetIndexName
ctdbGetIndexNbr
ctdbGetIndexNbrByName
ctdbGetIndexNullFlag
ctdbGetIndexKSeg
ctdbGetIndexSegmentCount
ctdbGetIndexStatus
ctdbGetIndexTemporaryFlag
ctdbGetIndexUID
ctdbGetLastIdentity
ctdbGetLastPartition
ctdbGetLibType
ctdbGetKeepLock
ctdbGetLocalTag
ctdbGetLockMode
ctdbGetLogonOnly
ctdbGetMinute
ctdbGetMonth
ctdbGetNextActiveDatabase
ctdbGetNextActiveTable
ctdbGetOperationState
ctdbGetPadChar
ctdbGetPathPrefix
ctdbGetRebuildProgress
ctdbGetRecord
ctdbGetRecordBuffer
ctdbGetRecordCount
ctdbGetRecordHandle
ctdbGetRecordKeyPos
ctdbGetRecordLength
ctdbGetRecordLock
ctdbGetRecordNbr
ctdbGetRecordPos
ctdbGetRecordSize
ctdbGetResourceData
ctdbGetResourceDataLength
ctdbGetResourceName
ctdbGetResourceNumber
ctdbGetResourceType
ctdbGetResultSetByName
ctdbGetResultSetCriHandle
ctdbGetResultSetHandle
ctdbGetRowid
ctdbGetSecond
ctdbGetSegment
ctdbGetSegmentField
ctdbGetSegmentFieldName
ctdbGetSegmentHandle
ctdbGetSegmentKSeg
ctdbGetSegmentMode
ctdbGetSegmentNbr
ctdbGetSegmentPartialField
ctdbGetSegmentStatus
ctdbGetServerName
ctdbGetSessionHandle
ctdbGetSessionParams
ctdbGetSessionPath
ctdbGetSessionType
ctdbGetSystemConfig
ctdbGetTable
ctdbGetTableCount
ctdbGetTableCreateMode
ctdbGetTableDefaultDataExtentSize
ctdbGetTableDefaultIndexExtentSize
ctdbGetTableExtension
ctdbGetTableFieldCount
ctdbGetTableGroupid
ctdbGetTableHandle
ctdbGetTableIndexCount
ctdbGetTableName
ctdbGetTableNbr
ctdbGetTableOpenMode
ctdbGetTableOwner
ctdbGetTablePassword
ctdbGetTablePath
ctdbGetTablePermission
ctdbGetTableStatus
ctdbGetTableUID
ctdbGetTransactionMode
ctdbGetUserLogonName
ctdbGetUserPassword
ctdbGetUserTag
ctdbGetYear
ctdbGetTableKSeg
ctdbHasDelField
ctdbHasNullFieldSupport
ctdbHasRecbyt
ctdbHasRowid
ctdbInsertBatch
ctdbInsField
ctdbInsFieldByName
ctdbInsSegment
ctdbInsSegmentByName
ctdbInsSegmentByNbr
ctdbInsSegmentEx
ctdbIsActiveDatabase
ctdbIsActiveSession
ctdbIsActiveTable
ctdbIsBatchActive
ctdbIsDatabaseExclusive
ctdbIsEditedRecord
ctdbIsExtSegment
ctdbIsFieldDefaultValueSet
ctdbIsFieldNumeric
ctdbIsFilteredRecord
ctdbIsLeapYear
ctdbIsLockActive
ctdbIsNewRecord
ctdbIsNullField
ctdbIsNumberZero
ctdbIsRecordRangeOn
ctdbIsRecordSetOn
ctdbIsResourceLocked
ctdbIsSessionExclusive
ctdbIsTransActive
ctdbIsVariableField
ctdbLastRecord
ctdbLock
ctdbLockRecord
ctdbLogon
ctdbLogout
ctdbLongToBigInt
ctdbLongToCurrency
ctdbLongToMoney
ctdbLongToNumber
ctdbMergeDatabaseDictionary
ctdbMergeSessionDictionary
ctdbMoneyAbs
ctdbMoneyAdd
ctdbMoneyCmp
ctdbMoneyDiv
ctdbMoneyMul
ctdbMoneySub
ctdbMoneyToCurrency
ctdbMoneyToFloat
ctdbMoneyToLong
ctdbMoneyToNumber
ctdbMoneyToString
ctdbMoveField
ctdbMoveSegment
ctdbNextBatch
ctdbNextDatabase
ctdbNextRecord
ctdbNextResource
ctdbNextTable
ctdbNumberAbs
ctdbNumberAdd
ctdbNumberCmp
ctdbNumberCopy
ctdbNumberDiv
ctdbNumberGetDecimal
ctdbNumberMul
ctdbNumberNegate
ctdbNumberOfKeyEntries
ctdbNumberRound
ctdbNumberSub
ctdbNumberToBigInt
ctdbNumberToCurrency
ctdbNumberToFloat
ctdbNumberToLong
ctdbNumberToMoney
ctdbNumberToString
ctdbNumberZero
ctdbOpenTable
ctdbOpenTableByUID
ctdbPartAdminByKey
ctdbPartAdminByName
ctdbPartAdminByNumber
ctdbPrevRecord
ctdbReadRecord
ctdbRebuildTable
ctdbRecordAtPercentile
ctdbRecordRangeOff
ctdbRecordRangeOn
ctdbRecordSetOff
ctdbRecordSetOn
ctdbRemoveCriteria
ctdbRemoveTable
ctdbResetAll
ctdbResetRecord
ctdbRestoreSavePoint
ctdbResultSetOnOff
ctdbSeekRecord
ctdbSetAutoCommit
ctdbSetBatch
ctdbSetCallback
ctdbGetCtreeOWNER
ctdbSetCurrentNodeName
ctdbSetDatabaseExclusive
ctdbSetDefaultIndex
ctdbSetDefaultIndexByName
ctdbSetDefDateType
ctdbSetDefFloatFormat
ctdbSetDefTimeType
ctdbSetEditedRecord
ctdbSetError
ctdbSetExtensionHint
ctdbSetFieldAsBigint
ctdbSetFieldAsBinary
ctdbSetFieldAsBlob
ctdbSetFieldAsBool
ctdbSetFieldAsCurrency
ctdbSetFieldAsDate
ctdbSetFieldAsDateTime
ctdbSetFieldAsFloat
ctdbSetFieldAsMoney
ctdbSetFieldAsNumber
ctdbSetFieldAsSigned
ctdbSetFieldAsString
ctdbSetFieldAsTime
ctdbSetFieldAsUnsigned
ctdbSetFieldAsUTF16
ctdbSetFieldDefaultDateTimeType
ctdbSetFieldDefaultValue
ctdbSetFieldLength
ctdbSetFieldName
ctdbSetFieldNullFlag
ctdbSetFieldPrecision
ctdbSetFieldProperties
ctdbSetFieldScale
ctdbSetFieldType
ctdbSetIdentityField
ctdbSetIndexCndxExpr
ctdbSetIndexDuplicateFlag
ctdbSetIndexEmptyChar
ctdbSetIndexExtension
ctdbSetIndexFileName
ctdbSetIndexKeyType
ctdbSetIndexKSeg
ctdbSetIndexName
ctdbSetIndexNullFlag
ctdbSetIndexTemporaryFlag
ctdbSetKeepLock
ctdbSetKSegDefaults
ctdbSetLocalTag
ctdbSetLogonOnly
ctdbSetNewRecord
ctdbSetOperationState
ctdbSetPadChar
ctdbSetPathPrefix
ctdbSetRecordBuffer
ctdbSetRecordOffset
ctdbSetRecordPos
ctdbRenameTable
ctdbSetResourceData
ctdbSetResourceName
ctdbSetResourceNumber
ctdbSetResourceType
ctdbSetSavePoint
ctdbSetSegmentKSeg
ctdbSetSegmentMode
ctdbSetSessionParams
ctdbSetSessionPath
ctdbSetSessionExclusive
ctdbSetSessionType
ctdbSetSavePoint
ctdbSetTableDefaultDataExtentSize
ctdbSetTableDefaultIndexExtentSize
ctdbSetTableExtension
ctdbSetTableGroupid
ctdbSetTableKSeg
ctdbSetTablePassword
ctdbSetTablePath
ctdbSetTablePermission
ctdbSetTableOwner
ctdbSetTransactionMode
ctdbSetUserTag
ctdbStartDatabaseEngine
ctdbStopDatabaseEngine
ctdbSetConfigurationFile
ctdbStringToBigInt
ctdbStringToCurrency
ctdbStringToDate
ctdbStringToDateTime
ctdbStringToMoney
ctdbStringToNumber
ctdbStringToTime
ctdbSwitchContext
ctdbSwitchInstance
ctdbSystemFilterOff
ctdbSystemFilterOn
ctdbTimeCheck
ctdbTimePack
ctdbTimeToString
ctdbTimeUnpack
ctdbUnlock
ctdbUnlockRecord
ctdbUnlockResource
ctdbUnlockTable
ctdbUpdateCndxIndex
ctdbUpdateCndxIndexByName
ctdbUpdateCreateMode
ctdbRemoveCriteria
ctdbUpdatePadChar
ctdbUpdateResource
ctdbWriteRecord
ctdb_u16TOu8
ctdb_u8TOu16
c-treeACE Error Code Reference
c-treeDB Error and Return Values
Index