为测试mysql连接数,用
ODBC录制了脚本,把碰到的函数总结下,具体参数还是查Function Reference
lrd_init(&InitInfo, DBTypeVersion);
//Initializes the LRD environment//InitInfo等全局变量可在脚本文件夹\vdf.h中找到,vdf.h由globals.h includelrd_open_context(&
Ctx2, LRD_DBTYPE_ODBC, 0, 0, 0);
//Opens a context (CtLib and ODBC).lrd_alloc_connection(&
Con2, LRD_DBTYPE_ODBC,
Ctx2, 0 /*Unused*/, 0);
//Allocates a connection structurelrd_db_option(
Con2, OT_ODBC_LOGIN_TIMEOUT, (void FAR const *)15, 0);
//sets anoptionfor a database
cursor, context, or connectionlrd_open_connection(&
Con2, LRD_DBTYPE_ODBC, "", lr_decrypt("4a2df8f3e"), "", lr_decrypt("4a2df8f3d4bcce582f493dfe12619f57ab6d8912752ac5f4"
"d5e073aa5f317b105133aae807f31582aea45a94e45ac596edcf10d09f1c"
"81e4d82d9c5c1bc6ede47c4858e8949df1eeb20bbf6ebeda16bdca57b338"
"88381a4a56e7e4c0fba83cd41262dbd6b5b1bff42b25de744857210136ac"),
Ctx2, 1, 0);
lrd_open_cursor(&Csr1,
Con2, 0);
lrd_db_option(Csr1, OT_ODBC_SS_HIDDEN_COLUMNS, "ON", 0);
lrd_db_option(Csr1, OT_ODBC_QUERY_TIMEOUT, (void FAR const *)30, 0);
//open..lrd_stmt(Csr1, "SELECT * FROM USER", -1, 1, 0 /*None*/, 0);
//Sets an SQL statement to be processed, associates a character string (usually a SQL statement) with a cursorlrd_db_option(Csr1, OT_ODBC_RETRIEVE_DATA, "OFF", 0);
lrd_db_option(Csr1, OT_ODBC_RETRIEVE_DATA, "ON", 0);
lrd_bind_cols(Csr1, BCInfo_D6, 0);
/*Binds a host variable array to columns. A host variable is automatically generated by VuGen. Thelrd_bind_colsfunction binds a host variable to an output column.*/lrd_fetchx(Csr1, -231, 1, 0, PrintRow2, 1, 0);
GRID(2);
-------------------------------- <--result Set
--------------------------------
//Fetches the next row in the result set.(ODBC only)//待研究lrd_db_option(Csr1, OT_ODBC_CURSOR_UNBOUNDCOLS, 0, 0);
lrd_result_set(Csr1, 0, 0, 0);
//Prepares the next result set.lrd_db_option(Csr1, OT_ODBC_CURSOR_CLOSE, 0, 0);
lrd_close_cursor(&Csr1, 0);
lrd_close_connection(&
Con2, 0, 0);
lrd_free_connection(&
Con2, 0 /*Unused*/, 0);