About Store Forum Documentation Contact



Post Reply 
SQL(lite) getCol issue
Author Message
AndrewBGS Offline
Member

Post: #1
SQL(lite) getCol issue
I'm just trying to get some values from the database, I can't figure out what I am doing wrong; here is the code:

int q1;
SQL Sql;
Sql.connectSQLite("storage.dat");
Sql.getRows("recepies", S+"category='"+category+ "'");
while(Sql.getNextRow())
Sql.getCol(0, q1); ...

The row Sql.getCol(0, q1) apparently causes the run-time error:
Memp.setNum does not support PTR mode

I have no idea what that should tell me. Has anyone else encountered this, or knows what this is supposed to mean/ what I'm doing wrong?
01-21-2014 10:31 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #2
RE: SQL(lite) getCol issue
no reason for Sql.getCol(0, q1) to return that error. Other than that, does it debug correctly, connects to the database and catches the rows?

IF Sql.getCol(0, q1); does actually return that strange error, it must be within the function, Esenthels function. As you are doing nothing wrong.
01-22-2014 02:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: SQL(lite) getCol issue
There are multiple functions with the same name:
Bool getCol(Int i, Int &value ); // get i-th column data as 'value', false on fail
and
Bool getCol(Int i, Memp<Byte> value ); // get i-th column data as 'value', false on fail

looks like for some reason the 2nd one is getting called, while the 1st one should.
Are you sure that 'q1' is actually an 'int'?

Hmm..
I wonder if the Memp constructor from int somehow gets triggered:
Memp( int ); // this simulates initializing from NULL

Can you tell me what platform are you using? and what compiler? (VS 2008/2010/etc)
01-22-2014 07:21 AM
Find all posts by this user Quote this message in a reply
AndrewBGS Offline
Member

Post: #4
RE: SQL(lite) getCol issue
Indeed the declaration of q1 was the problem. It wasn't actually int, it was short (I'm a freak for optimisation), and that did the trick.

//In case it matters, I'm on Windows 7, VS 2012.

I would have liked to save 16 bits of data per value, but I'm happy its working. I'm sorry I didn't think of this myself, I thought int and short are always treated the same.
01-22-2014 08:14 AM
Find all posts by this user Quote this message in a reply
Post Reply