#include <database.mod/sqlite.mod/.bmx/sqlite.bmx.release.win32.x86.h>
struct BBString_1{BBClass_String* clas;BBULONG hash;int length;BBChar buf[1];};
struct BBString_39{BBClass_String* clas;BBULONG hash;int length;BBChar buf[39];};
struct BBString_41{BBClass_String* clas;BBULONG hash;int length;BBChar buf[41];};
struct BBString_42{BBClass_String* clas;BBULONG hash;int length;BBChar buf[42];};
struct BBString_3{BBClass_String* clas;BBULONG hash;int length;BBChar buf[3];};
struct BBString_17{BBClass_String* clas;BBULONG hash;int length;BBChar buf[17];};
struct BBString_33{BBClass_String* clas;BBULONG hash;int length;BBChar buf[33];};
struct BBString_24{BBClass_String* clas;BBULONG hash;int length;BBChar buf[24];};
struct BBString_36{BBClass_String* clas;BBULONG hash;int length;BBChar buf[36];};
struct BBString_20{BBClass_String* clas;BBULONG hash;int length;BBChar buf[20];};
struct BBString_18{BBClass_String* clas;BBULONG hash;int length;BBChar buf[18];};
struct BBString_35{BBClass_String* clas;BBULONG hash;int length;BBChar buf[35];};
struct BBString_28{BBClass_String* clas;BBULONG hash;int length;BBChar buf[28];};
struct BBString_6{BBClass_String* clas;BBULONG hash;int length;BBChar buf[6];};
struct BBString_25{BBClass_String* clas;BBULONG hash;int length;BBChar buf[25];};
struct BBString_19{BBClass_String* clas;BBULONG hash;int length;BBChar buf[19];};
struct BBString_22{BBClass_String* clas;BBULONG hash;int length;BBChar buf[22];};
struct BBString_30{BBClass_String* clas;BBULONG hash;int length;BBChar buf[30];};
struct BBString_26{BBClass_String* clas;BBULONG hash;int length;BBChar buf[26];};
struct BBString_32{BBClass_String* clas;BBULONG hash;int length;BBChar buf[32];};
struct BBString_118{BBClass_String* clas;BBULONG hash;int length;BBChar buf[118];};
struct BBString_63{BBClass_String* clas;BBULONG hash;int length;BBChar buf[63];};
struct BBString_29{BBClass_String* clas;BBULONG hash;int length;BBChar buf[29];};
struct BBString_27{BBClass_String* clas;BBULONG hash;int length;BBChar buf[27];};
struct BBString_38{BBClass_String* clas;BBULONG hash;int length;BBChar buf[38];};
struct BBString_4{BBClass_String* clas;BBULONG hash;int length;BBChar buf[4];};
struct BBString_5{BBClass_String* clas;BBULONG hash;int length;BBChar buf[5];};
struct BBString_7{BBClass_String* clas;BBULONG hash;int length;BBChar buf[7];};
static struct BBString_1 _s8={
	&bbStringClass,
	0xe7661a0566dadf97,
	1,
	{39}
};
static struct BBString_39 _s32={
	&bbStringClass,
	0x31f43c1985c25af8,
	39,
	{40,73,110,116,101,114,110,97,108,32,79,110,108,121,41,32,68
	,97,116,97,98,97,115,101,32,116,97,98,108,101,32,105,115
	,32,101,109,112,116,121}
};
static struct BBString_41 _s28={
	&bbStringClass,
	0xafd84f3b49756666,
	41,
	{40,73,110,116,101,114,110,97,108,32,79,110,108,121,41,32,84
	,97,98,108,101,32,79,114,32,114,101,99,111,114,100,32,78
	,111,116,32,102,111,117,110,100}
};
static struct BBString_1 _s6={
	&bbStringClass,
	0xfe96ecb3812f838,
	1,
	{41}
};
static struct BBString_1 _s54={
	&bbStringClass,
	0x747f69c2b26145,
	1,
	{46}
};
static struct BBString_42 _s40={
	&bbStringClass,
	0xf8372b0e0c2e0268,
	42,
	{50,110,100,32,112,97,114,97,109,101,116,101,114,32,116,111,32
	,115,113,108,105,116,101,51,95,98,105,110,100,32,111,117,116
	,32,111,102,32,114,97,110,103,101}
};
static struct BBString_3 _s9={
	&bbStringClass,
	0x3140a020f3cd1e86,
	3,
	{59,10,10}
};
static struct BBString_17 _s23={
	&bbStringClass,
	0xa589fa63762d4711,
	17,
	{65,32,109,97,108,108,111,99,40,41,32,102,97,105,108,101,100
}
};
static struct BBString_33 _s22={
	&bbStringClass,
	0x205453d15494b73e,
	33,
	{65,32,116,97,98,108,101,32,105,110,32,116,104,101,32,100,97
	,116,97,98,97,115,101,32,105,115,32,108,111,99,107,101,100
}
};
static struct BBString_33 _s35={
	&bbStringClass,
	0xe5e37a06da705b1,
	33,
	{65,98,111,114,116,32,100,117,101,32,84,111,32,99,111,110,115
	,116,114,97,105,110,116,32,118,105,111,108,97,116,105,111,110
}
};
static struct BBString_24 _s19={
	&bbStringClass,
	0x4c30aff799cf03b0,
	24,
	{65,99,99,101,115,115,32,112,101,114,109,105,115,115,105,111,110
	,32,100,101,110,105,101,100}
};
static struct BBString_33 _s18={
	&bbStringClass,
	0x84744c21ab41a98f,
	33,
	{65,110,32,105,110,116,101,114,110,97,108,32,108,111,103,105,99
	,32,101,114,114,111,114,32,105,110,32,83,81,76,105,116,101
}
};
static struct BBString_36 _s24={
	&bbStringClass,
	0xd84bf78740fcb420,
	36,
	{65,116,116,101,109,112,116,32,84,111,32,119,114,105,116,101,32
	,97,32,114,101,97,100,111,110,108,121,32,100,97,116,97,98
	,97,115,101}
};
static struct BBString_20 _s39={
	&bbStringClass,
	0x61f2b2ad23f41b13,
	20,
	{65,117,116,104,111,114,105,122,97,116,105,111,110,32,100,101,110
	,105,101,100}
};
static struct BBString_17 _s14={
	&bbStringClass,
	0xce3f7e19789d89a2,
	17,
	{66,69,71,73,78,32,84,82,65,78,83,65,67,84,73,79,78
}
};
static struct BBString_18 _s1={
	&bbStringClass,
	0x1563e9e2b29bcaaf,
	18,
	{67,79,77,77,73,84,32,84,82,65,78,83,65,67,84,73,79
	,78}
};
static struct BBString_35 _s20={
	&bbStringClass,
	0x82c82e24cc3653e0,
	35,
	{67,97,108,108,98,97,99,107,32,114,111,117,116,105,110,101,32
	,114,101,113,117,101,115,116,101,100,32,97,110,32,97,98,111
	,114,116}
};
static struct BBString_18 _s36={
	&bbStringClass,
	0x353c6741e5bac503,
	18,
	{68,97,116,97,32,84,121,112,101,32,109,105,115,109,97,116,99
	,104}
};
static struct BBString_28 _s31={
	&bbStringClass,
	0x4e2455e4a120f853,
	28,
	{68,97,116,97,98,97,115,101,32,108,111,99,107,32,112,114,111
	,116,111,99,111,108,32,101,114,114,111,114}
};
static struct BBString_6 _s46={
	&bbStringClass,
	0x41c966a54904e7e8,
	6,
	{69,114,114,111,114,32}
};
static struct BBString_17 _s47={
	&bbStringClass,
	0x86118c6723b4be8a,
	17,
	{69,114,114,111,114,32,97,100,100,105,110,103,32,117,115,101,114
}
};
static struct BBString_25 _s10={
	&bbStringClass,
	0xf3114f74c6693070,
	25,
	{69,114,114,111,114,32,97,117,116,104,101,110,116,105,99,97,116
	,105,110,103,32,117,115,101,114}
};
static struct BBString_19 _s48={
	&bbStringClass,
	0xb82d5d1fea4a6575,
	19,
	{69,114,114,111,114,32,99,104,97,110,103,105,110,103,32,117,115
	,101,114}
};
static struct BBString_22 _s0={
	&bbStringClass,
	0xda1352a7d297840b,
	22,
	{69,114,114,111,114,32,99,108,111,115,105,110,103,32,100,97,116
	,97,98,97,115,101}
};
static struct BBString_28 _s2={
	&bbStringClass,
	0x98ccb0d8ca98ec90,
	28,
	{69,114,114,111,114,32,99,111,109,109,105,116,116,105,110,103,32
	,116,114,97,110,115,97,99,116,105,111,110}
};
static struct BBString_19 _s49={
	&bbStringClass,
	0xbdb87a8eae326374,
	19,
	{69,114,114,111,114,32,100,101,108,101,116,105,110,103,32,117,115
	,101,114}
};
static struct BBString_22 _s11={
	&bbStringClass,
	0xe5fcc5f2c720ee2,
	22,
	{69,114,114,111,114,32,111,112,101,110,105,110,103,32,100,97,116
	,97,98,97,115,101}
};
static struct BBString_25 _s50={
	&bbStringClass,
	0x48fa39593b31d4a4,
	25,
	{69,114,114,111,114,32,112,114,101,112,97,114,105,110,103,32,115
	,116,97,116,101,109,101,110,116}
};
static struct BBString_25 _s51={
	&bbStringClass,
	0x31541e24c25d9aef,
	25,
	{69,114,114,111,114,32,114,101,115,101,116,116,105,110,103,32,115
	,116,97,116,101,109,101,110,116}
};
static struct BBString_30 _s13={
	&bbStringClass,
	0xa04557736a983af5,
	30,
	{69,114,114,111,114,32,114,111,108,108,105,110,103,32,98,97,99
	,107,32,116,114,97,110,115,97,99,116,105,111,110}
};
static struct BBString_26 _s15={
	&bbStringClass,
	0x2182482802d813a0,
	26,
	{69,114,114,111,114,32,115,116,97,114,116,105,110,103,32,116,114
	,97,110,115,97,99,116,105,111,110}
};
static struct BBString_26 _s52={
	&bbStringClass,
	0x7cf813d87cbdcef8,
	26,
	{70,97,105,108,101,100,32,116,111,32,98,105,110,100,32,112,97
	,114,97,109,101,116,101,114,32,40}
};
static struct BBString_39 _s41={
	&bbStringClass,
	0xa97d8884f1fb22f9,
	39,
	{70,105,108,101,32,111,112,101,110,101,100,32,116,104,97,116,32
	,105,115,32,110,111,116,32,97,32,100,97,116,97,98,97,115
	,101,32,102,105,108,101}
};
static struct BBString_41 _s29={
	&bbStringClass,
	0x4ee81469ef748402,
	41,
	{73,110,115,101,114,116,105,111,110,32,102,97,105,108,101,100,32
	,98,101,99,97,117,115,101,32,100,97,116,97,98,97,115,101
	,32,105,115,32,102,117,108,108}
};
static struct BBString_24 _s37={
	&bbStringClass,
	0x2b5b45f7ba804179,
	24,
	{76,105,98,114,97,114,121,32,117,115,101,100,32,105,110,99,111
	,114,114,101,99,116,108,121}
};
static struct BBString_32 _s42={
	&bbStringClass,
	0x261b5be162bb5a17,
	32,
	{78,111,116,105,102,105,99,97,116,105,111,110,115,32,102,114,111
	,109,32,115,113,108,105,116,101,51,95,108,111,103,40,41}
};
static struct BBString_42 _s25={
	&bbStringClass,
	0x8453299b1a14a6b5,
	42,
	{79,112,101,114,97,116,105,111,110,32,116,101,114,109,105,110,97
	,116,101,100,32,98,121,32,115,113,108,105,116,101,95,105,110
	,116,101,114,114,117,112,116,40,41}
};
static struct BBString_18 _s5={
	&bbStringClass,
	0xee3480787aff5f7a,
	18,
	{80,82,65,71,77,65,32,116,97,98,108,101,95,105,110,102,111
	,40}
};
static struct BBString_24 _s53={
	&bbStringClass,
	0x7a89cb9204ae2f3f,
	24,
	{80,97,114,97,109,101,116,101,114,32,99,111,117,110,116,32,109
	,105,115,109,97,116,99,104}
};
static struct BBString_20 _s12={
	&bbStringClass,
	0x5ce384a4f90ac45c,
	20,
	{82,79,76,76,66,65,67,75,32,84,82,65,78,83,65,67,84
	,73,79,78}
};
static struct BBString_118 _s63={
	&bbStringClass,
	0xa159bc7d725d70f6,
	118,
	{83,69,76,69,67,84,32,110,97,109,101,32,70,82,79,77,32
	,115,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72
	,69,82,69,32,116,121,112,101,32,61,32,39,116,97,98,108
	,101,39,32,85,78,73,79,78,32,65,76,76,32,83,69,76
	,69,67,84,32,110,97,109,101,32,70,82,79,77,32,115,113
	,108,105,116,101,95,116,101,109,112,95,109,97,115,116,101,114
	,32,87,72,69,82,69,32,116,121,112,101,32,61,32,39,116
	,97,98,108,101,39}
};
static struct BBString_63 _s7={
	&bbStringClass,
	0x351c52956436e3e3,
	63,
	{83,69,76,69,67,84,32,115,113,108,32,70,82,79,77,32,115
	,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72,69
	,82,69,32,84,121,112,101,32,61,32,39,116,97,98,108,101
	,39,32,97,110,100,32,110,97,109,101,32,61,32,39}
};
static struct BBString_29 _s17={
	&bbStringClass,
	0x357b3989edb45022,
	29,
	{83,81,76,32,101,114,114,111,114,32,79,114,32,109,105,115,115
	,105,110,103,32,100,97,116,97,98,97,115,101}
};
static struct BBString_6 _s62={
	&bbStringClass,
	0xd31c7633b1e4bfb8,
	6,
	{83,81,76,73,84,69}
};
static struct BBString_36 _s26={
	&bbStringClass,
	0x22d43995c3c7d9e2,
	36,
	{83,111,109,101,32,107,105,110,100,32,111,102,32,100,105,115,107
	,32,73,47,79,32,101,114,114,111,114,32,111,99,99,117,114
	,114,101,100}
};
static struct BBString_17 _s16={
	&bbStringClass,
	0xa1784d2049345f6a,
	17,
	{83,117,99,99,101,115,115,102,117,108,32,114,101,115,117,108,116
}
};
static struct BBString_36 _s27={
	&bbStringClass,
	0x67bde22b54050d3d,
	36,
	{84,104,101,32,100,97,116,97,98,97,115,101,32,100,105,115,107
	,32,105,109,97,103,101,32,105,115,32,109,97,108,102,111,114
	,109,101,100}
};
static struct BBString_27 _s21={
	&bbStringClass,
	0x3d0a60e3eebd50e5,
	27,
	{84,104,101,32,100,97,116,97,98,97,115,101,32,102,105,108,101
	,32,105,115,32,108,111,99,107,101,100}
};
static struct BBString_27 _s33={
	&bbStringClass,
	0x58c117520b5c6029,
	27,
	{84,104,101,32,100,97,116,97,98,97,115,101,32,115,99,104,101
	,109,97,32,99,104,97,110,103,101,100}
};
static struct BBString_36 _s34={
	&bbStringClass,
	0x4aa193a3483a645c,
	36,
	{84,111,111,32,109,117,99,104,32,100,97,116,97,32,70,111,114
	,32,111,110,101,32,114,111,119,32,111,102,32,97,32,116,97
	,98,108,101}
};
static struct BBString_32 _s30={
	&bbStringClass,
	0xe34729c13580e05d,
	32,
	{85,110,97,98,108,101,32,84,111,32,111,112,101,110,32,116,104
	,101,32,100,97,116,97,98,97,115,101,32,102,105,108,101}
};
static struct BBString_38 _s38={
	&bbStringClass,
	0xf17615ae1d0574ed,
	38,
	{85,115,101,115,32,79,83,32,102,101,97,116,117,114,101,115,32
	,78,111,116,32,115,117,112,112,111,114,116,101,100,32,111,110
	,32,104,111,115,116}
};
static struct BBString_27 _s43={
	&bbStringClass,
	0x793f7be16aa2166f,
	27,
	{87,97,114,110,105,110,103,115,32,102,114,111,109,32,115,113,108
	,105,116,101,51,95,108,111,103,40,41}
};
static struct BBString_4 _s60={
	&bbStringClass,
	0xdec8f18e32f7e474,
	4,
	{98,108,111,98}
};
static struct BBString_6 _s58={
	&bbStringClass,
	0x71b58eac94f8019d,
	6,
	{100,111,117,98,108,101}
};
static struct BBString_5 _s59={
	&bbStringClass,
	0x6be68d0b4210ad1b,
	5,
	{102,108,111,97,116}
};
static struct BBString_3 _s57={
	&bbStringClass,
	0x97266e93bbc64ea,
	3,
	{105,110,116}
};
static struct BBString_7 _s56={
	&bbStringClass,
	0x2468c759d4a47b83,
	7,
	{105,110,116,101,103,101,114}
};
static struct BBString_7 _s55={
	&bbStringClass,
	0xd00955157cdbd2ab,
	7,
	{110,117,109,101,114,105,99}
};
static struct BBString_35 _s44={
	&bbStringClass,
	0x826e34c9816210eb,
	35,
	{115,113,108,105,116,101,95,115,116,101,112,40,41,32,104,97,115
	,32,97,110,111,116,104,101,114,32,114,111,119,32,114,101,97
	,100,121}
};
static struct BBString_36 _s45={
	&bbStringClass,
	0x58ff13d3dbc9f0df,
	36,
	{115,113,108,105,116,101,95,115,116,101,112,40,41,32,104,97,115
	,32,102,105,110,105,115,104,101,100,32,101,120,101,99,117,116
	,105,110,103}
};
struct BBDebugScope_16{int kind; const char *name; BBDebugDecl decls[17]; };
struct BBDebugScope_2{int kind; const char *name; BBDebugDecl decls[3]; };
struct BBDebugScope_22{int kind; const char *name; BBDebugDecl decls[23]; };
void _database_sqlite_TSQLiteDatabaseLoader_New(struct database_sqlite_TSQLiteDatabaseLoader_obj* o) {
	_database_core_TDatabaseLoader_New((struct database_core_TDatabaseLoader_obj*)o);
	o->clas = &database_sqlite_TSQLiteDatabaseLoader;
	o->_database_core_tdatabaseloader__type =((BBString*)&_s62);
}
struct database_core_TDBConnection_obj* _database_sqlite_TSQLiteDatabaseLoader_LoadDatabase_SSiSSSS(struct database_sqlite_TSQLiteDatabaseLoader_obj* o,BBSTRING bbt_dbname,BBSTRING bbt_host,BBINT bbt_port,BBSTRING bbt_user,BBSTRING bbt_password,BBSTRING bbt_server,BBSTRING bbt_options){
	return (struct database_core_TDBConnection_obj*)database_sqlite_TDBSQLite_Create_TTDBConnection_SSiSSSS(bbt_dbname,bbt_host,bbt_port,bbt_user,bbt_password,bbt_server,bbt_options);
}
struct BBDebugScope_2 database_sqlite_TSQLiteDatabaseLoader_scope ={
	BBDEBUGSCOPE_USERTYPE,
	"TSQLiteDatabaseLoader",
	{
		{
			BBDEBUGDECL_TYPEMETHOD,
			"New",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteDatabaseLoader_New
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"LoadDatabase",
			"($,$,i,$,$,$,$):TDBConnection",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteDatabaseLoader_LoadDatabase_SSiSSSS
		},
		{
			BBDEBUGDECL_END
		}
	}
};
struct BBClass_database_sqlite_TSQLiteDatabaseLoader database_sqlite_TSQLiteDatabaseLoader={
	&database_core_TDatabaseLoader,
	bbObjectFree,
	(BBDebugScope*)&database_sqlite_TSQLiteDatabaseLoader_scope,
	sizeof(struct database_sqlite_TSQLiteDatabaseLoader_obj),
	(void (*)(BBOBJECT))_database_sqlite_TSQLiteDatabaseLoader_New,
	bbObjectDtor,
	bbObjectToString,
	bbObjectCompare,
	bbObjectSendMessage,
	0,
	0,
	0
	,0
	,sizeof(void*)
	,_database_sqlite_TSQLiteDatabaseLoader_LoadDatabase_SSiSSSS
};

void _database_sqlite_TDBSQLite_New(struct database_sqlite_TDBSQLite_obj* o) {
	_database_core_TDBConnection_New((struct database_core_TDBConnection_obj*)o);
	o->clas = &database_sqlite_TDBSQLite;
	o->_database_sqlite_tdbsqlite_queries = bbArrayNew1D(":TSQLiteResultSet", 2);
}
void _database_sqlite_TDBSQLite_Delete(struct database_sqlite_TDBSQLite_obj* o) {
	_database_core_TDBConnection_Delete((struct database_core_TDBConnection_obj*)o);
}
struct database_core_TDBConnection_obj* database_sqlite_TDBSQLite_Create_TTDBConnection_SSiSSSS(BBSTRING bbt_dbname,BBSTRING bbt_host,BBINT bbt_port,BBSTRING bbt_user,BBSTRING bbt_password,BBSTRING bbt_server,BBSTRING bbt_options){
	struct database_sqlite_TDBSQLite_obj* bbt_this=(struct database_sqlite_TDBSQLite_obj*)(struct database_sqlite_TDBSQLite_obj*)bbObjectNew((BBClass *)&database_sqlite_TDBSQLite);
	(bbt_this)->clas->m_Init_SSiSSSS((struct database_core_TDBConnection_obj*)bbt_this,bbt_dbname,bbt_host,bbt_port,bbt_user,bbt_password,bbt_server,bbt_options);
	if(bbt_this->_database_core_tdbconnection__dbname != &bbEmptyString){
		(bbt_this)->clas->m_open_SS((struct database_sqlite_TDBSQLite_obj*)bbt_this,bbt_user,bbt_password);
	}
	return (struct database_core_TDBConnection_obj*)((struct database_core_TDBConnection_obj*)bbObjectDowncast((BBOBJECT)bbt_this,(BBClass*)&database_core_TDBConnection));
}
void _database_sqlite_TDBSQLite_close(struct database_sqlite_TDBSQLite_obj* o){
	((struct database_sqlite_TDBSQLite_obj*)o)->clas->m_clearQueries((struct database_sqlite_TDBSQLite_obj*)o);
	if(o->_database_core_tdbconnection__isopen !=0){
		if(sqlite3_close(o->_database_core_tdbconnection_handle )!=0){
			((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s0),(&bbEmptyString),2,0);
		}
		o->_database_core_tdbconnection_handle =0;
		o->_database_core_tdbconnection__isopen =0;
	}
}
BBINT _database_sqlite_TDBSQLite_commit(struct database_sqlite_TDBSQLite_obj* o){
	if(!(o->_database_core_tdbconnection__isopen !=0)){
		return 0;
	}
	((struct database_sqlite_TDBSQLite_obj*)o)->clas->m_resetQueries((struct database_sqlite_TDBSQLite_obj*)o);
	struct database_core_TDatabaseQuery_obj* bbt_query=(struct database_core_TDatabaseQuery_obj*)((struct database_core_TDBConnection_obj*)o)->clas->m_executeQuery_S((struct database_core_TDBConnection_obj*)o,((BBString*)&_s1));
	if(((struct database_core_TDBConnection_obj*)o)->clas->m_hasError((struct database_core_TDBConnection_obj*)o)!=0){
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s2),((struct database_core_TDBConnection_obj*)o)->clas->m_error((struct database_core_TDBConnection_obj*)o)->_database_core_tdatabaseerror_error ,1,0);
		return 0;
	}
	(bbt_query)->clas->m_free((struct database_core_TDatabaseQuery_obj*)bbt_query);
	return 1;
}
BBARRAY _database_sqlite_TDBSQLite_getTables(struct database_sqlite_TDBSQLite_obj* o){
	BBARRAY bbt_list=(&bbEmptyArray);
	if(!(o->_database_core_tdbconnection__isopen !=0)){
		return bbt_list;
	}
	struct brl_linkedlist_TList_obj* bbt_tables=(struct brl_linkedlist_TList_obj*)(struct brl_linkedlist_TList_obj*)bbObjectNew((BBClass *)&brl_linkedlist_TList);
	struct database_core_TDatabaseQuery_obj* bbt_query=(struct database_core_TDatabaseQuery_obj*)database_core_TDatabaseQuery_Create_TTDatabaseQuery_TTDBConnection((struct database_core_TDBConnection_obj*)((struct database_core_TDBConnection_obj*)bbObjectDowncast((BBOBJECT)o,(BBClass*)&database_core_TDBConnection)));
	BBSTRING bbt_sql=((BBString*)&_s63);
	if((bbt_query)->clas->m_execute_S((struct database_core_TDatabaseQuery_obj*)bbt_query,bbt_sql)!=0){
		while((bbt_query)->clas->m_nextRow((struct database_core_TDatabaseQuery_obj*)bbt_query)!=0){
			struct database_core_dbtypes_TDBType_obj* bbt_;
			(bbt_tables)->clas->m_AddLast_TObject((struct brl_linkedlist_TList_obj*)bbt_tables,(BBOBJECT)(bbt_ = (bbt_query)->clas->m_value_i((struct database_core_TDatabaseQuery_obj*)bbt_query,0))->clas->m_getString((struct database_core_dbtypes_TDBType_obj*)bbt_));
		}
	}
	if((bbt_tables)->clas->m_Count((struct brl_linkedlist_TList_obj*)bbt_tables)>0){
		bbt_list=bbArrayNew1D("$", (bbt_tables)->clas->m_Count((struct brl_linkedlist_TList_obj*)bbt_tables));
		BBINT bbt_i=0;
		struct brl_linkedlist_TListEnum_obj* bbt_2=(struct brl_linkedlist_TListEnum_obj*)(bbt_tables)->clas->m_ObjectEnumerator((struct brl_linkedlist_TList_obj*)bbt_tables);
		while((bbt_2)->clas->m_HasNext((struct brl_linkedlist_TListEnum_obj*)bbt_2)!=0){
			BBOBJECT bbt_3=(BBOBJECT)(bbt_2)->clas->m_NextObject((struct brl_linkedlist_TListEnum_obj*)bbt_2);
			if(bbObjectIsString((BBOBJECT)bbt_3)==0){
				continue;
			}
			BBSTRING bbt_s=((BBString *)bbObjectStringcast((BBOBJECT)bbt_3));
			((BBSTRING*)BBARRAYDATA(bbt_list,1))[((BBUINT)bbt_i)]=bbt_s;
			bbt_i+=1;
		}
	}
	return bbt_list;
}
struct database_core_TDBTable_obj* _database_sqlite_TDBSQLite_getTableInfo_Si(struct database_sqlite_TDBSQLite_obj* o,BBSTRING bbt_tableName,BBINT bbt_withDDL){
	if(!(o->_database_core_tdbconnection__isopen !=0)){
		return (struct database_core_TDBTable_obj*)&bbNullObject;
	}
	struct database_core_TDatabaseQuery_obj* bbt_query=(struct database_core_TDatabaseQuery_obj*)database_core_TDatabaseQuery_Create_TTDatabaseQuery_TTDBConnection((struct database_core_TDBConnection_obj*)((struct database_core_TDBConnection_obj*)bbObjectDowncast((BBOBJECT)o,(BBClass*)&database_core_TDBConnection)));
	struct database_core_TDBTable_obj* bbt_table=(struct database_core_TDBTable_obj*)((struct database_core_TDBTable_obj*)&bbNullObject);
	BBSTRING bbt_sql=bbStringConcat(bbStringConcat(((BBString*)&_s5),bbt_tableName),((BBString*)&_s6));
	if((bbt_query)->clas->m_execute_S((struct database_core_TDatabaseQuery_obj*)bbt_query,bbt_sql)!=0){
		bbt_table=(struct database_core_TDBTable_obj*)(struct database_core_TDBTable_obj*)bbObjectNew((BBClass *)&database_core_TDBTable);
		bbt_table->_database_core_tdbtable_name =bbt_tableName;
		struct brl_linkedlist_TList_obj* bbt_cols=(struct brl_linkedlist_TList_obj*)(struct brl_linkedlist_TList_obj*)bbObjectNew((BBClass *)&brl_linkedlist_TList);
		struct database_core_TRowEnumerator_obj* bbt_=(struct database_core_TRowEnumerator_obj*)(bbt_query)->clas->m_ObjectEnumerator((struct database_core_TDatabaseQuery_obj*)bbt_query);
		while((bbt_)->clas->m_HasNext((struct database_core_TRowEnumerator_obj*)bbt_)!=0){
			struct database_core_TQueryRecord_obj* bbt_rec=(struct database_core_TQueryRecord_obj*)((struct database_core_TQueryRecord_obj*)bbObjectDowncast((BBOBJECT)(bbt_)->clas->m_NextObject((struct database_core_TRowEnumerator_obj*)bbt_),(BBClass*)&database_core_TQueryRecord));
			if(((BBOBJECT)bbt_rec)==&bbNullObject){
				continue;
			}
			BBSTRING bbt_name=(bbt_rec)->clas->m_getString_i((struct database_core_TQueryRecord_obj*)bbt_rec,1);
			BBINT bbt_dbType=database_sqlite_TSQLiteResultSet_dbTypeFromNative_i_Sii((bbt_rec)->clas->m_getString_i((struct database_core_TQueryRecord_obj*)bbt_rec,2),0,0);
			BBINT bbt_nullable=(bbt_rec)->clas->m_getInt_i((struct database_core_TQueryRecord_obj*)bbt_rec,3);
			struct database_core_dbtypes_TDBType_obj* bbt_defaultValue=(struct database_core_dbtypes_TDBType_obj*)(bbt_rec)->clas->m_value_i((struct database_core_TQueryRecord_obj*)bbt_rec,4);
			(bbt_cols)->clas->m_AddLast_TObject((struct brl_linkedlist_TList_obj*)bbt_cols,(BBOBJECT)database_core_TDBColumn_Create_TTDBColumn_SiiTTDBType(bbt_name,bbt_dbType,bbt_nullable,(struct database_core_dbtypes_TDBType_obj*)bbt_defaultValue));
		}
		(bbt_table)->clas->m_SetCountColumns_i((struct database_core_TDBTable_obj*)bbt_table,(bbt_cols)->clas->m_Count((struct brl_linkedlist_TList_obj*)bbt_cols));
		BBINT bbt_i=0;
		struct brl_linkedlist_TListEnum_obj* bbt_2=(struct brl_linkedlist_TListEnum_obj*)(bbt_cols)->clas->m_ObjectEnumerator((struct brl_linkedlist_TList_obj*)bbt_cols);
		while((bbt_2)->clas->m_HasNext((struct brl_linkedlist_TListEnum_obj*)bbt_2)!=0){
			struct database_core_TDBColumn_obj* bbt_col=(struct database_core_TDBColumn_obj*)((struct database_core_TDBColumn_obj*)bbObjectDowncast((BBOBJECT)(bbt_2)->clas->m_NextObject((struct brl_linkedlist_TListEnum_obj*)bbt_2),(BBClass*)&database_core_TDBColumn));
			if(((BBOBJECT)bbt_col)==&bbNullObject){
				continue;
			}
			(bbt_table)->clas->m_SetColumn_iTTDBColumn((struct database_core_TDBTable_obj*)bbt_table,bbt_i,(struct database_core_TDBColumn_obj*)bbt_col);
			bbt_i+=1;
		}
		(bbt_cols)->clas->m_Clear((struct brl_linkedlist_TList_obj*)bbt_cols);
		if(bbt_withDDL!=0){
			bbt_sql=bbStringConcat(bbStringConcat(((BBString*)&_s7),bbt_tableName),((BBString*)&_s8));
			if((bbt_query)->clas->m_execute_S((struct database_core_TDatabaseQuery_obj*)bbt_query,bbt_sql)!=0){
				struct database_core_TRowEnumerator_obj* bbt_3=(struct database_core_TRowEnumerator_obj*)(bbt_query)->clas->m_ObjectEnumerator((struct database_core_TDatabaseQuery_obj*)bbt_query);
				while((bbt_3)->clas->m_HasNext((struct database_core_TRowEnumerator_obj*)bbt_3)!=0){
					struct database_core_TQueryRecord_obj* bbt_rec2=(struct database_core_TQueryRecord_obj*)((struct database_core_TQueryRecord_obj*)bbObjectDowncast((BBOBJECT)(bbt_3)->clas->m_NextObject((struct database_core_TRowEnumerator_obj*)bbt_3),(BBClass*)&database_core_TQueryRecord));
					if(((BBOBJECT)bbt_rec2)==&bbNullObject){
						continue;
					}
					bbt_table->_database_core_tdbtable_ddl =bbStringConcat(bbt_table->_database_core_tdbtable_ddl ,(bbStringConcat((bbt_rec2)->clas->m_getString_i((struct database_core_TQueryRecord_obj*)bbt_rec2,0),((BBString*)&_s9))));
				}
			}
		}
	}
	return (struct database_core_TDBTable_obj*)bbt_table;
}
BBINT _database_sqlite_TDBSQLite_open_SS(struct database_sqlite_TDBSQLite_obj* o,BBSTRING bbt_user,BBSTRING bbt_pass){
	if(o->_database_core_tdbconnection__isopen !=0){
		((struct database_sqlite_TDBSQLite_obj*)o)->clas->m_close((struct database_sqlite_TDBSQLite_obj*)o);
	}
	BBBYTE* bbt_s=bbStringToUTF8String((BBSTRING)o->_database_core_tdbconnection__dbname );
	BBINT bbt_flags=bbStringToInt((BBSTRING)o->_database_core_tdbconnection__options );
	if(!(bbt_flags!=0)){
		bbt_flags=6;
	}
	BBINT bbt_ret=sqlite3_open_v2(bbt_s,(&o->_database_core_tdbconnection_handle ),bbt_flags,0);
	bbMemFree((void*)bbt_s);
	if(bbt_ret==0){
		o->_database_core_tdbconnection__isopen =1;
		if(o->_database_core_tdbconnection__user != &bbEmptyString){
			BBBYTE* bbt_u=bbStringToUTF8String((BBSTRING)o->_database_core_tdbconnection__user );
			BBBYTE* bbt_p=bbStringToUTF8String((BBSTRING)o->_database_core_tdbconnection__password );
			bbt_ret=sqlite3_user_authenticate(o->_database_core_tdbconnection_handle ,bbt_u,bbt_p,strlen(bbt_p));
			bbMemFree((void*)bbt_p);
			bbMemFree((void*)bbt_u);
			if(bbt_ret!=0){
				((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s10),(&bbEmptyString),2,bbt_ret);
			}
		}
		return 1;
	}else{
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s11),(&bbEmptyString),2,bbt_ret);
	}
	return 0;
}
BBINT _database_sqlite_TDBSQLite_rollback(struct database_sqlite_TDBSQLite_obj* o){
	if(!(o->_database_core_tdbconnection__isopen !=0)){
		return 0;
	}
	((struct database_sqlite_TDBSQLite_obj*)o)->clas->m_resetQueries((struct database_sqlite_TDBSQLite_obj*)o);
	struct database_core_TDatabaseQuery_obj* bbt_query=(struct database_core_TDatabaseQuery_obj*)((struct database_core_TDBConnection_obj*)o)->clas->m_executeQuery_S((struct database_core_TDBConnection_obj*)o,((BBString*)&_s12));
	if(((struct database_core_TDBConnection_obj*)o)->clas->m_hasError((struct database_core_TDBConnection_obj*)o)!=0){
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s13),((struct database_core_TDBConnection_obj*)o)->clas->m_error((struct database_core_TDBConnection_obj*)o)->_database_core_tdatabaseerror_error ,1,0);
		return 0;
	}
	(bbt_query)->clas->m_free((struct database_core_TDatabaseQuery_obj*)bbt_query);
	return 1;
}
BBINT _database_sqlite_TDBSQLite_startTransaction(struct database_sqlite_TDBSQLite_obj* o){
	if(!(o->_database_core_tdbconnection__isopen !=0)){
		return 0;
	}
	struct database_core_TDatabaseQuery_obj* bbt_query=(struct database_core_TDatabaseQuery_obj*)((struct database_core_TDBConnection_obj*)o)->clas->m_executeQuery_S((struct database_core_TDBConnection_obj*)o,((BBString*)&_s14));
	if(((struct database_core_TDBConnection_obj*)o)->clas->m_hasError((struct database_core_TDBConnection_obj*)o)!=0){
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s15),((struct database_core_TDBConnection_obj*)o)->clas->m_error((struct database_core_TDBConnection_obj*)o)->_database_core_tdatabaseerror_error ,1,0);
		return 0;
	}
	(bbt_query)->clas->m_free((struct database_core_TDatabaseQuery_obj*)bbt_query);
	return 1;
}
BBBYTE* _database_sqlite_TDBSQLite_databaseHandle(struct database_sqlite_TDBSQLite_obj* o){
	return o->_database_core_tdbconnection_handle ;
}
struct database_core_TQueryResultSet_obj* _database_sqlite_TDBSQLite_createResultSet(struct database_sqlite_TDBSQLite_obj* o){
	return (struct database_core_TQueryResultSet_obj*)database_sqlite_TSQLiteResultSet_Create_TTQueryResultSet_TTDBConnectionS((struct database_core_TDBConnection_obj*)((struct database_core_TDBConnection_obj*)bbObjectDowncast((BBOBJECT)o,(BBClass*)&database_core_TDBConnection)),(&bbEmptyString));
}
BBSTRING _database_sqlite_TDBSQLite_nativeErrorMessage_i(struct database_sqlite_TDBSQLite_obj* o,BBINT bbt_err){
	BBINT bbt_=bbt_err;
	if(bbt_==0){
		return ((BBString*)&_s16);
	}else{
		if(bbt_==1){
			return ((BBString*)&_s17);
		}else{
			if(bbt_==2){
				return ((BBString*)&_s18);
			}else{
				if(bbt_==3){
					return ((BBString*)&_s19);
				}else{
					if(bbt_==4){
						return ((BBString*)&_s20);
					}else{
						if(bbt_==5){
							return ((BBString*)&_s21);
						}else{
							if(bbt_==6){
								return ((BBString*)&_s22);
							}else{
								if(bbt_==7){
									return ((BBString*)&_s23);
								}else{
									if(bbt_==8){
										return ((BBString*)&_s24);
									}else{
										if(bbt_==9){
											return ((BBString*)&_s25);
										}else{
											if(bbt_==10){
												return ((BBString*)&_s26);
											}else{
												if(bbt_==11){
													return ((BBString*)&_s27);
												}else{
													if(bbt_==12){
														return ((BBString*)&_s28);
													}else{
														if(bbt_==13){
															return ((BBString*)&_s29);
														}else{
															if(bbt_==14){
																return ((BBString*)&_s30);
															}else{
																if(bbt_==15){
																	return ((BBString*)&_s31);
																}else{
																	if(bbt_==16){
																		return ((BBString*)&_s32);
																	}else{
																		if(bbt_==17){
																			return ((BBString*)&_s33);
																		}else{
																			if(bbt_==18){
																				return ((BBString*)&_s34);
																			}else{
																				if(bbt_==19){
																					return ((BBString*)&_s35);
																				}else{
																					if(bbt_==20){
																						return ((BBString*)&_s36);
																					}else{
																						if(bbt_==21){
																							return ((BBString*)&_s37);
																						}else{
																							if(bbt_==22){
																								return ((BBString*)&_s38);
																							}else{
																								if(bbt_==23){
																									return ((BBString*)&_s39);
																								}else{
																									if(bbt_==25){
																										return ((BBString*)&_s40);
																									}else{
																										if(bbt_==26){
																											return ((BBString*)&_s41);
																										}else{
																											if(bbt_==27){
																												return ((BBString*)&_s42);
																											}else{
																												if(bbt_==28){
																													return ((BBString*)&_s43);
																												}else{
																													if(bbt_==100){
																														return ((BBString*)&_s44);
																													}else{
																														if(bbt_==101){
																															return ((BBString*)&_s45);
																														}else{
																															return bbStringConcat(((BBString*)&_s46),bbStringFromInt(bbt_err));
																														}
																													}
																												}
																											}
																										}
																									}
																								}
																							}
																						}
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}
BBINT _database_sqlite_TDBSQLite_hasPrepareSupport(struct database_sqlite_TDBSQLite_obj* o){
	return 1;
}
BBINT _database_sqlite_TDBSQLite_hasTransactionSupport(struct database_sqlite_TDBSQLite_obj* o){
	return 1;
}
void _database_sqlite_TDBSQLite_clearQueries(struct database_sqlite_TDBSQLite_obj* o){
	{
		BBINT bbt_i=0;
		BBINT bbt_=(o->_database_sqlite_tdbsqlite_queries ->scales[0]);
		for(;(bbt_i<bbt_);bbt_i=(bbt_i+1)){
			struct database_sqlite_TSQLiteResultSet_obj* bbt_q=(struct database_sqlite_TSQLiteResultSet_obj*)((struct database_sqlite_TSQLiteResultSet_obj**)BBARRAYDATA(o->_database_sqlite_tdbsqlite_queries ,1))[((BBUINT)bbt_i)];
			if(((BBObject*)bbt_q)!= &bbNullObject){
				(bbt_q)->clas->m_free((struct database_sqlite_TSQLiteResultSet_obj*)bbt_q);
			}
		}
	}
}
void _database_sqlite_TDBSQLite_resetQueries(struct database_sqlite_TDBSQLite_obj* o){
	BBARRAY bbt_=o->_database_sqlite_tdbsqlite_queries ;
	BBUINT bbt_2=0U;
	while(bbt_2<((BBUINT)(bbt_->scales[0]))){
		struct database_sqlite_TSQLiteResultSet_obj* bbt_q=(struct database_sqlite_TSQLiteResultSet_obj*)((struct database_sqlite_TSQLiteResultSet_obj**)BBARRAYDATA(bbt_,1))[bbt_2];
		bbt_2=(bbt_2+1U);
		if(((BBOBJECT)bbt_q)==&bbNullObject){
			continue;
		}
		if(((BBObject*)bbt_q)!= &bbNullObject){
			(bbt_q)->clas->m_reset((struct database_sqlite_TSQLiteResultSet_obj*)bbt_q);
		}
	}
}
void _database_sqlite_TDBSQLite_addQuery_TTSQLiteResultSet(struct database_sqlite_TDBSQLite_obj* o,struct database_sqlite_TSQLiteResultSet_obj* bbt_query){
	BBINT bbt_firstFree=-1;
	{
		BBINT bbt_i=0;
		BBINT bbt_=(o->_database_sqlite_tdbsqlite_queries ->scales[0]);
		for(;(bbt_i<bbt_);bbt_i=(bbt_i+1)){
			struct database_sqlite_TSQLiteResultSet_obj* bbt_q=(struct database_sqlite_TSQLiteResultSet_obj*)((struct database_sqlite_TSQLiteResultSet_obj**)BBARRAYDATA(o->_database_sqlite_tdbsqlite_queries ,1))[((BBUINT)bbt_i)];
			if(!(((BBObject*)bbt_q)!= &bbNullObject) && (bbt_firstFree<0)){
				bbt_firstFree=bbt_i;
			}else{
				if(((struct database_sqlite_TSQLiteResultSet_obj*)((struct database_sqlite_TSQLiteResultSet_obj**)BBARRAYDATA(o->_database_sqlite_tdbsqlite_queries ,1))[((BBUINT)bbt_i)])==bbt_query){
					return;
				}
			}
		}
	}
	if(bbt_firstFree>=0){
		((struct database_sqlite_TSQLiteResultSet_obj**)BBARRAYDATA(o->_database_sqlite_tdbsqlite_queries ,1))[((BBUINT)bbt_firstFree)]=(struct database_sqlite_TSQLiteResultSet_obj*)bbt_query;
	}else{
		struct database_sqlite_TSQLiteResultSet_obj* bbt_2[]={bbt_query};
		BBARRAY bbt_3 = bbArrayFromData(":TSQLiteResultSet",1,bbt_2);
		o->_database_sqlite_tdbsqlite_queries =bbArrayConcat(":TSQLiteResultSet",o->_database_sqlite_tdbsqlite_queries ,bbt_3);
	}
}
void _database_sqlite_TDBSQLite_removeQuery_TTSQLiteResultSet(struct database_sqlite_TDBSQLite_obj* o,struct database_sqlite_TSQLiteResultSet_obj* bbt_query){
	{
		BBINT bbt_i=0;
		BBINT bbt_=(o->_database_sqlite_tdbsqlite_queries ->scales[0]);
		for(;(bbt_i<bbt_);bbt_i=(bbt_i+1)){
			if(((struct database_sqlite_TSQLiteResultSet_obj*)((struct database_sqlite_TSQLiteResultSet_obj**)BBARRAYDATA(o->_database_sqlite_tdbsqlite_queries ,1))[((BBUINT)bbt_i)])==bbt_query){
				((struct database_sqlite_TSQLiteResultSet_obj**)BBARRAYDATA(o->_database_sqlite_tdbsqlite_queries ,1))[((BBUINT)bbt_i)]=(struct database_sqlite_TSQLiteResultSet_obj*)&bbNullObject;
				break;
			}
		}
	}
}
void _database_sqlite_TDBSQLite_addUser_SSi(struct database_sqlite_TDBSQLite_obj* o,BBSTRING bbt_username,BBSTRING bbt_password,BBINT bbt_isAdmin){
	if(bbt_username!= &bbEmptyString){
		BBBYTE* bbt_n=bbStringToUTF8String((BBSTRING)bbt_username);
		BBBYTE* bbt_p=0;
		BBINT bbt_plen=0;
		if(bbt_password!= &bbEmptyString){
			bbt_p=bbStringToUTF8String((BBSTRING)bbt_password);
			bbt_plen=strlen(bbt_p);
		}
		BBINT bbt_res=sqlite3_user_add(o->_database_core_tdbconnection_handle ,bbt_n,bbt_p,bbt_plen,bbt_isAdmin);
		if(bbt_p){
			bbMemFree((void*)bbt_p);
		}
		bbMemFree((void*)bbt_n);
		if(bbt_res!=0){
			((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s47),(&bbEmptyString),2,bbt_res);
		}
	}
}
void _database_sqlite_TDBSQLite_modifyUser_SSi(struct database_sqlite_TDBSQLite_obj* o,BBSTRING bbt_username,BBSTRING bbt_password,BBINT bbt_isAdmin){
	if(bbt_username!= &bbEmptyString){
		BBBYTE* bbt_n=bbStringToUTF8String((BBSTRING)bbt_username);
		BBBYTE* bbt_p=0;
		BBINT bbt_plen=0;
		if(bbt_password!= &bbEmptyString){
			bbt_p=bbStringToUTF8String((BBSTRING)bbt_password);
			bbt_plen=strlen(bbt_p);
		}
		BBINT bbt_res=sqlite3_user_change(o->_database_core_tdbconnection_handle ,bbt_n,bbt_p,bbt_plen,bbt_isAdmin);
		if(bbt_p){
			bbMemFree((void*)bbt_p);
		}
		bbMemFree((void*)bbt_n);
		if(bbt_res!=0){
			((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s48),(&bbEmptyString),2,bbt_res);
		}
	}
}
void _database_sqlite_TDBSQLite_deleteUser_S(struct database_sqlite_TDBSQLite_obj* o,BBSTRING bbt_username){
	if(bbt_username!= &bbEmptyString){
		BBBYTE* bbt_n=bbStringToUTF8String((BBSTRING)bbt_username);
		BBINT bbt_res=sqlite3_user_delete(o->_database_core_tdbconnection_handle ,bbt_n);
		bbMemFree((void*)bbt_n);
		if(bbt_res!=0){
			((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s49),(&bbEmptyString),2,bbt_res);
		}
	}
}
struct BBDebugScope_22 database_sqlite_TDBSQLite_scope ={
	BBDEBUGSCOPE_USERTYPE,
	"TDBSQLite",
	{
		{
			BBDEBUGDECL_FIELD,
			"queries",
			"[]:TSQLiteResultSet",
			.field_offset=offsetof(struct database_sqlite_TDBSQLite_obj,_database_sqlite_tdbsqlite_queries)
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"New",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_New
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"Create",
			"($,$,i,$,$,$,$):TDBConnection",
			.func_ptr=(BBFuncPtr)&database_sqlite_TDBSQLite_Create_TTDBConnection_SSiSSSS
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"close",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_close
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"commit",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_commit
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"getTables",
			"()[]$",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_getTables
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"getTableInfo",
			"($,i):TDBTable",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_getTableInfo_Si
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"open",
			"($,$)i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_open_SS
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"rollback",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_rollback
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"startTransaction",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_startTransaction
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"databaseHandle",
			"()*b",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_databaseHandle
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"createResultSet",
			"():TQueryResultSet",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_createResultSet
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"nativeErrorMessage",
			"(i)$",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_nativeErrorMessage_i
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"hasPrepareSupport",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_hasPrepareSupport
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"hasTransactionSupport",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_hasTransactionSupport
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"clearQueries",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_clearQueries
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"resetQueries",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_resetQueries
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"addQuery",
			"(:TSQLiteResultSet)",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_addQuery_TTSQLiteResultSet
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"removeQuery",
			"(:TSQLiteResultSet)",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_removeQuery_TTSQLiteResultSet
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"addUser",
			"($,$,i)",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_addUser_SSi
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"modifyUser",
			"($,$,i)",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_modifyUser_SSi
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"deleteUser",
			"($)",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TDBSQLite_deleteUser_S
		},
		{
			BBDEBUGDECL_END
		}
	}
};
struct BBClass_database_sqlite_TDBSQLite database_sqlite_TDBSQLite={
	&database_core_TDBConnection,
	bbObjectFree,
	(BBDebugScope*)&database_sqlite_TDBSQLite_scope,
	sizeof(struct database_sqlite_TDBSQLite_obj),
	(void (*)(BBOBJECT))_database_sqlite_TDBSQLite_New,
	(void (*)(BBOBJECT))_database_sqlite_TDBSQLite_Delete,
	bbObjectToString,
	bbObjectCompare,
	bbObjectSendMessage,
	0,
	0,
	sizeof(BBARRAY)
	,0
	,offsetof(struct database_sqlite_TDBSQLite_obj,_database_sqlite_tdbsqlite_queries)
	,database_sqlite_TDBSQLite_Create_TTDBConnection_SSiSSSS
	,_database_core_TDBConnection_Init_SSiSSSS
	,_database_sqlite_TDBSQLite_close
	,_database_sqlite_TDBSQLite_commit
	,_database_sqlite_TDBSQLite_getTables
	,_database_sqlite_TDBSQLite_getTableInfo_Si
	,_database_sqlite_TDBSQLite_open_SS
	,_database_sqlite_TDBSQLite_rollback
	,_database_sqlite_TDBSQLite_startTransaction
	,_database_core_TDBConnection_executeQuery_S
	,_database_core_TDBConnection_isOpen
	,_database_core_TDBConnection_getDatabaseName
	,_database_core_TDBConnection_getHost
	,_database_core_TDBConnection_getPortNumber
	,_database_core_TDBConnection_error
	,_database_core_TDBConnection_resetError
	,_database_core_TDBConnection_hasError
	,_database_core_TDBConnection_setError_SSii
	,_database_sqlite_TDBSQLite_databaseHandle
	,_database_sqlite_TDBSQLite_createResultSet
	,_database_sqlite_TDBSQLite_nativeErrorMessage_i
	,_database_sqlite_TDBSQLite_hasPrepareSupport
	,_database_sqlite_TDBSQLite_hasTransactionSupport
	,_database_core_TDBConnection_free
	,_database_sqlite_TDBSQLite_clearQueries
	,_database_sqlite_TDBSQLite_resetQueries
	,_database_sqlite_TDBSQLite_addQuery_TTSQLiteResultSet
	,_database_sqlite_TDBSQLite_removeQuery_TTSQLiteResultSet
	,_database_sqlite_TDBSQLite_addUser_SSi
	,_database_sqlite_TDBSQLite_modifyUser_SSi
	,_database_sqlite_TDBSQLite_deleteUser_S
};

void _database_sqlite_TSQLiteResultSet_New(struct database_sqlite_TSQLiteResultSet_obj* o) {
	_database_core_TQueryResultSet_New((struct database_core_TQueryResultSet_obj*)o);
	o->clas = &database_sqlite_TSQLiteResultSet;
	o->_database_sqlite_tsqliteresultset_initialfetch = 1;
	o->_database_sqlite_tsqliteresultset_fakefirstrowfetch = 0;
}
void _database_sqlite_TSQLiteResultSet_Delete(struct database_sqlite_TSQLiteResultSet_obj* o) {
	((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_free((struct database_sqlite_TSQLiteResultSet_obj*)o);
	_database_core_TQueryResultSet_Delete((struct database_core_TQueryResultSet_obj*)o);
}
void _database_sqlite_TSQLiteResultSet_free(struct database_sqlite_TSQLiteResultSet_obj* o){
	struct database_sqlite_TDBSQLite_obj* bbt_;
	(((struct database_sqlite_TDBSQLite_obj*)(bbt_ = ((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)o->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))))->clas)->m_removeQuery_TTSQLiteResultSet((struct database_sqlite_TDBSQLite_obj*)bbt_,(struct database_sqlite_TSQLiteResultSet_obj*)o);
	if(o->_database_core_tqueryresultset_stmthandle ){
		sqlite3_finalize(o->_database_core_tqueryresultset_stmthandle );
		o->_database_core_tqueryresultset_stmthandle =0;
	}
}
void _database_sqlite_TSQLiteResultSet_reset(struct database_sqlite_TSQLiteResultSet_obj* o){
	o->_database_sqlite_tsqliteresultset_initialfetch =1;
	o->_database_core_tqueryresultset_index =-1;
	if(o->_database_core_tqueryresultset_stmthandle ){
		sqlite3_reset(o->_database_core_tqueryresultset_stmthandle );
	}
}
struct database_core_TQueryResultSet_obj* database_sqlite_TSQLiteResultSet_Create_TTQueryResultSet_TTDBConnectionS(struct database_core_TDBConnection_obj* bbt_db,BBSTRING bbt_sql){
	struct database_sqlite_TSQLiteResultSet_obj* bbt_this=(struct database_sqlite_TSQLiteResultSet_obj*)(struct database_sqlite_TSQLiteResultSet_obj*)bbObjectNew((BBClass *)&database_sqlite_TSQLiteResultSet);
	(bbt_this)->clas->m_Init_TTDBConnectionS((struct database_core_TQueryResultSet_obj*)bbt_this,(struct database_core_TDBConnection_obj*)bbt_db,bbt_sql);
	bbt_this->_database_core_tqueryresultset_rec =(struct database_core_TQueryRecord_obj*)database_core_TQueryRecord_Create_TTQueryRecord();
	struct database_sqlite_TDBSQLite_obj* bbt_;
	(((struct database_sqlite_TDBSQLite_obj*)(bbt_ = ((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)bbt_this->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))))->clas)->m_addQuery_TTSQLiteResultSet((struct database_sqlite_TDBSQLite_obj*)bbt_,(struct database_sqlite_TSQLiteResultSet_obj*)bbt_this);
	return (struct database_core_TQueryResultSet_obj*)((struct database_core_TQueryResultSet_obj*)bbObjectDowncast((BBOBJECT)bbt_this,(BBClass*)&database_core_TQueryResultSet));
}
BBINT _database_sqlite_TSQLiteResultSet_executeQuery_S(struct database_sqlite_TSQLiteResultSet_obj* o,BBSTRING bbt_statement){
	if(!(((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_prepare_S((struct database_sqlite_TSQLiteResultSet_obj*)o,bbt_statement)!=0)){
		return 0;
	}
	return ((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_execute((struct database_sqlite_TSQLiteResultSet_obj*)o);
}
void _database_sqlite_TSQLiteResultSet_cleanup(struct database_sqlite_TSQLiteResultSet_obj* o){
	o->_database_core_tqueryresultset_index =-1;
	o->_database_sqlite_tsqliteresultset_initialfetch =1;
	((struct database_core_TQueryResultSet_obj*)o)->clas->m_clear((struct database_core_TQueryResultSet_obj*)o);
	((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_free((struct database_sqlite_TSQLiteResultSet_obj*)o);
}
BBINT _database_sqlite_TSQLiteResultSet_prepare_S(struct database_sqlite_TSQLiteResultSet_obj* o,BBSTRING bbt_stmt){
	if(!(((BBObject*)o->_database_core_tqueryresultset_conn )!= &bbNullObject) || !((o->_database_core_tqueryresultset_conn )->clas->m_isOpen((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn )!=0)){
		return 0;
	}
	((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_cleanup((struct database_sqlite_TSQLiteResultSet_obj*)o);
	struct database_sqlite_TDBSQLite_obj* bbt_;
	(((struct database_sqlite_TDBSQLite_obj*)(bbt_ = ((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)o->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))))->clas)->m_addQuery_TTSQLiteResultSet((struct database_sqlite_TDBSQLite_obj*)bbt_,(struct database_sqlite_TSQLiteResultSet_obj*)o);
	if(!(o->_database_core_tqueryresultset_query != &bbEmptyString)){
		o->_database_core_tqueryresultset_query =bbt_stmt;
	}
	BBBYTE* bbt_q=bbStringToUTF8String((BBSTRING)o->_database_core_tqueryresultset_query );
	BBINT bbt_result=sqlite3_prepare_v2(((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)o->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))->_database_core_tdbconnection_handle ,bbt_q,strlen(bbt_q),((BBBYTE**)(&o->_database_core_tqueryresultset_stmthandle )),0);
	bbMemFree((void*)bbt_q);
	if(bbt_result!=0){
		(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,((BBString*)&_s50),bbStringFromUTF8String(sqlite3_errmsg(((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)o->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))->_database_core_tdbconnection_handle )),3,bbt_result);
		((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_free((struct database_sqlite_TSQLiteResultSet_obj*)o);
		return 0;
	}
	return 1;
}
BBINT _database_sqlite_TSQLiteResultSet_execute(struct database_sqlite_TSQLiteResultSet_obj* o){
	o->_database_sqlite_tsqliteresultset_fakefirstrowfetch =0;
	BBINT bbt_result=sqlite3_reset(o->_database_core_tqueryresultset_stmthandle );
	if(bbt_result!=0){
		(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,((BBString*)&_s51),bbStringFromUTF8String(sqlite3_errmsg(((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)o->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))->_database_core_tdbconnection_handle )),3,bbt_result);
		((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_free((struct database_sqlite_TSQLiteResultSet_obj*)o);
		return 0;
	}
	BBARRAY bbt_values=o->_database_core_tqueryresultset_boundvalues ;
	BBINT bbt_paramCount=sqlite3_bind_parameter_count(o->_database_core_tqueryresultset_stmthandle );
	if(bbt_paramCount==o->_database_core_tqueryresultset_bindcount ){
		{
			BBINT bbt_i=0;
			BBINT bbt_=bbt_paramCount;
			for(;(bbt_i<bbt_);bbt_i=(bbt_i+1)){
				bbt_result=0;
				struct database_core_dbtypes_TDBType_obj* bbt_2;
				if(!(((BBObject*)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])!= &bbNullObject) || (((bbt_2 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_isNull((struct database_core_dbtypes_TDBType_obj*)bbt_2)!=0)){
					bbt_result=sqlite3_bind_null(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1));
				}else{
					struct database_core_dbtypes_TDBType_obj* bbt_4;
					BBINT bbt_3=((bbt_4 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_kind((struct database_core_dbtypes_TDBType_obj*)bbt_4);
					if(bbt_3==2){
						struct database_core_dbtypes_TDBType_obj* bbt_5;
						bbt_result=sqlite3_bind_int(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1),((bbt_5 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getInt((struct database_core_dbtypes_TDBType_obj*)bbt_5));
					}else{
						if(bbt_3==4){
							struct database_core_dbtypes_TDBType_obj* bbt_6;
							bbt_result=sqlite3_bind_double(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1),((BBDOUBLE)((bbt_6 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getFloat((struct database_core_dbtypes_TDBType_obj*)bbt_6)));
						}else{
							if(bbt_3==3){
								struct database_core_dbtypes_TDBType_obj* bbt_7;
								bbt_result=sqlite3_bind_double(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1),((bbt_7 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getDouble((struct database_core_dbtypes_TDBType_obj*)bbt_7));
							}else{
								if(bbt_3==5){
									struct database_core_dbtypes_TDBType_obj* bbt_8;
									bbt_result=sqlite3_bind_int64(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1),((bbt_8 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getLong((struct database_core_dbtypes_TDBType_obj*)bbt_8));
								}else{
									if(bbt_3==1){
										struct database_core_dbtypes_TDBType_obj* bbt_9;
										BBBYTE* bbt_s=bbStringToUTF8String((BBSTRING)((bbt_9 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getString((struct database_core_dbtypes_TDBType_obj*)bbt_9));
										bbt_result=bmx_sqlite3_bind_text64(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1),bbt_s,((BBLONG)strlen(bbt_s)),-1);
										bbMemFree((void*)bbt_s);
									}else{
										if(bbt_3==7){
											struct database_core_dbtypes_TDBType_obj* bbt_10;
											struct database_core_dbtypes_TDBType_obj* bbt_11;
											bbt_result=bmx_sqlite3_bind_blob64(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1),((bbt_10 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getBlob((struct database_core_dbtypes_TDBType_obj*)bbt_10),((BBLONG)((bbt_11 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_size((struct database_core_dbtypes_TDBType_obj*)bbt_11)),0);
										}else{
											if(((bbt_3==6) || (bbt_3==8)) || (bbt_3==9)){
												struct database_core_dbtypes_TDBType_obj* bbt_12;
												BBBYTE* bbt_s2=bbStringToUTF8String((BBSTRING)((bbt_12 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getString((struct database_core_dbtypes_TDBType_obj*)bbt_12));
												bbt_result=bmx_sqlite3_bind_text64(o->_database_core_tqueryresultset_stmthandle ,(bbt_i+1),bbt_s2,((BBLONG)strlen(bbt_s2)),-1);
												bbMemFree((void*)bbt_s2);
											}
										}
									}
								}
							}
						}
					}
				}
				if(bbt_result!=0){
					sqlite3_reset(o->_database_core_tqueryresultset_stmthandle );
					(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,bbStringConcat(bbStringConcat(((BBString*)&_s52),bbStringFromInt(bbt_i)),((BBString*)&_s6)),bbStringFromUTF8String(sqlite3_errmsg(((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)o->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))->_database_core_tdbconnection_handle )),3,bbt_result);
					((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_free((struct database_sqlite_TSQLiteResultSet_obj*)o);
					return 0;
				}
			}
		}
	}else{
		(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,((BBString*)&_s53),(&bbEmptyString),3,0);
		((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_free((struct database_sqlite_TSQLiteResultSet_obj*)o);
		return 0;
	}
	((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_nextRow((struct database_sqlite_TSQLiteResultSet_obj*)o);
	struct database_core_TDatabaseError_obj* bbt_13;
	if((bbt_13 = (o->_database_core_tqueryresultset_conn )->clas->m_error((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ))->clas->m_isSet((struct database_core_TDatabaseError_obj*)bbt_13)!=0){
		o->_database_core_tqueryresultset__isactive =0;
		return 0;
	}
	o->_database_core_tqueryresultset__isactive =1;
	return 1;
}
BBINT _database_sqlite_TSQLiteResultSet_firstRow(struct database_sqlite_TSQLiteResultSet_obj* o){
	if(o->_database_core_tqueryresultset_index ==-1){
		return ((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_nextRow((struct database_sqlite_TSQLiteResultSet_obj*)o);
	}
	return 0;
}
BBINT _database_sqlite_TSQLiteResultSet_nextRow(struct database_sqlite_TSQLiteResultSet_obj* o){
	if(o->_database_sqlite_tsqliteresultset_fakefirstrowfetch !=0){
		o->_database_sqlite_tsqliteresultset_fakefirstrowfetch =0;
		return 1;
	}
	if(o->_database_sqlite_tsqliteresultset_initialfetch !=0){
		o->_database_sqlite_tsqliteresultset_fakefirstrowfetch =1;
		o->_database_sqlite_tsqliteresultset_initialfetch =0;
	}
	BBINT bbt_result=sqlite3_step(o->_database_core_tqueryresultset_stmthandle );
	BBINT bbt_=bbt_result;
	if(bbt_==100){
		if((o->_database_core_tqueryresultset_rec )->clas->m_isEmpty((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec )!=0){
			((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_initRecord((struct database_sqlite_TSQLiteResultSet_obj*)o);
			((struct database_core_TQueryResultSet_obj*)o)->clas->m_resetValues_i((struct database_core_TQueryResultSet_obj*)o,(o->_database_core_tqueryresultset_rec )->clas->m_count((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec ));
		}
		{
			BBINT bbt_i=0;
			BBINT bbt_2=(o->_database_core_tqueryresultset_rec )->clas->m_count((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec );
			for(;(bbt_i<bbt_2);bbt_i=(bbt_i+1)){
				if(((BBObject*)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)])!= &bbNullObject){
					struct database_core_dbtypes_TDBType_obj* bbt_3;
					((bbt_3 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)])->clas)->m_clear((struct database_core_dbtypes_TDBType_obj*)bbt_3);
				}
				BBINT bbt_4=sqlite3_column_type(o->_database_core_tqueryresultset_stmthandle ,bbt_i);
				if(bbt_4==1){
					((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)]=(struct database_core_dbtypes_TDBType_obj*)((struct database_core_dbtypes_TDBType_obj*)bbObjectDowncast((BBOBJECT)(struct database_core_dbtypes_TDBLong_obj*)bbObjectAtomicNew((BBClass *)&database_core_dbtypes_TDBLong),(BBClass*)&database_core_dbtypes_TDBType));
					BBLONG bbt_lvalue=0LL;
					bmx_sqlite3_column_int64(o->_database_core_tqueryresultset_stmthandle ,bbt_i,(&bbt_lvalue));
					struct database_core_dbtypes_TDBType_obj* bbt_5;
					((bbt_5 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)])->clas)->m_setLong_l((struct database_core_dbtypes_TDBType_obj*)bbt_5,bbt_lvalue);
				}else{
					if(bbt_4==2){
						((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)]=(struct database_core_dbtypes_TDBType_obj*)((struct database_core_dbtypes_TDBType_obj*)bbObjectDowncast((BBOBJECT)(struct database_core_dbtypes_TDBDouble_obj*)bbObjectAtomicNew((BBClass *)&database_core_dbtypes_TDBDouble),(BBClass*)&database_core_dbtypes_TDBType));
						struct database_core_dbtypes_TDBType_obj* bbt_6;
						((bbt_6 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)])->clas)->m_setDouble_d((struct database_core_dbtypes_TDBType_obj*)bbt_6,sqlite3_column_double(o->_database_core_tqueryresultset_stmthandle ,bbt_i));
					}else{
						if(bbt_4==5){
						}else{
							if(bbt_4==4){
								((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)]=(struct database_core_dbtypes_TDBType_obj*)((struct database_core_dbtypes_TDBType_obj*)bbObjectDowncast((BBOBJECT)(struct database_core_dbtypes_TDBBlob_obj*)bbObjectAtomicNew((BBClass *)&database_core_dbtypes_TDBBlob),(BBClass*)&database_core_dbtypes_TDBType));
								struct database_core_dbtypes_TDBType_obj* bbt_7;
								((bbt_7 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)])->clas)->m_setBlob_pbii((struct database_core_dbtypes_TDBType_obj*)bbt_7,sqlite3_column_blob(o->_database_core_tqueryresultset_stmthandle ,bbt_i),sqlite3_column_bytes(o->_database_core_tqueryresultset_stmthandle ,bbt_i),1);
							}else{
								((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)]=(struct database_core_dbtypes_TDBType_obj*)((struct database_core_dbtypes_TDBType_obj*)bbObjectDowncast((BBOBJECT)(struct database_core_dbtypes_TDBString_obj*)bbObjectNew((BBClass *)&database_core_dbtypes_TDBString),(BBClass*)&database_core_dbtypes_TDBType));
								struct database_core_dbtypes_TDBType_obj* bbt_8;
								((bbt_8 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)])->clas)->m_setString_S((struct database_core_dbtypes_TDBType_obj*)bbt_8,database_core_sizedUTF8toISO8859(sqlite3_column_text(o->_database_core_tqueryresultset_stmthandle ,bbt_i),sqlite3_column_bytes(o->_database_core_tqueryresultset_stmthandle ,bbt_i)));
							}
						}
					}
				}
			}
		}
		o->_database_core_tqueryresultset_index +=1;
		return 1;
	}else{
		if(bbt_==101){
			if((o->_database_core_tqueryresultset_rec )->clas->m_isEmpty((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec )!=0){
				((struct database_sqlite_TSQLiteResultSet_obj*)o)->clas->m_initRecord((struct database_sqlite_TSQLiteResultSet_obj*)o);
				((struct database_core_TQueryResultSet_obj*)o)->clas->m_resetValues_i((struct database_core_TQueryResultSet_obj*)o,(o->_database_core_tqueryresultset_rec )->clas->m_count((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec ));
				(o->_database_core_tqueryresultset_rec )->clas->m_setIsEmptySet((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec );
			}
			o->_database_sqlite_tsqliteresultset_fakefirstrowfetch =0;
			sqlite3_reset(o->_database_core_tqueryresultset_stmthandle );
			return 0;
		}else{
			sqlite3_reset(o->_database_core_tqueryresultset_stmthandle );
			(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,bbStringFromUTF8String(sqlite3_errmsg(((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)o->_database_core_tqueryresultset_conn ,(BBClass*)&database_sqlite_TDBSQLite))->_database_core_tdbconnection_handle )),(&bbEmptyString),3,bbt_result);
			return 0;
		}
	}
}
void _database_sqlite_TSQLiteResultSet_initRecord(struct database_sqlite_TSQLiteResultSet_obj* o){
	(o->_database_core_tqueryresultset_rec )->clas->m_clear((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec );
	BBINT bbt_colCount=sqlite3_column_count(o->_database_core_tqueryresultset_stmthandle );
	if(bbt_colCount<=0){
		return;
	}
	(o->_database_core_tqueryresultset_rec )->clas->m_Init_i((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec ,bbt_colCount);
	{
		BBINT bbt_i=0;
		BBINT bbt_=bbt_colCount;
		for(;(bbt_i<bbt_);bbt_i=(bbt_i+1)){
			BBSTRING bbt_columnName=bbStringFromUTF8String(sqlite3_column_name(o->_database_core_tqueryresultset_stmthandle ,bbt_i));
			BBBYTE* bbt_tn=sqlite3_column_decltype(o->_database_core_tqueryresultset_stmthandle ,bbt_i);
			BBSTRING bbt_typeName=((BBString*)&bbEmptyString);
			if(bbt_tn){
				bbt_typeName=bbStringFromUTF8String(bbt_tn);
			}
			BBINT bbt_dotPosition=(bbStringFindLast((BBSTRING)bbt_columnName,((BBString*)&_s54),0)+1);
			(o->_database_core_tqueryresultset_rec )->clas->m_setField_iTTQueryField((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec ,bbt_i,(struct database_core_TQueryField_obj*)database_core_TQueryField_Create_TTQueryField_Si(bbStringSlice(bbt_columnName,bbt_dotPosition,(bbt_columnName)->length),o->clas->f_dbTypeFromNative_i_Sii(bbt_typeName,0,0)));
		}
	}
}
BBINT database_sqlite_TSQLiteResultSet_dbTypeFromNative_i_Sii(BBSTRING bbt_name,BBINT bbt__type,BBINT bbt__flags){
	bbt_name=bbStringToLower((BBSTRING)bbt_name);
	if(bbStringStartsWith((BBSTRING)bbt_name,((BBString*)&_s55))!=0){
		return 3;
	}
	BBSTRING bbt_=bbt_name;
	if(bbStringEquals(bbt_, ((BBString*)&_s56))==1){
		return 5;
	}else{
		if(bbStringEquals(bbt_, ((BBString*)&_s57))==1){
			return 5;
		}else{
			if(bbStringEquals(bbt_, ((BBString*)&_s58))==1){
				return 3;
			}else{
				if(bbStringEquals(bbt_, ((BBString*)&_s59))==1){
					return 3;
				}else{
					if(bbStringEquals(bbt_, ((BBString*)&_s60))==1){
						return 7;
					}else{
						return 1;
					}
				}
			}
		}
	}
}
BBLONG _database_sqlite_TSQLiteResultSet_lastInsertedId(struct database_sqlite_TSQLiteResultSet_obj* o){
	if(((struct database_core_TQueryResultSet_obj*)o)->clas->m_isActive((struct database_core_TQueryResultSet_obj*)o)!=0){
		BBLONG bbt_id=0LL;
		bmx_sqlite3_last_insert_rowid(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle ,(&bbt_id));
		return bbt_id;
	}
	return 0LL;
}
BBINT _database_sqlite_TSQLiteResultSet_rowsAffected(struct database_sqlite_TSQLiteResultSet_obj* o){
	if(((struct database_core_TQueryResultSet_obj*)o)->clas->m_isActive((struct database_core_TQueryResultSet_obj*)o)!=0){
		return sqlite3_changes(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle );
	}
	return -1;
}
struct BBDebugScope_16 database_sqlite_TSQLiteResultSet_scope ={
	BBDEBUGSCOPE_USERTYPE,
	"TSQLiteResultSet",
	{
		{
			BBDEBUGDECL_FIELD,
			"initialFetch",
			"i",
			.field_offset=offsetof(struct database_sqlite_TSQLiteResultSet_obj,_database_sqlite_tsqliteresultset_initialfetch)
		},
		{
			BBDEBUGDECL_FIELD,
			"fakeFirstRowFetch",
			"i",
			.field_offset=offsetof(struct database_sqlite_TSQLiteResultSet_obj,_database_sqlite_tsqliteresultset_fakefirstrowfetch)
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"New",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_New
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"free",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_free
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"reset",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_reset
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"Create",
			"(:TDBConnection,$):TQueryResultSet",
			.func_ptr=(BBFuncPtr)&database_sqlite_TSQLiteResultSet_Create_TTQueryResultSet_TTDBConnectionS
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"executeQuery",
			"($)i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_executeQuery_S
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"cleanup",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_cleanup
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"prepare",
			"($)i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_prepare_S
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"execute",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_execute
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"firstRow",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_firstRow
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"nextRow",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_nextRow
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"initRecord",
			"()",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_initRecord
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"dbTypeFromNative",
			"($,i,i)i",
			.func_ptr=(BBFuncPtr)&database_sqlite_TSQLiteResultSet_dbTypeFromNative_i_Sii
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"lastInsertedId",
			"()l",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_lastInsertedId
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"rowsAffected",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_sqlite_TSQLiteResultSet_rowsAffected
		},
		{
			BBDEBUGDECL_END
		}
	}
};
struct BBClass_database_sqlite_TSQLiteResultSet database_sqlite_TSQLiteResultSet={
	&database_core_TQueryResultSet,
	bbObjectFree,
	(BBDebugScope*)&database_sqlite_TSQLiteResultSet_scope,
	sizeof(struct database_sqlite_TSQLiteResultSet_obj),
	(void (*)(BBOBJECT))_database_sqlite_TSQLiteResultSet_New,
	(void (*)(BBOBJECT))_database_sqlite_TSQLiteResultSet_Delete,
	bbObjectToString,
	bbObjectCompare,
	bbObjectSendMessage,
	0,
	0,
	offsetof(struct database_sqlite_TSQLiteResultSet_obj,_database_sqlite_tsqliteresultset_fakefirstrowfetch) - offsetof(struct database_sqlite_TSQLiteResultSet_obj,_database_sqlite_tsqliteresultset_initialfetch) + sizeof(BBINT)
	,0
	,offsetof(struct database_sqlite_TSQLiteResultSet_obj,_database_sqlite_tsqliteresultset_initialfetch)
	,database_sqlite_TSQLiteResultSet_Create_TTQueryResultSet_TTDBConnectionS
	,_database_core_TQueryResultSet_Init_TTDBConnectionS
	,_database_core_TQueryResultSet_clearBindValues
	,_database_core_TQueryResultSet_clear
	,_database_sqlite_TSQLiteResultSet_executeQuery_S
	,_database_sqlite_TSQLiteResultSet_prepare_S
	,_database_sqlite_TSQLiteResultSet_execute
	,_database_sqlite_TSQLiteResultSet_firstRow
	,_database_sqlite_TSQLiteResultSet_nextRow
	,_database_sqlite_TSQLiteResultSet_lastInsertedId
	,_database_sqlite_TSQLiteResultSet_rowsAffected
	,database_sqlite_TSQLiteResultSet_dbTypeFromNative_i_Sii
	,_database_core_TQueryResultSet_rowRecord
	,_database_core_TQueryResultSet_dataValue_i
	,_database_core_TQueryResultSet_rowIndex
	,_database_core_TQueryResultSet_setRowIndex_i
	,_database_core_TQueryResultSet_isActive
	,_database_core_TQueryResultSet_isValid
	,_database_core_TQueryResultSet_resetValues_i
	,_database_core_TQueryResultSet_resetBindCount
	,_database_core_TQueryResultSet_addBindValue_TTDBType
	,_database_core_TQueryResultSet_bindValue_iTTDBType
	,_database_sqlite_TSQLiteResultSet_reset
	,_database_sqlite_TSQLiteResultSet_free
	,_database_sqlite_TSQLiteResultSet_cleanup
	,_database_sqlite_TSQLiteResultSet_initRecord
};

BBINT database_sqlite_loadOrSaveDB(struct database_sqlite_TDBSQLite_obj* bbt_inMemory,BBSTRING bbt_filename,BBINT bbt_isSave,BBSTRING bbt_database){
	struct database_sqlite_TDBSQLite_obj* bbt_db=(struct database_sqlite_TDBSQLite_obj*)((struct database_sqlite_TDBSQLite_obj*)bbObjectDowncast((BBOBJECT)database_sqlite_TDBSQLite_Create_TTDBConnection_SSiSSSS(bbt_filename,(&bbEmptyString),0,(&bbEmptyString),(&bbEmptyString),(&bbEmptyString),(&bbEmptyString)),(BBClass*)&database_sqlite_TDBSQLite));
	BBINT bbt_rc=0;
	if((bbt_db)->clas->m_isOpen((struct database_core_TDBConnection_obj*)bbt_db)!=0){
		BBBYTE* bbt_toHandle=0;
		BBBYTE* bbt_fromHandle=0;
		if(bbt_isSave!=0){
			bbt_fromHandle=bbt_inMemory->_database_core_tdbconnection_handle ;
			bbt_toHandle=bbt_db->_database_core_tdbconnection_handle ;
		}else{
			bbt_fromHandle=bbt_db->_database_core_tdbconnection_handle ;
			bbt_toHandle=bbt_inMemory->_database_core_tdbconnection_handle ;
		}
		BBBYTE* bbt_d=bbStringToUTF8String((BBSTRING)bbt_database);
		BBBYTE* bbt_backup=sqlite3_backup_init(bbt_toHandle,bbt_d,bbt_fromHandle,bbt_d);
		if(bbt_backup){
			sqlite3_backup_step(bbt_backup,-1);
			sqlite3_backup_finish(bbt_backup);
		}
		bbt_rc=sqlite3_errcode(bbt_toHandle);
		(bbt_db)->clas->m_close((struct database_sqlite_TDBSQLite_obj*)bbt_db);
	}else{
		if((bbt_db)->clas->m_hasError((struct database_core_TDBConnection_obj*)bbt_db)!=0){
			bbt_rc=(bbt_db)->clas->m_error((struct database_core_TDBConnection_obj*)bbt_db)->_database_core_tdatabaseerror_errorvalue ;
		}
	}
	return bbt_rc;
}
static int __bb_database_sqlite_sqlite_inited = 0;
int __bb_database_sqlite_sqlite(){
	if (!__bb_database_sqlite_sqlite_inited) {
		__bb_database_sqlite_sqlite_inited = 1;
		__bb_brl_blitz_blitz();
		__bb_database_core_core();
		_bb_database_sqlite_common();
		bbObjectRegisterType((BBCLASS)&database_sqlite_TSQLiteDatabaseLoader);
		bbObjectRegisterType((BBCLASS)&database_sqlite_TDBSQLite);
		bbObjectRegisterType((BBCLASS)&database_sqlite_TSQLiteResultSet);
		database_core_AddDatabaseLoader((struct database_core_TDatabaseLoader_obj*)((struct database_core_TDatabaseLoader_obj*)bbObjectDowncast((BBOBJECT)(struct database_sqlite_TSQLiteDatabaseLoader_obj*)bbObjectNew((BBClass *)&database_sqlite_TSQLiteDatabaseLoader),(BBClass*)&database_core_TDatabaseLoader)));
		return 0;
	}
	return 0;
}