Flutterby
Joined: 01 May 2012 Posts: 11
|
Posted: Sun Nov 04, 2012 18:42 Post subject: ODBC2 - SQLFetch() problem |
|
|
Hey there,
I'm trying to rewrite my module to use a SQLite database instead of the big ugly behemoths Bioware provided, and I'm running into some trouble.
It looks like SQLFetch() always returns 0, even if the query I ran before running SQLFetch returned a value. I tested this by running the same query in my SQLite editor.
As an example, I have a table called DB_PERMADEAD which was created with the following query:
Code: | CREATE TABLE DB_PERMADEAD (
player varchar(64) NOT NULL default '~',
tag varchar(64) NOT NULL default '~',
name varchar(64) NOT NULL default '~',
val text,
expire int(11) default NULL,
last timestamp NOT NULL default current_timestamp,
PRIMARY KEY (player,tag,name)
) |
In this table is an entry for player TESTGSID, tag TestName, name bPermDead, val 1, expire 0 and last current_timestamp.
If I run the following query:
Code: | SELECT name FROM DB_PERMADEAD WHERE player='TESTGSID' | in my SQLite Control Center, it returns a row with name = bPermDead.
However, when I run this through nwscript as follows:
Code: | string sSQL = "SELECT name FROM " + "DB_PERMADEAD" + " WHERE player='" + "TESTGSID" + "'";
PrintString(sSQL);
SQLExecDirect(sSQL);
int iFetch = SQLFetch();
PrintString("iFetch = "+IntToString(iFetch)); |
I get the following log entries:
- in nwnx_odbc.txt:
Code: | o Got request: SELECT name FROM DB_PERMADEAD WHERE player='TESTGSID'
o Got request: SELECT val FROM DB_PERMADEAD WHERE player='TESTGSID' AND tag='TestName' AND name='bPermDead' |
- and in nwserverlog1.txt:
Code: | SELECT name FROM DB_PERMADEAD WHERE player='TESTGSID'
iFetch = 0 |
Any idea what could be going on? I'm using Windows 7 64bit, with the most recent ODBC2 library. |
|