马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
在linux AS3下装了个12.5的sybase(page size是8),c程序通过dblibrary库实现数据库的读写,但发现通过程序读取的数据最多只有255个字节(实际存储的远不止255),查看了资料没找出原因,望各位帮帮忙。 测试代码如下: #include <stdio.h> #include <sybfront.h> #include <sybdb.h>
int main(argc, argv) int argc; char *argv[]; { DBPROCESS *dbproc; /* Our connection with SQL Server. */ LOGINREC *login; /* Our login information. */
/* These are the variables used to store the returning data. */ RETCODE result_code; DBCHAR name1[128]; DBCHAR des[3000];
/* Initialize DB-Library. */ if (dbinit() == FAIL) exit(ERREXIT);
login = dblogin(); DBSETLUSER(login, "sa"); DBSETLPWD(login, "intelligence"); if ((dbproc = dbopen(login, "CHECKSERVER")) == NULL) { printf("Could not connect to server!\n"); return(-1); }
/* First, put the commands into the command buffer. */ dbcmd(dbproc, "select name, des from checkdb..test_tb"); dbcmd(dbproc, " where name = 'lijm' ");
/* Send the commands to SQL Server and start execution. */ dbsqlexec(dbproc);
while ((result_code = dbresults(dbproc)) != NO_MORE_RESULTS) { if (result_code == SUCCEED) { /* Bind program variables. */
dbbind(dbproc, 1, NTBSTRINGBIND, (DBINT)0, (BYTE DBFAR *)name1); dbbind(dbproc, 2, NTBSTRINGBIND, (DBINT)0, (BYTE DBFAR *)des);
/* Now print the rows. */ while (dbnextrow(dbproc) != NO_MORE_ROWS) { if ((DBCURCMD(dbproc) == 2) && (DBCURROW(dbproc) > 10)) continue; printf("name: %s, description: %s",name1,des); } } }
dbexit(); exit(STDEXIT); } |