Im testing your GSTsqlite but I keep getting a crash in one of my functions "read_RESULTS()".

I made a very simple program just for testing and keep getting an error in this line:
"GSTsqlite_GetString(handleQUERY,"Pass",sTEMP);"
Dont know why because there is a similar line above it that seems to work fine.

This is my short script:
Code:
#include <acknex.h>
#include <default.c>
#include "GSTsqlite.h";

STRING* sDDBB = "test.db";
var handleDDBB;
void open_DDBB()
{
	handleDDBB = GSTsqlite_OpenDatabase(sDDBB);
}

STRING* sQUERY = "select * from mytable";
var handleQUERY;
void execute_QUERY()
{
	handleQUERY = GSTsqlite_ExecuteQuery(handleDDBB,sQUERY);
}

STRING* sRESULTS = "";
STRING* sTEMP = "";
void read_RESULTS()
{
	while(!GSTsqlite_EOF(handleQUERY))
	{
		GSTsqlite_GetString(handleQUERY,"Name",sTEMP);
		str_cat(sRESULTS,sTEMP);
		GSTsqlite_GetString(handleQUERY,"Pass",sTEMP);
		str_cat(sRESULTS,sTEMP);
		GSTsqlite_NextRow(handleQUERY);
	}
}


void close_QUERY()
{
	GSTsqlite_CloseQuery(handleQUERY);
}

void close_DDBB()
{
	GSTsqlite_CloseDatabase(handleDDBB);
}

void main ()
{
	open_DDBB();
	execute_QUERY();
	read_RESULTS();
	close_QUERY();
	close_DDBB();
}


For some reason the line above it that reads "Name" column seems to work, but the one that reads "Pass" column does not work.

the table is not empty and was created with a simple:
sqlite3 test.db
create table mytable(Name varchar(10), Pass varchar(10));
insert into mytable values('Carlos','Ale');
insert into mytable values('Alejandra','Car');


and after I did check it with:
select * from mytable
and got the correct results:
Carlos|Ale
Alejandra|Car

Any healp or insight/hints would be greatly appreciated ;D Im going crazy trying to understand why I get that error.

Error E1513
Crash in read_RESULTS : SYS

I think that is an error with a handle, but I dont understand why it works for the line above if they are the same ;_(

The handle becomes invalid between GSTsqlite_GetString(handleQUERY,"Name",sTEMP); and GSTsqlite_GetString(handleQUERY,"Pass",sTEMP); ? why?


EDIT: I tried putting the "Pass" line above the "Name" line and now pass works fine but Name gives the error... Im going crazy, I have no idea why a pointer would become invalid between those 2 lines?

Last edited by Carlos3DGS; 08/08/10 14:33.

"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1