📄 cli.h
字号:
int FASTDB_DLL_ENTRY cli_column(int statement, char const* column_name, int var_type, int* var_len, void* var_ptr);typedef void* (CLI_CALLBACK_CC *cli_column_set)(int var_type, void* var_ptr, int len);typedef void* (CLI_CALLBACK_CC *cli_column_get)(int var_type, void* var_ptr, int* len);typedef void* (CLI_CALLBACK_CC *cli_column_set_ex)(int var_type, void* var_ptr, int len, char const* column_name, int statement, void const* data_ptr, void* user_data);typedef void* (CLI_CALLBACK_CC *cli_column_get_ex)(int var_type, void* var_ptr, int* len, char const* column_name, int statemen, void* user_data);/********************************************************************* * cli_array_column * Specify get/set functions for the array column * Parameters: * statement - statememt descriptor returned by cli_statement * column_name - zero terminated string with column name * var_type - type of variable as described in cli_var_type enum * var_ptr - pointer to the variable * set - function which will be called to construct fetched * field. It receives pointer to the variable, * length of the fetched array and returns pointer to th * array's elements * get - function which will be called to update the field in the * database. Given pointer to the variable, it should return * pointer to the array elements and store length of the * array to the variable pointer by len parameter * user_data - pointer to user specific data passed to get and set functions * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_array_column(int statement, char const* column_name, int var_type, void* var_ptr, cli_column_set set, cli_column_get get); int FASTDB_DLL_ENTRY cli_array_column_ex(int statement, char const* column_name, int var_type, void* var_ptr, cli_column_set_ex set, cli_column_get_ex get, void* user_data); enum { cli_view_only, cli_for_update};/********************************************************************* * cli_fetch * Execute select statement. * Parameters: * statement - statememt descriptor returned by cli_statement * for_update - not zero if fetched rows will be updated * Returns: * >= 0 - success, for select statements number of fetched rows is returned * < 0 - error code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_fetch(int statement, int for_update);/********************************************************************* * cli_insert * Execute insert statement. * Parameters: * statement - statememt descriptor returned by cli_statement * oid - object identifier of created record. * Returns: * status code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_insert(int statement, cli_oid_t* oid);/********************************************************************* * cli_get_first * Get first row of the selection. * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_get_first(int statement);/********************************************************************* * cli_get_last * Get last row of the selection. * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_get_last(int statement);/********************************************************************* * cli_get_next * Get next row of the selection. If get_next records is called * exactly after cli_fetch function call, is will fetch the first record * in selection. * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_get_next(int statement);/********************************************************************* * cli_get_prev * Get previous row of the selection. If get_next records is called * exactly after cli_fetch function call, is will fetch the last record * in selection. * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_get_prev(int statement);/********************************************************************* * cli_skip * Skip specified number of rows. * Parameters: * statement - statememt descriptor returned by cli_statement * n - number of objects to be skipped * - if "n" is positive, then this function has the same effect as * executing cli_get_next() function "n" times. * - if "n" is negative, then this function has the same effect as * executing cli_get_prev() function "-n" times. * - if "n" is zero, this method just reloads current record * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_skip(int statement, int n);/********************************************************************* * cli_seek * Position cursor to the record with specified OID * Parameters: * statement - statememt descriptor returned by cli_statement * oid - object identifier of the record to which cursor should be positioned * Returns: * >= 0 - success, position of the record in the selection * < 0 - error code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_seek(int statement, cli_oid_t oid);/********************************************************************* * cli_get_oid * Get object identifier of the current record * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * object identifier or 0 if no object is seleected */cli_oid_t FASTDB_DLL_ENTRY cli_get_oid(int statement);/********************************************************************* * cli_update * Update the current row in the selection. You have to set * for_update parameter of cli_fetch to 1 in order to be able * to perform updates. Updated value of row fields will be taken * from bound column variables. * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_update(int statement);/********************************************************************* * cli_remove * Remove all selected records. You have to set * for_update parameter of cli_fetch to 1 in order to be able * to remove records. * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_remove(int statement);/********************************************************************* * cli_free * Deallocate statement and all associated data * Parameters: * statement - statememt descriptor returned by cli_statement * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_free(int statement);/********************************************************************* * cli_commit * Commit current database transaction * Parameters: * session - session descriptor as returned by cli_open * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_commit(int session);/********************************************************************* * cli_precommit * Release all locks set by transaction. This methods allows other clients * to proceed, but it doesn't flush transaction to the disk. * Parameters: * session - session descriptor as returned by cli_open * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_precommit(int session);/********************************************************************* * cli_abort * Abort current database transaction * Parameters: * session - session descriptor as returned by cli_open * Returns: * result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_abort(int session);enum cli_field_flags { cli_hashed = 1, /* field should be indexed usnig hash table */ cli_indexed = 2 /* field should be indexed using B-Tree */};typedef struct cli_field_descriptor { enum cli_var_type type; int flags; char const* name; char const* refTableName; char const* inverseRefFieldName;} cli_field_descriptor;/********************************************************************* * cli_describe * Describe fields of specified table * Parameters: * session - session descriptor as returned by cli_open * table - name of the table * fields - address of the pointer to the array of fields descriptors, * this array should be later deallocated by application by cli_free_memory() * Returns: * >= 0 - number of fields in the table * < 0 - result code as described in cli_result_code enum */int FASTDB_DLL_ENTRY cli_describe(int session, char const* table, cli_field_descriptor** fields);/********************************************************************* * cli_get_field_size * Calculate field size * Parameters: * fields - array with fields descriptors obtained using cli_describe function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -