用dblibrary读取sybase数据库只能获取最多255个字节的数据?

在linux AS3下装了个12.5的sybase(page size是8),c程序通过dblibrary库实现数据库的读写,但发现通过程序读取的数据最多只有255个字节(实际存储的远不止255),查看了资料没找出原因,望各位帮帮忙。
测试代码如下:


CODE:[Copy to clipboard]#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);
}

作者: jianleon   发布时间: 2006-12-22

另外昨天在看《Open Client DB-Library C Reference Manual》时看到这句话:
“DB-Library provides source code compatibility for older Sybase
applications. Sybase encourages programmers to implement
applications with Client-Library or Embedded SQL.”
明显DB-Library是for旧版的Sybase,有没有可能DB-Library本身就只能支持select出最多255个字节的数据,而Client-Library就能支持更大的数据。

作者: jianleon   发布时间: 2006-12-22

自己能独立解决问题最好不过了,恭喜喽主。

作者: Jerry1126_Gao   发布时间: 2010-09-28