|
|
Choosing A Webhost: |
RE: Need Help on dblib program: msg#00068db.tds.freetds
> From: Steven J. Backus [mailto:backus@xxxxxxxxxxxxx] > Sent: July 30, 2003 1:55 PM > > I'm having problems with a dblib program and hope you can help, > I've tried to simplify it as much as i can. I'm using sybase 12.0 > and freetds 0.61. It works fine with the sybase libraries so I think > freetds is walking on some variable, or I'm declaring something > incorrectly. Works for me, Steven. I looked it over pretty closely. The only oddity I saw was that dage should probably be declared as DBREAL; depending on your architecture, that might matter. I didn't see any viruses ;-), so I compiled and ran it. I got "I64", too. One difference: I'm using current CVS. I don't know of any bug we've fixed related to this since the release, but I'm not running the very same binaries you are. Any chance you're compiling with Sybase's headers and FreeTDS's libraries? That would yield unpredictable results, if it worked. BTW, is sqsh linked to FreeTDS, or Sybase's libraries? Just curious. Regards, --jkl > Here's the table definition: > > create table table1 > (id int null, > aid int null, > did int null, > bmonth int null, > bday int null, > byear int null, > dmonth int null, > dday int null, > dyear int null, > dage float null, > gender varchar(1) null, > orderinlist int null, > i1 varchar(4) null, > i2 varchar(4) null, > i3 varchar(4) null, > i4 varchar(4) null, > i5 varchar(4) null, > family varchar(1) null) > > Here's my program: > > #include <unistd.h> > #include <stdio.h> > #include <stdlib.h> > #include <sybfront.h> > #include <sybdb.h> > #include <syberror.h> > > int err_handler(); > int msg_handler(); > > FILE *ERR_CH; > > main(int argc, char** argv) { > DBPROCESS *dbproc; > LOGINREC *login; > DBCHAR i1[5], i2[5], i3[5], i4[5], i5[5], family; > DBINT id, did, dmonth, dday, dyear, order; > float dage; > > if ((ERR_CH = fopen("Test.Err", "w")) == NULL) { > perror("Test.Err"); > exit(1); > } > > dberrhandle(err_handler); > dbmsghandle(msg_handler); > putenv("SYBASE=/usr/local/freetds"); > > if (dbinit() == FAIL) { > fprintf(stderr, "Database failure\n"); > exit(1); > } > > login = dblogin(); > DBSETLUSER(login, "backus"); > DBSETLPWD(login, "maddog12"); > dbproc = dbopen(login, NULL); > > dbcmd(dbproc, "select id, did, dmonth, dday, dyear, "); > dbcmd(dbproc, "dage, orderinlist, i1, i2, i3, i4, i5, "); > dbcmd(dbproc, "family from table1 order by id "); > dbsqlexec(dbproc); > dbsqlexec(dbproc); > if(dbresults(dbproc) == SUCCEED) { > dbbind(dbproc, 1, INTBIND, (DBINT)0, (BYTE*) &id); > dbbind(dbproc, 2, INTBIND, (DBINT)0, (BYTE*) &did); > dbbind(dbproc, 3, INTBIND, (DBINT)0, (BYTE*) &dmonth); > dbbind(dbproc, 4, INTBIND, (DBINT)0, (BYTE*) &dday); > dbbind(dbproc, 5, INTBIND, (DBINT)0, (BYTE*) &dyear); > dbbind(dbproc, 6, REALBIND, (DBINT)0, (BYTE*) &dage); > dbbind(dbproc, 7, INTBIND, (DBINT)0, (BYTE*) &order); > dbbind(dbproc, 8, STRINGBIND, (DBINT)0, (BYTE*) i1); > dbbind(dbproc, 9, STRINGBIND, (DBINT)0, (BYTE*) i2); > dbbind(dbproc, 10, STRINGBIND, (DBINT)0, (BYTE*) i3); > dbbind(dbproc, 11, STRINGBIND, (DBINT)0, (BYTE*) i4); > dbbind(dbproc, 12, STRINGBIND, (DBINT)0, (BYTE*) i5); > dbbind(dbproc, 13, CHARBIND, (DBINT)0, (BYTE*) &family); > } > while(dbnextrow(dbproc) != NO_MORE_ROWS) > printf("%s\n", i5); > } > > Here's the insert statement I use: > > insert into table1 (id, aid, did, bmonth, bday, byear, dmonth, > dday, dyear, dage, gender, orderinlist, i1, i2, i3, i4, i5, family) > values (176936, 30256045, 300004, 10, 10, 1824, 2, 5, 1904, 79, > 'M', 1, NULL, NULL, NULL, NULL, 'I64', 'Y'); > > In sqsh I do: > > select i5 from table1; > > i5 > ---- > I64 > > But the program prints nothing. ----------------------------------------- The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | More on dblib program, Steven J. Backus |
|---|---|
| Next by Date: | RE: Need Help on dblib program, Steven J. Backus |
| Previous by Thread: | Need Help on dblib program, Steven J. Backus |
| Next by Thread: | RE: Need Help on dblib program, Steven J. Backus |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |