varchar truncation to 255 symbols

  • Can you post the relavent C++ I just cannot picuture the code as I have not used these options before.

  • Hi, thanx for the reply!

    Table is created with statement:

    create table test_big_text (description varchar(2000))

    My C++ code goes like this:

    ...

    DBCOL dbcol;

    char *description;

    char *stmt = " select description from test_big_text; ";

    DBPROCESS *dbproc;

    LOGINREC *login;

    login = dblogin();

    DBSETLUSER (login, "login");

    DBSETLPWD (login, "password");

    DBSETLVERSION(login, DBVER60);

    dbproc = dbopen (login, "server");

    dbuse (dbproc, "database");

    dbcmd(dbproc, stmt);

    dbsqlexec(dbproc);

    dbcol.SizeOfStruct = sizeof(DBCOL);

    if (dbresults(dbproc) == SUCCEED && dbcolinfo(dbproc, CI_REGULAR, 1, 0, &dbcol) == SUCCEED) {

    description = (char*) malloc(dbcol.MaxLength);

    // dbcol.MaxLength is 255, should be 2000

    dbbind (dbproc, 1, NTBSTRINGBIND, 0, description);

    while (dbnextrow(dbproc) != NO_MORE_ROWS)

    printf ("%s\n", description);

    free(description);

    }

    dbexit();

    ...

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply