📄 cli_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>FastDB: cli.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.5 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a></div><h1>cli.h</h1><div class="fragment"><pre>00001 <span class="comment">/*-< CLI.H >---------------------------------------------------------*--------*</span>00002 <span class="comment"> * FastDB Version 1.0 (c) 1999 GARRET * ? *</span>00003 <span class="comment"> * (Main Memory Database Management System) * /\| *</span>00004 <span class="comment"> * * / \ *</span>00005 <span class="comment"> * Created: 13-Jan-2000 K.A. Knizhnik * / [] \ *</span>00006 <span class="comment"> * Last update: 13-Jan-2000 K.A. Knizhnik * GARRET *</span>00007 <span class="comment"> *-------------------------------------------------------------------*--------*</span>00008 <span class="comment"> * Call level interface to FastDB server</span>00009 <span class="comment"> *-------------------------------------------------------------------*--------*/</span>00010 00011 <span class="preprocessor">#ifndef __CLI_H__</span>00012 <span class="preprocessor"></span><span class="preprocessor">#define __CLI_H__</span>00013 <span class="preprocessor"></span>00014 <span class="preprocessor">#include <stdlib.h></span>00015 00016 <span class="preprocessor">#ifndef FASTDB_DLL_ENTRY</span>00017 <span class="preprocessor"></span><span class="preprocessor">#ifdef FASTDB_DLL</span>00018 <span class="preprocessor"></span><span class="preprocessor">#ifdef INSIDE_FASTDB</span>00019 <span class="preprocessor"></span><span class="preprocessor">#define FASTDB_DLL_ENTRY __declspec(dllexport)</span>00020 <span class="preprocessor"></span><span class="preprocessor">#else</span>00021 <span class="preprocessor"></span><span class="preprocessor">#define FASTDB_DLL_ENTRY __declspec(dllimport)</span>00022 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00023 <span class="preprocessor"></span><span class="preprocessor">#else</span>00024 <span class="preprocessor"></span><span class="preprocessor">#define FASTDB_DLL_ENTRY</span>00025 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00026 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00027 <span class="preprocessor"></span>00028 <span class="preprocessor">#ifdef __cplusplus</span>00029 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> { 00030 <span class="preprocessor">#endif</span>00031 <span class="preprocessor"></span>00032 <span class="keyword">enum</span> cli_result_code { 00033 cli_ok = 0,00034 cli_bad_address = -1,00035 cli_connection_refused = -2,00036 cli_database_not_found = -3, 00037 cli_bad_statement = -4,00038 cli_parameter_not_found = -5,00039 cli_unbound_parameter = -6,00040 cli_column_not_found = -7,00041 cli_incompatible_type = -8,00042 cli_network_error = -9,00043 cli_runtime_error = -10,00044 cli_bad_descriptor = -11,00045 cli_unsupported_type = -12,00046 cli_not_found = -13,00047 cli_not_update_mode = -14,00048 cli_table_not_found = -15,00049 cli_not_all_columns_specified = -16, 00050 cli_not_fetched = -17,00051 cli_already_updated = -18, 00052 cli_table_already_exists = -19, 00053 cli_not_implemented = -2000054 };00055 00056 <span class="keyword">enum</span> cli_var_type { 00057 cli_oid,00058 cli_bool, 00059 cli_int1, 00060 cli_int2,00061 cli_int4,00062 cli_int8,00063 cli_real4,00064 cli_real8,00065 cli_decimal, <span class="comment">/* not supported */</span>00066 cli_asciiz, <span class="comment">/* zero terminated string */</span>00067 cli_pasciiz, <span class="comment">/* pointer to zero terminated string */</span>00068 cli_cstring, <span class="comment">/* not supported */</span>00069 cli_array_of_oid,00070 cli_array_of_bool, 00071 cli_array_of_int1, 00072 cli_array_of_int2,00073 cli_array_of_int4,00074 cli_array_of_int8,00075 cli_array_of_real4,00076 cli_array_of_real8,00077 cli_array_of_decimal, 00078 cli_array_of_string,00079 cli_any, <span class="comment">/* not supported */</span>00080 cli_datetime, <span class="comment">/* not supported */</span>00081 cli_autoincrement, 00082 cli_rectangle,<span class="comment">/* not supported */</span>00083 cli_unknown00084 };00085 00086 <span class="keyword">typedef</span> <span class="keywordtype">char</span> cli_bool_t;00087 <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">char</span> cli_int1_t;00088 <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">short</span> cli_int2_t;00089 <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">int</span> cli_int4_t;00090 <span class="keyword">typedef</span> <span class="keywordtype">float</span> cli_real4_t;00091 <span class="keyword">typedef</span> <span class="keywordtype">double</span> cli_real8_t;00092 00093 <span class="preprocessor">#if (defined(_WIN32) || defined(__BORLANDC__)) && !defined(__MINGW32__)</span>00094 <span class="preprocessor"></span><span class="keyword">typedef</span> __int64 cli_int8_t;00095 <span class="preprocessor">#else</span>00096 <span class="preprocessor"></span><span class="preprocessor">#if defined(__osf__ )</span>00097 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">long</span> cli_int8_t;00098 <span class="preprocessor">#else</span>00099 <span class="preprocessor"></span><span class="preprocessor">#if defined(__GNUC__) || defined(__SUNPRO_CC)</span>00100 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> cli_int8_t;00101 <span class="preprocessor">#else</span>00102 <span class="preprocessor"></span><span class="preprocessor">#error "integer 8 byte type is not defined" </span>00103 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00104 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00105 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00106 <span class="preprocessor"></span>00107 <span class="preprocessor">#ifndef CLI_OID_DEFINED</span>00108 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">long</span> cli_oid_t;00109 <span class="preprocessor">#endif</span>00110 <span class="preprocessor"></span>00111 <span class="comment">// structure used to represent array field in structure extracted by cli_execute_query</span>00112 <span class="keyword">typedef</span> <span class="keyword">struct </span>cli_array_t { 00113 size_t size; <span class="comment">// number of elements in the array</span>00114 <span class="keywordtype">void</span>* data; <span class="comment">// pointer to the array elements</span>00115 size_t allocated; <span class="comment">// internal field: size of allocated buffer </span>00116 } cli_array_t;00117 00118 <span class="comment">/*********************************************************************</span>00119 <span class="comment"> * cli_open</span>00120 <span class="comment"> * Establish connection with the server </span>00121 <span class="comment"> * Parameters:</span>00122 <span class="comment"> * server_url - zero terminated string with server address and port, </span>00123 <span class="comment"> * for example "localhost:5101", "195.239.208.240:6100",...</span>00124 <span class="comment"> * max_connect_attempts - number of attempts to establish connection</span>00125 <span class="comment"> * reconnect_timeout_sec - timeput in seconds between connection attempts</span>00126 <span class="comment"> * Returns:</span>00127 <span class="comment"> * >= 0 - connectiondescriptor to be used in all other cli calls</span>00128 <span class="comment"> * < 0 - error code as described in cli_result_code enum</span>00129 <span class="comment"> */</span>00130 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_open(<span class="keywordtype">char</span> <span class="keyword">const</span>* server_url, 00131 <span class="keywordtype">int</span> max_connect_attempts,00132 <span class="keywordtype">int</span> reconnect_timeout_sec);00133 00134 <span class="keyword">enum</span> cli_open_attributes { 00135 cli_open_default = 0x0, 00136 cli_open_readonly = 0x1, 00137 cli_open_truncate = 0x2,00138 cli_open_concurrent = 0x400139 };00140 <span class="comment">/*********************************************************************</span>00141 <span class="comment"> * cli_create</span>00142 <span class="comment"> * Create connection to the local database</span>00143 <span class="comment"> * Parameters:</span>00144 <span class="comment"> * databaseName - name of the database </span>00145 <span class="comment"> * fileName - path to the database file </span>00146 <span class="comment"> * transactionCommitDelay - trasnaction commit delay (specify 0 to disable)</span>00147 <span class="comment"> * openAttr - mask of cli_open_attributes</span>00148 <span class="comment"> * initDatabaseSize - initial size of the database</span>00149 <span class="comment"> * extensionQuantum - database extension quantum</span>00150 <span class="comment"> * initIndexSize - initial size of object index</span>00151 <span class="comment"> * fileSizeLimit - limit for file size (0 - unlimited)</span>00152 <span class="comment"> * Returns:</span>00153 <span class="comment"> * >= 0 - connection descriptor to be used in all other cli calls</span>00154 <span class="comment"> * < 0 - error code as described in cli_result_code enum</span>00155 <span class="comment"> */</span>00156 00157 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_create(<span class="keywordtype">char</span> <span class="keyword">const</span>* databaseName, 00158 <span class="keywordtype">char</span> <span class="keyword">const</span>* filePath, 00159 <span class="keywordtype">unsigned</span> transactionCommitDelay, 00160 <span class="keywordtype">int</span> openAttr, 00161 size_t initDatabaseSize,00162 size_t extensionQuantum,00163 size_t initIndexSize,00164 size_t fileSizeLimit);00165 00166 <span class="comment">/*********************************************************************</span>00167 <span class="comment"> * cli_create_replication_node</span>00168 <span class="comment"> * Create connection to the local database with support of replication</span>00169 <span class="comment"> * Parameters:</span>00170 <span class="comment"> * nodeId - node identifier: 0 <= nodeId < nServers</span>00171 <span class="comment"> * nServers - number of replication nodes (primary + standby)</span>00172 <span class="comment"> * nodeNames - array with URLs of the nodes (address:port)</span>00173 <span class="comment"> * databaseName - name of the database </span>00174 <span class="comment"> * fileName - path to the database file </span>00175 <span class="comment"> * transactionCommitDelay - trasnaction commit delay (specify 0 to disable)</span>00176 <span class="comment"> * openAttr - mask of cli_open_attributes (to allow concurrent read access to replication node, </span>00177 <span class="comment"> * cli_open_concurrent attribute should be set) </span>00178 <span class="comment"> * initDatabaseSize - initial size of the database</span>00179 <span class="comment"> * extensionQuantum - database extension quantum</span>00180 <span class="comment"> * initIndexSize - initial size of object index</span>00181 <span class="comment"> * fileSizeLimit - limit for file size (0 - unlimited)</span>00182 <span class="comment"> * Returns:</span>00183 <span class="comment"> * >= 0 - connection descriptor to be used in all other cli calls</span>00184 <span class="comment"> * < 0 - error code as described in cli_result_code enum</span>00185 <span class="comment"> */</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -