var vhndDB;
STRING* dbQuery ;
var vhndQuery;

var dbrows = 0;
OBJDataBase objdatabank[1000000];

void open_db()
{
	 vhndDB = GSTsqlite_OpenDatabase("OBJDB.sqlite"); 
	 if(vhndDB == 0){error("DB not Found!");}
 }
 
 
 void read_db()
 {
 	dbQuery = str_create("Select * from mapobjdb");
	vhndQuery = GSTsqlite_ExecuteQuery(vhndDB, dbQuery);
	while(!GSTsqlite_EOF(vhndQuery))
	{
		GSTsqlite_GetInteger(vhndQuery,"Type",objdatabank[dbrows].obj_type);
		GSTsqlite_GetInteger(vhndQuery,"obj_id",objdatabank[dbrows].obj_id);
		GSTsqlite_GetString(vhndQuery,"obj_file_name",objdatabank[dbrows].obj_file_name);
		if (!GSTsqlite_NextRow(vhndQuery)) {break;} 
		dbrows +=1;
	}

	 GSTsqlite_CloseQuery(vhndQuery);
 }