用dblibrary读取sybase数据库只能获取最多255个字节的数据吗
<p><span style="FONT-SIZE: 13px;">在linux AS3下装了个12.5的sybase(page size是8),c程序通过dblibrary库实现数据库的读写,但发现通过程序读取的数据最多只有255个字节(实际存储的远不止255),查看了资料没找出原因,望各位帮帮忙。<br/>测试代码如下:</span></p><span style="FONT-SIZE: 13px;"><div class="altbg2" id="code0" style="CLEAR: both; BORDER-RIGHT: #698cc3 1px solid; PADDING-RIGHT: 10px; BORDER-TOP: #698cc3 1px solid; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; MARGIN: 3px 2em 2em; BORDER-LEFT: #698cc3 1px solid; WORD-BREAK: break-all; PADDING-TOP: 5px; BORDER-BOTTOM: #698cc3 1px solid; FONT-FAMILY: fixedsys;">#include <stdio.h><br/>#include <sybfront.h><br/>#include <sybdb.h><br/><br/>int main(argc, argv)<br/>int argc;<br/>char *argv[];<br/>{<br/> DBPROCESS *dbproc; /* Our connection with SQL Server. */<br/> LOGINREC *login; /* Our login information. */<br/><br/> /* These are the variables used to store the returning data. */<br/> RETCODE result_code;<br/> DBCHAR name1;<br/> DBCHAR des;<br/><br/> /* Initialize DB-Library. */<br/> if (dbinit() == FAIL)<br/> exit(ERREXIT);<br/><br/> login = dblogin();<br/> DBSETLUSER(login, "sa");<br/> DBSETLPWD(login, "intelligence");<br/> if ((dbproc = dbopen(login, "CHECKSERVER")) == NULL)<br/> {<br/> printf("Could not connect to server!\n");<br/> return(-1);<br/> }<br/><br/> /* First, put the commands into the command buffer. */<br/> dbcmd(dbproc, "select name, des from checkdb..test_tb");<br/> dbcmd(dbproc, " where name = 'lijm' ");<br/><br/> /* Send the commands to SQL Server and start execution. */<br/> dbsqlexec(dbproc);<br/><br/> while ((result_code = dbresults(dbproc)) != NO_MORE_RESULTS)<br/> {<br/> if (result_code == SUCCEED)<br/> {<br/> /* Bind program variables. */<br/><br/> dbbind(dbproc, 1, NTBSTRINGBIND, (DBINT)0, <br/> (BYTE DBFAR *)name1);<br/> dbbind(dbproc, 2, NTBSTRINGBIND, (DBINT)0, <br/> (BYTE DBFAR *)des);<br/><br/> /* Now print the rows. */<br/> while (dbnextrow(dbproc) != NO_MORE_ROWS)<br/> {<br/> if ((DBCURCMD(dbproc) == 2)<br/> && (DBCURROW(dbproc) > 10))<br/> continue;<br/> printf("name: %s, description: %s",name1,des);<br/> }<br/> }<br/> }<br/><br/> dbexit();<br/> exit(STDEXIT);<br/>}</div></span> <font size="2">另外昨天在看《Open Client DB-Library C Reference Manual》时看到这句话:<br/>“DB-Library provides source code compatibility for older Sybase<br/>applications. Sybase encourages programmers to implement<br/>applications with Client-Library or Embedded SQL.”<br/>明显DB-Library是for旧版的Sybase,有没有可能DB-Library本身就只能支持select出最多255个字节的数据,而Client-Library就能支持更大的数据。</font>
页:
[1]