📄 cli_8h-source.html
字号:
00186 00187 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_create_replication_node(<span class="keywordtype">int</span> nodeId,00188 <span class="keywordtype">int</span> nServers,00189 <span class="keywordtype">char</span>* nodeNames[],00190 <span class="keywordtype">char</span> <span class="keyword">const</span>* databaseName, 00191 <span class="keywordtype">char</span> <span class="keyword">const</span>* filePath, 00192 <span class="keywordtype">int</span> openAttr, 00193 size_t initDatabaseSize,00194 size_t extensionQuantum,00195 size_t initIndexSize,00196 size_t fileSizeLimit);00197 00198 <span class="comment">/*********************************************************************</span>00199 <span class="comment"> * cli_close</span>00200 <span class="comment"> * Close session</span>00201 <span class="comment"> * Parameters:</span>00202 <span class="comment"> * session - session descriptor returned by cli_open</span>00203 <span class="comment"> * Returns:</span>00204 <span class="comment"> * result code as described in cli_result_code enum</span>00205 <span class="comment"> */</span>00206 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_close(<span class="keywordtype">int</span> session);00207 00208 <span class="comment">/*********************************************************************</span>00209 <span class="comment"> * cli_statement</span>00210 <span class="comment"> * Specify SubSQL statement to be executed at server</span>00211 <span class="comment"> * Binding to the parameters and columns can be established </span>00212 <span class="comment"> * Parameters:</span>00213 <span class="comment"> * session - session descriptor returned by cli_open</span>00214 <span class="comment"> * stmt - zero terminated string with SubSQL statement </span>00215 <span class="comment"> * Returns:</span>00216 <span class="comment"> * >= 0 - statement descriptor</span>00217 <span class="comment"> * < 0 - error code as described in cli_result_code enum</span>00218 <span class="comment"> */</span>00219 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_statement(<span class="keywordtype">int</span> session, <span class="keywordtype">char</span> <span class="keyword">const</span>* stmt);00220 00221 <span class="comment">/*********************************************************************</span>00222 <span class="comment"> * cli_parameter</span>00223 <span class="comment"> * Bind parameter to the statement</span>00224 <span class="comment"> * Parameters:</span>00225 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00226 <span class="comment"> * param_name - zero terminated string with parameter name </span>00227 <span class="comment"> * Paramter name should start with '%'</span>00228 <span class="comment"> * var_type - type of variable as described in cli_var_type enum.</span>00229 <span class="comment"> * Only scalar and zero terminated string types are supported.</span>00230 <span class="comment"> * var_ptr - pointer to the variable</span>00231 <span class="comment"> * Returns:</span>00232 <span class="comment"> * result code as described in cli_result_code enum</span>00233 <span class="comment"> */</span>00234 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_parameter(<span class="keywordtype">int</span> statement,00235 <span class="keywordtype">char</span> <span class="keyword">const</span>* param_name, 00236 <span class="keywordtype">int</span> var_type,00237 <span class="keywordtype">void</span>* var_ptr);00238 00239 <span class="comment">/*********************************************************************</span>00240 <span class="comment"> * cli_column</span>00241 <span class="comment"> * Bind extracted column of select or insert statement</span>00242 <span class="comment"> * Parameters:</span>00243 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00244 <span class="comment"> * column_name - zero terminated string with column name </span>00245 <span class="comment"> * var_type - type of variable as described in cli_var_type enum</span>00246 <span class="comment"> * var_len - pointer to the variable to hold length of array variable.</span>00247 <span class="comment"> * This variable should be assigned the maximal length</span>00248 <span class="comment"> * of the array/string buffer, pointed by var_ptr.</span>00249 <span class="comment"> * After the execution of the statement it is assigned the </span>00250 <span class="comment"> * real length of the fetched array/string. If it is large </span>00251 <span class="comment"> * than length of the buffer, then only part of the array</span>00252 <span class="comment"> * will be placed in the buffer, but var_len still will </span>00253 <span class="comment"> * contain the actual array length. </span>00254 <span class="comment"> * var_ptr - pointer to the variable</span>00255 <span class="comment"> * Returns:</span>00256 <span class="comment"> * result code as described in cli_result_code enum</span>00257 <span class="comment"> */</span>00258 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_column(<span class="keywordtype">int</span> statement,00259 <span class="keywordtype">char</span> <span class="keyword">const</span>* column_name, 00260 <span class="keywordtype">int</span> var_type, 00261 <span class="keywordtype">int</span>* var_len, 00262 <span class="keywordtype">void</span>* var_ptr);00263 00264 00265 <span class="keyword">typedef</span> <span class="keywordtype">void</span>* (*cli_column_set)(<span class="keywordtype">int</span> var_type, <span class="keywordtype">void</span>* var_ptr, <span class="keywordtype">int</span> len);00266 <span class="keyword">typedef</span> <span class="keywordtype">void</span>* (*cli_column_get)(<span class="keywordtype">int</span> var_type, <span class="keywordtype">void</span>* var_ptr, <span class="keywordtype">int</span>* len);00267 00268 <span class="keyword">typedef</span> <span class="keywordtype">void</span>* (*cli_column_set_ex)(<span class="keywordtype">int</span> var_type, <span class="keywordtype">void</span>* var_ptr, <span class="keywordtype">int</span> len, 00269 <span class="keywordtype">char</span> <span class="keyword">const</span>* column_name, <span class="keywordtype">int</span> statement, <span class="keywordtype">void</span> <span class="keyword">const</span>* data_ptr);00270 <span class="keyword">typedef</span> <span class="keywordtype">void</span>* (*cli_column_get_ex)(<span class="keywordtype">int</span> var_type, <span class="keywordtype">void</span>* var_ptr, <span class="keywordtype">int</span>* len, 00271 <span class="keywordtype">char</span> <span class="keyword">const</span>* column_name, <span class="keywordtype">int</span> statemen);00272 00273 <span class="comment">/*********************************************************************</span>00274 <span class="comment"> * cli_array_column</span>00275 <span class="comment"> * Specify get/set functions for the array column</span>00276 <span class="comment"> * Parameters:</span>00277 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00278 <span class="comment"> * column_name - zero terminated string with column name </span>00279 <span class="comment"> * var_type - type of variable as described in cli_var_type enum</span>00280 <span class="comment"> * var_ptr - pointer to the variable</span>00281 <span class="comment"> * set - function which will be called to construct fetched </span>00282 <span class="comment"> * field. It receives pointer to the variable, </span>00283 <span class="comment"> * length of the fetched array and returns pointer to th </span>00284 <span class="comment"> * array's elements</span>00285 <span class="comment"> * get - function which will be called to update the field in the </span>00286 <span class="comment"> * database. Given pointer to the variable, it should return </span>00287 <span class="comment"> * pointer to the array elements and store length of the</span>00288 <span class="comment"> * array to the variable pointer by len parameter</span>00289 <span class="comment"> * Returns:</span>00290 <span class="comment"> * result code as described in cli_result_code enum</span>00291 <span class="comment"> */</span>00292 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_array_column(<span class="keywordtype">int</span> statement,00293 <span class="keywordtype">char</span> <span class="keyword">const</span>* column_name, 00294 <span class="keywordtype">int</span> var_type,00295 <span class="keywordtype">void</span>* var_ptr,00296 cli_column_set set,00297 cli_column_get get);00298 00299 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_array_column_ex(<span class="keywordtype">int</span> statement,00300 <span class="keywordtype">char</span> <span class="keyword">const</span>* column_name, 00301 <span class="keywordtype">int</span> var_type,00302 <span class="keywordtype">void</span>* var_ptr,00303 cli_column_set_ex set,00304 cli_column_get_ex get);00305 00306 <span class="keyword">enum</span> { 00307 cli_view_only, 00308 cli_for_update00309 };00310 00311 <span class="comment">/*********************************************************************</span>00312 <span class="comment"> * cli_fetch</span>00313 <span class="comment"> * Execute select statement.</span>00314 <span class="comment"> * Parameters:</span>00315 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00316 <span class="comment"> * for_update - not zero if fetched rows will be updated </span>00317 <span class="comment"> * Returns:</span>00318 <span class="comment"> * >= 0 - success, for select statements number of fetched rows is returned</span>00319 <span class="comment"> * < 0 - error code as described in cli_result_code enum</span>00320 <span class="comment"> */</span>00321 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_fetch(<span class="keywordtype">int</span> statement, <span class="keywordtype">int</span> for_update);00322 00323 <span class="comment">/*********************************************************************</span>00324 <span class="comment"> * cli_insert</span>00325 <span class="comment"> * Execute insert statement.</span>00326 <span class="comment"> * Parameters:</span>00327 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00328 <span class="comment"> * oid - object identifier of created record. </span>00329 <span class="comment"> * Returns:</span>00330 <span class="comment"> * status code as described in cli_result_code enum</span>00331 <span class="comment"> */</span>00332 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_insert(<span class="keywordtype">int</span> statement, cli_oid_t* oid);00333 00334 <span class="comment">/*********************************************************************</span>00335 <span class="comment"> * cli_get_first</span>00336 <span class="comment"> * Get first row of the selection.</span>00337 <span class="comment"> * Parameters:</span>00338 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00339 <span class="comment"> * Returns:</span>00340 <span class="comment"> * result code as described in cli_result_code enum</span>00341 <span class="comment"> */</span>00342 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_get_first(<span class="keywordtype">int</span> statement);00343 00344 <span class="comment">/*********************************************************************</span>00345 <span class="comment"> * cli_get_last</span>00346 <span class="comment"> * Get last row of the selection.</span>00347 <span class="comment"> * Parameters:</span>00348 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00349 <span class="comment"> * Returns:</span>00350 <span class="comment"> * result code as described in cli_result_code enum</span>00351 <span class="comment"> */</span>00352 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_get_last(<span class="keywordtype">int</span> statement);00353 00354 <span class="comment">/*********************************************************************</span>00355 <span class="comment"> * cli_get_next</span>00356 <span class="comment"> * Get next row of the selection. If get_next records is called</span>00357 <span class="comment"> * exactly after cli_fetch function call, is will fetch the first record</span>00358 <span class="comment"> * in selection.</span>00359 <span class="comment"> * Parameters:</span>00360 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00361 <span class="comment"> * Returns:</span>00362 <span class="comment"> * result code as described in cli_result_code enum</span>00363 <span class="comment"> */</span>00364 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_get_next(<span class="keywordtype">int</span> statement);00365 00366 <span class="comment">/*********************************************************************</span>00367 <span class="comment"> * cli_get_prev</span>00368 <span class="comment"> * Get previous row of the selection. If get_next records is called</span>00369 <span class="comment"> * exactly after cli_fetch function call, is will fetch the last record</span>00370 <span class="comment"> * in selection.</span>00371 <span class="comment"> * Parameters:</span>00372 <span class="comment"> * statement - statememt descriptor returned by cli_statement</span>00373 <span class="comment"> * Returns:</span>00374 <span class="comment"> * result code as described in cli_result_code enum</span>00375 <span class="comment"> */</span>00376 <span class="keywordtype">int</span> FASTDB_DLL_ENTRY cli_get_prev(<span class="keywordtype">int</span> statement);00377
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -