Skip to Content.
Sympa Menu

freetds - [freetds] strange dbconvert

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: kris AT bobbl.be
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] strange dbconvert
  • Date: Fri, 16 Mar 2007 11:30:47 +0100 (CET)

Hi,

I am using dblib from the current freetds on a sqlserver 2k from a os x
machine.

Here is my debug code.

#include <sqlfront.h>
#include <sqldb.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <unistd.h>

int main (int argc, char * const argv[]) {
DBPROCESS *dbproc;
LOGINREC *login = dblogin();
dbinit();
DBSETLPWD(login, "blabla");
DBSETLUSER(login, "kris");
DBSETLAPP(login, "blabla");
if(!(dbproc = dbopen(login, "some_server:1434"))) return 1;
if(dbuse(dbproc, "some_db") != SUCCEED) return 1;
if(dbcmd(dbproc, "SELECT a_char from a_table where (unique_key = '1'
or
unique_key = '2')") != SUCCEED) return 1;
if(dbsqlexec(dbproc) == FAIL) return 1;
if(dbsqlok(dbproc) == FAIL) return 1;
if(dbresults(dbproc) == SUCCEED) printf("%i\n", dbnumcols(dbproc));
char put[100];
int len;
while(dbnextrow(dbproc) != NO_MORE_ROWS){
len = dbconvert(dbproc, (dbcoltype(dbproc, 1)),
(dbdata(dbproc, 1)),
(dbdatlen(dbproc, 1)), SYBVARCHAR, (BYTE *) put, 99);
if(len == FAIL || len == -1) return 1;
printf("-> %s <-\n", put);
}
dbloginfree(login);
dbexit();
if(dbproc) dbclose(dbproc);
return 0;
}

this results in :

[Session started at 2007-03-16 11:17:30 +0100.]
1
-> <-
-> T <-

freetds has exited with status 0.

When i copy, paste and execute this query in query analyser it returns :

T
T

which is indeed in the database.
This field is a char of one long.
Anybody seen that error before ? Since I expected to see -> T <- twice.
It is always the same entry (i changed the order, and used other keys)

Thanks a lot,

Kris







Archive powered by MHonArc 2.6.24.

Top of Page