[freetds] dbsqlok hangs following a dbwritetext()

Navdeep Shergill jatshergill at gmail.com
Mon Feb 5 23:33:44 EST 2007


Hi all
        I am using FreeTDS v0.64. I am running in on a windows machine,
while connecting to a SQL2000 server. Basically; I am trying to upload a
file to the database. The field in the table is type 'image'. I am following
the code listed in the unittest: t0013.c. I have found that my program is
hanging on the 'dbsqlok' command following a 'dbwritetext()'. Here is
relevant code; from the unit test.

=====================
    sprintf(cmd, "insert into test_attachment(test_id,name,title,content)
values (10019,'test','testing file', '')");
    fprintf(stdout, "%s\n", cmd);
    dbcmd(dbproc, cmd);
    dbsqlexec(dbproc);
    while (dbresults(dbproc) != NO_MORE_RESULTS) {
        /* nop */
    }

    sprintf(sqlCmd, "select content FROM test_attachment WHERE test_id =
10019");
    dbcmd(dbproc, sqlCmd);
    dbsqlexec(dbproc);
    if (dbresults(dbproc) != SUCCEED) {
        fprintf(stderr, "Error inserting blob\n");
        return 4;
    }

    while ((result = dbnextrow(dbproc)) != NO_MORE_ROWS) {
        result = REG_ROW;
        result = DBTXPLEN;
        strcpy(objname, "test_attachment.content");
        textPtr = dbtxptr(dbproc, 1);
        timeStamp = dbtxtimestamp(dbproc, 1);
    }

    if (dbwritetext(dbproc, objname, textPtr, DBTXPLEN, timeStamp, FALSE,
123435, NULL) != SUCCEED)
        return 15;
    dbsqlok(dbproc);
    dbresults(dbproc);
================================================

So it is hanging on the last 'dbsqlok'.

Does anyone have the same experience? Can you issue a pointer to me?

Thanks!


More information about the FreeTDS mailing list