freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Patrick Muldoon" <doon AT inoc.net>
- To: freetds AT franklin.oit.unc.edu
- Subject: C Library Question
- Date: Thu, 2 Aug 2001 16:30:22 -0400
Hello,
I am trying to extend proftp's mod_sql to talk to a ms sql server 2000
machine using freetds. I have gotten the latest snapshot installed set up
my freetds.conf file. I get errors with unknown markers even though the
the versions are all set to 7.
I have worked around the the uknown token error (a quick comment in
token.c) but when I try to use the firstapp.c (from the OpenClient
documentation) with modifications to read from our db, I get the following
error
Attempting to convert unknown source type 0
the Table with our data has the following properties
username varchar(32)
password varchar(16)
I was going to use CS_VARCHAR_TYPE for the datafmt and CS_VARCHAR for the
c format, but it seems in freetds, there is no CS_VARCHAR. SO I used
CS_CHAR_TYPE and CS_CHAR. The sql statement I use is "select username,
password from INOC.dbo.tbl_users". ANd I get the following result,
doon
Attempting to convert unknown source type 0
jim
Attempting to convert unknown source type 0
rick
Attempting to convert unknown source type 0
robert
This should be something like doon password etc...
If I change the order of the select , ie select password, user then it
displays the password and the error message
Below is the code I am using.
columns[0].datatype = CS_CHAR_TYPE;
columns[0].format = CS_FMT_NULLTERM;
columns[0].maxlength = MAXSTRING;
columns[0].count = 1;
columns[0].locale = NULL;
fprintf(OUT_CH,"Binding Column 1\n");
ret = ct_bind(cmd, 1, &columns[0], name,
&datalength[0],
&indicator[0]);
EXIT_ON_FAIL(context, ret,
"ct_bind() for username failed");
fprintf(OUT_CH,"Bound\n");
/*
** Same thing for the 'password' column.
*/
columns[1].datatype = CS_CHAR_TYPE;
columns[1].format = CS_FMT_NULLTERM;
columns[1].maxlength = MAXSTRING;
columns[1].count = 1;
columns[1].locale = NULL;
fprintf(OUT_CH,"Binding Column 2\n");
ret = ct_bind(cmd, 2, &columns[1], password,
&datalength[1],
&indicator[1]);
fprintf(OUT_CH,"Bound\n");
EXIT_ON_FAIL(context, ret,
"ct_bind() for password failed");
Is there any place on line I can go for more examples of how to do this.
Thanks,
Patrick
- C Library Question, Patrick Muldoon, 08/02/2001
Archive powered by MHonArc 2.6.24.