CLI functions return codes
|
|
Error code
|
Description
|
cli_ok
|
Succeful completion
|
cli_bad_address
|
Invalid format of server
|
cli_connection_refused
|
Connection with server could not be established
|
cli_bad_statement
|
Text of SQL statement is not correct
|
cli_parameter_not_found
|
Parameter was not found in statement -
|
cli_unbound_parameter
|
Parameter was not specified
|
cli_column_not_found
|
No sucj colunm in the table
|
cli_incompatible_type
|
Conversion between application and database type is not possible
|
cli_network_error
|
Connection with server is broken
|
cli_runtime_error
|
Error during query execution
|
cli_bad_descriptor
|
Invalid statement/session description
|
cli_unsupported_type
|
Unsupported type for parameter or colunm
|
cli_not_found
|
Record was not found
|
cli_not_update_mode
|
Attempt to update records selected by view only cursor
|
cli_table_not_found
|
There is no table with specified name in the database
|
cli_not_all_columns_specified
|
Insert statement doesn't specify values for all table columns
|
cli_not_fetched
|
cli_fetch
method was not called
|
cli_already_updated
|
cli_update
method was invoked more than once for the same record
|
cli_table_already_exists
|
Attempt to create existed table
|
cli_not_implemented
|
Function is not implemented
|
Supported types
|
||
Type
|
Description
|
Size
|
cli_oid
|
Object identifier
|
4
|
cli_bool
|
Boolean type
|
1
|
cli_int1
|
Timy interger type
|
1
|
cli_int2
|
Small interger type
|
2
|
cli_int4
|
Interger type
|
4
|
cli_int8
|
Big interger type
|
8
|
cli_real4
|
Single precision floating point type
|
4
|
cli_real8
|
Double precision floating point type
|
8
|
cli_asciiz
|
Zero terminated string of bytes
|
1*N
|
cli_pasciiz
|
Pointer to zero terminated string
|
1*N
|
cli_array_of_oid
|
Array of references
|
4*N
|
cli_array_of_bool
|
Array of booleans
|
1*N
|
cli_array_of_int1
|
Array of tiny integers
|
1*N
|
cli_array_of_int2
|
Array of small integers
|
2*N
|
cli_array_of_int4
|
Array of integers
|
4*N
|
cli_array_of_int8
|
Array of big integers
|
8*N
|
cli_array_of_real4
|
Array of reals
|
4*N
|
cli_array_of_real8
|
Array of long reals
|
8*N
|
int cli_open(char const* server_url,
int max_connect_attempts,
int reconnect_timeout_sec);
与服务器建立连接
参数
server_url-0
终止的字符串,服务器地址和端口,如
"localhost:5101", "195.239.208.240:6100"...
max_connect_attempts-
建立连接的尝试次数
reconnect_timeout_sec-
连接尝试的时间间隔,以秒为单位
返回值
>= 0-
将由所有其它cli
调用使用的连接描述符
<0-
cli_result_code
中说明的错误吗
int cli_close(int session);
关闭会话
参数
session-cli_open返回的会话描述符
返回值
如cli_result_code
所述
int cli_statement(int session, char const* stmt);
指定要在服务器端执行的SubSQL语句。可以建立参数和列的绑定。
参数
session-cli_open返回的会话描述符
stmt-0终止的SubSQL语句字符串
返回值
>= 0-
语句描述符
<0
cli_result_code
所述的错误码
int cli_parameter(int statement,
char const* param_name,
int var_type,
void* var_ptr);
将参数与语句绑定
参数
statement-
cli_statement
返回的描述符
param_name-0
终止的参数名字符串。参数名必须以'%'
开始
var_type-
cli_var_type中所述的参数类型。只支持标量和0终止字符串类型
var_ptr-
指向变量的指针。
返回值
cli_result_code
所述的结果编码