#include <database.mod/postgresql.mod/.bmx/postgresql.bmx.release.win32.x64.h>
struct BBString_1{BBClass_String* clas;BBULONG hash;int length;BBChar buf[1];};
struct BBString_5{BBClass_String* clas;BBULONG hash;int length;BBChar buf[5];};
struct BBString_6{BBClass_String* clas;BBULONG hash;int length;BBChar buf[6];};
struct BBString_12{BBClass_String* clas;BBULONG hash;int length;BBChar buf[12];};
struct BBString_28{BBClass_String* clas;BBULONG hash;int length;BBChar buf[28];};
struct BBString_30{BBClass_String* clas;BBULONG hash;int length;BBChar buf[30];};
struct BBString_34{BBClass_String* clas;BBULONG hash;int length;BBChar buf[34];};
struct BBString_25{BBClass_String* clas;BBULONG hash;int length;BBChar buf[25];};
struct BBString_26{BBClass_String* clas;BBULONG hash;int length;BBChar buf[26];};
struct BBString_10{BBClass_String* clas;BBULONG hash;int length;BBChar buf[10];};
struct BBString_8{BBClass_String* clas;BBULONG hash;int length;BBChar buf[8];};
struct BBString_92{BBClass_String* clas;BBULONG hash;int length;BBChar buf[92];};
struct BBString_7{BBClass_String* clas;BBULONG hash;int length;BBChar buf[7];};
struct BBString_9{BBClass_String* clas;BBULONG hash;int length;BBChar buf[9];};
struct BBString_4{BBClass_String* clas;BBULONG hash;int length;BBChar buf[4];};
static struct BBString_1 _s4={
	&bbStringClass,
	0xbbe01a6a523daf15,
	1,
	{10}
};
static struct BBString_1 _s16={
	&bbStringClass,
	0x7c4af187e743bfa6,
	1,
	{34}
};
static struct BBString_1 _s10={
	&bbStringClass,
	0xe7661a0566dadf97,
	1,
	{39}
};
static struct BBString_5 _s13={
	&bbStringClass,
	0xcfcc9b7dad8621a6,
	5,
	{66,69,71,73,78}
};
static struct BBString_6 _s0={
	&bbStringClass,
	0x2af6a1053207f7d7,
	6,
	{67,79,77,77,73,84}
};
static struct BBString_12 _s15={
	&bbStringClass,
	0x6d2b704bc28ae022,
	12,
	{68,69,65,76,76,79,67,65,84,69,32,34}
};
static struct BBString_28 _s1={
	&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_30 _s9={
	&bbStringClass,
	0x7353ccd578ffd426,
	30,
	{69,114,114,111,114,32,99,111,110,110,101,99,116,105,110,103,32
	,116,111,32,100,97,116,97,98,97,115,101,32,39}
};
static struct BBString_34 _s20={
	&bbStringClass,
	0x32f5f682d92778b,
	34,
	{69,114,114,111,114,32,101,120,101,99,117,116,105,110,103,32,112
	,114,101,112,97,114,101,100,32,115,116,97,116,101,109,101,110
	,116}
};
static struct BBString_25 _s17={
	&bbStringClass,
	0x97c2d963e4b94776,
	25,
	{69,114,114,111,114,32,101,120,101,99,117,116,105,110,103,32,115
	,116,97,116,101,109,101,110,116}
};
static struct BBString_25 _s19={
	&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_30 _s12={
	&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 _s14={
	&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_10 _s21={
	&bbStringClass,
	0xfa035337190856a1,
	10,
	{80,79,83,84,71,82,69,83,81,76}
};
static struct BBString_8 _s11={
	&bbStringClass,
	0xa61426338e4547af,
	8,
	{82,79,76,76,66,65,67,75}
};
static struct BBString_92 _s2={
	&bbStringClass,
	0x63b3944770b6c9a7,
	92,
	{83,101,108,101,99,116,32,116,97,98,108,101,110,97,109,101,32
	,102,114,111,109,32,112,103,95,116,97,98,108,101,115,32,119
	,104,101,114,101,32,115,99,104,101,109,97,110,97,109,101,32
	,78,111,116,32,105,110,32,40,39,112,103,95,99,97,116,97
	,108,111,103,39,44,32,39,105,110,102,111,114,109,97,116,105
	,111,110,95,115,99,104,101,109,97,39,41}
};
static struct BBString_7 _s3={
	&bbStringClass,
	0x24e08fd41fea89a0,
	7,
	{100,98,110,97,109,101,61}
};
static struct BBString_5 _s5={
	&bbStringClass,
	0x991b30ba7136f11a,
	5,
	{104,111,115,116,61}
};
static struct BBString_9 _s8={
	&bbStringClass,
	0xbeebd0062440d939,
	9,
	{112,97,115,115,119,111,114,100,61}
};
static struct BBString_5 _s6={
	&bbStringClass,
	0x36b9e7d48b418ba1,
	5,
	{112,111,114,116,61}
};
static struct BBString_4 _s18={
	&bbStringClass,
	0x153254c493f00e18,
	4,
	{112,114,101,112}
};
static struct BBString_5 _s7={
	&bbStringClass,
	0x712441eb9f78b9f5,
	5,
	{117,115,101,114,61}
};
struct BBDebugScope_15{int kind; const char *name; BBDebugDecl decls[16]; };
struct BBDebugScope_17{int kind; const char *name; BBDebugDecl decls[18]; };
struct BBDebugScope_2{int kind; const char *name; BBDebugDecl decls[3]; };
void _database_postgresql_TPostgreSQLDatabaseLoader_New(struct database_postgresql_TPostgreSQLDatabaseLoader_obj* o) {
	_database_core_TDatabaseLoader_New((struct database_core_TDatabaseLoader_obj*)o);
	o->clas = &database_postgresql_TPostgreSQLDatabaseLoader;
	o->_database_core_tdatabaseloader__type =((BBString*)&_s21);
}
struct database_core_TDBConnection_obj* _database_postgresql_TPostgreSQLDatabaseLoader_LoadDatabase_SSiSSSS(struct database_postgresql_TPostgreSQLDatabaseLoader_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_postgresql_TDBPostgreSQL_Create_TTDBConnection_SSiSSSS(bbt_dbname,bbt_host,bbt_port,bbt_user,bbt_password,bbt_server,bbt_options);
}
struct BBDebugScope_2 database_postgresql_TPostgreSQLDatabaseLoader_scope ={
	BBDEBUGSCOPE_USERTYPE,
	"TPostgreSQLDatabaseLoader",
	{
		{
			BBDEBUGDECL_TYPEMETHOD,
			"New",
			"()",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLDatabaseLoader_New
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"LoadDatabase",
			"($,$,i,$,$,$,$):TDBConnection",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLDatabaseLoader_LoadDatabase_SSiSSSS
		},
		{
			BBDEBUGDECL_END
		}
	}
};
struct BBClass_database_postgresql_TPostgreSQLDatabaseLoader database_postgresql_TPostgreSQLDatabaseLoader={
	&database_core_TDatabaseLoader,
	bbObjectFree,
	(BBDebugScope*)&database_postgresql_TPostgreSQLDatabaseLoader_scope,
	sizeof(struct database_postgresql_TPostgreSQLDatabaseLoader_obj),
	(void (*)(BBOBJECT))_database_postgresql_TPostgreSQLDatabaseLoader_New,
	bbObjectDtor,
	bbObjectToString,
	bbObjectCompare,
	bbObjectSendMessage,
	0,
	0,
	0
	,0
	,sizeof(void*)
	,_database_postgresql_TPostgreSQLDatabaseLoader_LoadDatabase_SSiSSSS
};

void _database_postgresql_TDBPostgreSQL_New(struct database_postgresql_TDBPostgreSQL_obj* o) {
	_database_core_TDBConnection_New((struct database_core_TDBConnection_obj*)o);
	o->clas = &database_postgresql_TDBPostgreSQL;
}
void _database_postgresql_TDBPostgreSQL_Delete(struct database_postgresql_TDBPostgreSQL_obj* o) {
	_database_core_TDBConnection_Delete((struct database_core_TDBConnection_obj*)o);
}
struct database_core_TDBConnection_obj* database_postgresql_TDBPostgreSQL_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_postgresql_TDBPostgreSQL_obj* bbt_this=(struct database_postgresql_TDBPostgreSQL_obj*)(struct database_postgresql_TDBPostgreSQL_obj*)bbObjectNew((BBClass *)&database_postgresql_TDBPostgreSQL);
	(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_postgresql_TDBPostgreSQL_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_postgresql_TDBPostgreSQL_close(struct database_postgresql_TDBPostgreSQL_obj* o){
	if(o->_database_core_tdbconnection__isopen !=0){
		if(o->_database_core_tdbconnection_handle ){
			bmx_pgsql_PQfinish(o->_database_core_tdbconnection_handle );
			o->_database_core_tdbconnection_handle =0;
		}
		o->_database_core_tdbconnection__isopen =0;
	}
}
BBINT _database_postgresql_TDBPostgreSQL_isOpen(struct database_postgresql_TDBPostgreSQL_obj* o){
	if(o->_database_core_tdbconnection__isopen !=0){
		if(bmx_pgsql_PQstatus(o->_database_core_tdbconnection_handle )!=0){
			o->_database_core_tdbconnection__isopen =0;
		}
	}
	return o->_database_core_tdbconnection__isopen ;
}
BBINT _database_postgresql_TDBPostgreSQL_commit(struct database_postgresql_TDBPostgreSQL_obj* o){
	if(!(o->_database_core_tdbconnection__isopen !=0) || !(o->_database_core_tdbconnection_handle )){
		return 0;
	}
	BBBYTE* bbt_ = (BBBYTE*)bbStringToCString((BBString*)&_s0);
	BBBYTE* bbt_result=bmx_pgsql_PQexec(o->_database_core_tdbconnection_handle ,bbt_);
	bbMemFree(bbt_);
	if(!(bbt_result) || (bmx_pgsql_PQresultStatus(bbt_result)!=1)){
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s1),database_core_convertUTF8toISO8859(bmx_pgsql_PQerrorMessage(o->_database_core_tdbconnection_handle )),1,0);
		bmx_pgsql_PQclear(bbt_result);
		return 0;
	}
	bmx_pgsql_PQclear(bbt_result);
	return 1;
}
BBARRAY _database_postgresql_TDBPostgreSQL_getTables(struct database_postgresql_TDBPostgreSQL_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*)&_s2);
	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_postgresql_TDBPostgreSQL_getTableInfo_Si(struct database_postgresql_TDBPostgreSQL_obj* o,BBSTRING bbt_tableName,BBINT bbt_withDDL){
	return (struct database_core_TDBTable_obj*)((struct database_core_TDBTable_obj*)&bbNullObject);
}
BBINT _database_postgresql_TDBPostgreSQL_open_SS(struct database_postgresql_TDBPostgreSQL_obj* o,BBSTRING bbt_user,BBSTRING bbt_pass){
	if(o->_database_core_tdbconnection__isopen !=0){
		((struct database_postgresql_TDBPostgreSQL_obj*)o)->clas->m_close((struct database_postgresql_TDBPostgreSQL_obj*)o);
	}
	if(bbt_user!= &bbEmptyString){
		o->_database_core_tdbconnection__user =bbt_user;
	}
	if(bbt_pass!= &bbEmptyString){
		o->_database_core_tdbconnection__password =bbt_pass;
	}
	BBSTRING bbt_connect=((BBString*)&bbEmptyString);
	if(o->_database_core_tdbconnection__dbname != &bbEmptyString){
		bbt_connect=bbStringConcat(bbt_connect,(bbStringConcat(bbStringConcat(((BBString*)&_s3),o->_database_core_tdbconnection__dbname ),((BBString*)&_s4))));
	}
	if(o->_database_core_tdbconnection__host != &bbEmptyString){
		bbt_connect=bbStringConcat(bbt_connect,(bbStringConcat(bbStringConcat(((BBString*)&_s5),o->_database_core_tdbconnection__host ),((BBString*)&_s4))));
	}
	if(o->_database_core_tdbconnection__port !=0){
		bbt_connect=bbStringConcat(bbt_connect,(bbStringConcat(bbStringConcat(((BBString*)&_s6),bbStringFromInt(o->_database_core_tdbconnection__port )),((BBString*)&_s4))));
	}
	if(o->_database_core_tdbconnection__user != &bbEmptyString){
		bbt_connect=bbStringConcat(bbt_connect,(bbStringConcat(bbStringConcat(((BBString*)&_s7),o->_database_core_tdbconnection__user ),((BBString*)&_s4))));
	}
	if(o->_database_core_tdbconnection__password != &bbEmptyString){
		bbt_connect=bbStringConcat(bbt_connect,(bbStringConcat(bbStringConcat(((BBString*)&_s8),o->_database_core_tdbconnection__password ),((BBString*)&_s4))));
	}
	BBBYTE* bbt_ = (BBBYTE*)bbStringToCString(bbt_connect);
	o->_database_core_tdbconnection_handle =bmx_pgsql_PQconnectdb(bbt_);
	bbMemFree(bbt_);
	if(bmx_pgsql_PQstatus(o->_database_core_tdbconnection_handle )!=0){
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,bbStringConcat(bbStringConcat(((BBString*)&_s9),o->_database_core_tdbconnection__dbname ),((BBString*)&_s10)),database_core_convertUTF8toISO8859(bmx_pgsql_PQerrorMessage(o->_database_core_tdbconnection_handle )),2,0);
		return 0;
	}
	o->_database_core_tdbconnection__isopen =1;
	return 1;
}
BBINT _database_postgresql_TDBPostgreSQL_rollback(struct database_postgresql_TDBPostgreSQL_obj* o){
	if(!(o->_database_core_tdbconnection__isopen !=0) || !(o->_database_core_tdbconnection_handle )){
		return 0;
	}
	BBBYTE* bbt_ = (BBBYTE*)bbStringToCString((BBString*)&_s11);
	BBBYTE* bbt_result=bmx_pgsql_PQexec(o->_database_core_tdbconnection_handle ,bbt_);
	bbMemFree(bbt_);
	if(!(bbt_result) || (bmx_pgsql_PQresultStatus(bbt_result)!=1)){
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s12),database_core_convertUTF8toISO8859(bmx_pgsql_PQerrorMessage(o->_database_core_tdbconnection_handle )),1,0);
		bmx_pgsql_PQclear(bbt_result);
		return 0;
	}
	bmx_pgsql_PQclear(bbt_result);
	return 1;
}
BBINT _database_postgresql_TDBPostgreSQL_startTransaction(struct database_postgresql_TDBPostgreSQL_obj* o){
	if(!(o->_database_core_tdbconnection__isopen !=0) || !(o->_database_core_tdbconnection_handle )){
		return 0;
	}
	BBBYTE* bbt_ = (BBBYTE*)bbStringToCString((BBString*)&_s13);
	BBBYTE* bbt_result=bmx_pgsql_PQexec(o->_database_core_tdbconnection_handle ,bbt_);
	bbMemFree(bbt_);
	if(!(bbt_result) || (bmx_pgsql_PQresultStatus(bbt_result)!=1)){
		((struct database_core_TDBConnection_obj*)o)->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o,((BBString*)&_s14),database_core_convertUTF8toISO8859(bmx_pgsql_PQerrorMessage(o->_database_core_tdbconnection_handle )),1,0);
		bmx_pgsql_PQclear(bbt_result);
		return 0;
	}
	bmx_pgsql_PQclear(bbt_result);
	return 1;
}
BBBYTE* _database_postgresql_TDBPostgreSQL_databaseHandle(struct database_postgresql_TDBPostgreSQL_obj* o){
	return o->_database_core_tdbconnection_handle ;
}
struct database_core_TQueryResultSet_obj* _database_postgresql_TDBPostgreSQL_createResultSet(struct database_postgresql_TDBPostgreSQL_obj* o){
	return (struct database_core_TQueryResultSet_obj*)database_postgresql_TPostgreSQLResultSet_Create_TTQueryResultSet_TTDBConnectionS((struct database_core_TDBConnection_obj*)((struct database_core_TDBConnection_obj*)bbObjectDowncast((BBOBJECT)o,(BBClass*)&database_core_TDBConnection)),(&bbEmptyString));
}
BBSTRING _database_postgresql_TDBPostgreSQL_nativeErrorMessage_i(struct database_postgresql_TDBPostgreSQL_obj* o,BBINT bbt_err){
	return ((BBString*)&bbEmptyString);
}
BBINT _database_postgresql_TDBPostgreSQL_hasPrepareSupport(struct database_postgresql_TDBPostgreSQL_obj* o){
	return 1;
}
BBINT _database_postgresql_TDBPostgreSQL_hasTransactionSupport(struct database_postgresql_TDBPostgreSQL_obj* o){
	return 1;
}
struct BBDebugScope_15 database_postgresql_TDBPostgreSQL_scope ={
	BBDEBUGSCOPE_USERTYPE,
	"TDBPostgreSQL",
	{
		{
			BBDEBUGDECL_TYPEMETHOD,
			"New",
			"()",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_New
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"Create",
			"($,$,i,$,$,$,$):TDBConnection",
			.func_ptr=(BBFuncPtr)&database_postgresql_TDBPostgreSQL_Create_TTDBConnection_SSiSSSS
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"close",
			"()",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_close
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"isOpen",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_isOpen
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"commit",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_commit
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"getTables",
			"()[]$",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_getTables
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"getTableInfo",
			"($,i):TDBTable",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_getTableInfo_Si
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"open",
			"($,$)i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_open_SS
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"rollback",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_rollback
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"startTransaction",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_startTransaction
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"databaseHandle",
			"()*b",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_databaseHandle
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"createResultSet",
			"():TQueryResultSet",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_createResultSet
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"nativeErrorMessage",
			"(i)$",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_nativeErrorMessage_i
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"hasPrepareSupport",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_hasPrepareSupport
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"hasTransactionSupport",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TDBPostgreSQL_hasTransactionSupport
		},
		{
			BBDEBUGDECL_END
		}
	}
};
struct BBClass_database_postgresql_TDBPostgreSQL database_postgresql_TDBPostgreSQL={
	&database_core_TDBConnection,
	bbObjectFree,
	(BBDebugScope*)&database_postgresql_TDBPostgreSQL_scope,
	sizeof(struct database_postgresql_TDBPostgreSQL_obj),
	(void (*)(BBOBJECT))_database_postgresql_TDBPostgreSQL_New,
	(void (*)(BBOBJECT))_database_postgresql_TDBPostgreSQL_Delete,
	bbObjectToString,
	bbObjectCompare,
	bbObjectSendMessage,
	0,
	0,
	0
	,0
	,sizeof(void*)
	,database_postgresql_TDBPostgreSQL_Create_TTDBConnection_SSiSSSS
	,_database_core_TDBConnection_Init_SSiSSSS
	,_database_postgresql_TDBPostgreSQL_close
	,_database_postgresql_TDBPostgreSQL_commit
	,_database_postgresql_TDBPostgreSQL_getTables
	,_database_postgresql_TDBPostgreSQL_getTableInfo_Si
	,_database_postgresql_TDBPostgreSQL_open_SS
	,_database_postgresql_TDBPostgreSQL_rollback
	,_database_postgresql_TDBPostgreSQL_startTransaction
	,_database_core_TDBConnection_executeQuery_S
	,_database_postgresql_TDBPostgreSQL_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_postgresql_TDBPostgreSQL_databaseHandle
	,_database_postgresql_TDBPostgreSQL_createResultSet
	,_database_postgresql_TDBPostgreSQL_nativeErrorMessage_i
	,_database_postgresql_TDBPostgreSQL_hasPrepareSupport
	,_database_postgresql_TDBPostgreSQL_hasTransactionSupport
	,_database_core_TDBConnection_free
};

void _database_postgresql_TPostgreSQLResultSet_New(struct database_postgresql_TPostgreSQLResultSet_obj* o) {
	_database_core_TQueryResultSet_New((struct database_core_TQueryResultSet_obj*)o);
	o->clas = &database_postgresql_TPostgreSQLResultSet;
	o->_database_postgresql_tpostgresqlresultset_pgresult = 0;
	o->_database_postgresql_tpostgresqlresultset__queryrows = 0;
	o->_database_postgresql_tpostgresqlresultset__rowsaffected = 0;
	o->_database_postgresql_tpostgresqlresultset__preparedstatementname = ((BBString*)&bbEmptyString);
}
void _database_postgresql_TPostgreSQLResultSet_Delete(struct database_postgresql_TPostgreSQLResultSet_obj* o) {
	if(o->_database_postgresql_tpostgresqlresultset__preparedstatementname != &bbEmptyString){
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_executeQuery_S((struct database_postgresql_TPostgreSQLResultSet_obj*)o,bbStringConcat(bbStringConcat(((BBString*)&_s15),o->_database_postgresql_tpostgresqlresultset__preparedstatementname ),((BBString*)&_s16)));
		o->_database_postgresql_tpostgresqlresultset__preparedstatementname =(&bbEmptyString);
	}
	((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	BBRELEASE(o->_database_postgresql_tpostgresqlresultset__preparedstatementname )
	_database_core_TQueryResultSet_Delete((struct database_core_TQueryResultSet_obj*)o);
}
struct database_core_TQueryResultSet_obj* database_postgresql_TPostgreSQLResultSet_Create_TTQueryResultSet_TTDBConnectionS(struct database_core_TDBConnection_obj* bbt_db,BBSTRING bbt_sql){
	struct database_postgresql_TPostgreSQLResultSet_obj* bbt_this=(struct database_postgresql_TPostgreSQLResultSet_obj*)(struct database_postgresql_TPostgreSQLResultSet_obj*)bbObjectNew((BBClass *)&database_postgresql_TPostgreSQLResultSet);
	(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();
	return (struct database_core_TQueryResultSet_obj*)((struct database_core_TQueryResultSet_obj*)bbObjectDowncast((BBOBJECT)bbt_this,(BBClass*)&database_core_TQueryResultSet));
}
void _database_postgresql_TPostgreSQLResultSet_clearResultSet(struct database_postgresql_TPostgreSQLResultSet_obj* o){
	if(o->_database_postgresql_tpostgresqlresultset_pgresult ){
		bmx_pgsql_PQclear(o->_database_postgresql_tpostgresqlresultset_pgresult );
		o->_database_postgresql_tpostgresqlresultset_pgresult =0;
	}
}
void _database_postgresql_TPostgreSQLResultSet_cleanup(struct database_postgresql_TPostgreSQLResultSet_obj* o){
	((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_clearResultSet((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	o->_database_core_tqueryresultset_index =-1;
	o->_database_core_tqueryresultset__isactive =0;
	o->_database_postgresql_tpostgresqlresultset__queryrows =-1;
}
BBINT _database_postgresql_TPostgreSQLResultSet_executeQuery_S(struct database_postgresql_TPostgreSQLResultSet_obj* o,BBSTRING bbt_statement){
	if(!((o->_database_core_tqueryresultset_conn )->clas->m_isOpen((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn )!=0)){
		return 0;
	}
	((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	BBSTRING bbt_q=database_core_convertISO8859toUTF8(bbt_statement);
	BBBYTE* bbt_ = (BBBYTE*)bbStringToCString(bbt_q);
	o->_database_postgresql_tpostgresqlresultset_pgresult =bmx_pgsql_PQexec(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle ,(bbt_));
	bbMemFree(bbt_);
	if(!(o->_database_postgresql_tpostgresqlresultset_pgresult )){
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
		return 0;
	}
	BBINT bbt_status=bmx_pgsql_PQresultStatus(o->_database_postgresql_tpostgresqlresultset_pgresult );
	BBINT bbt_2=bbt_status;
	if(bbt_2==2){
		o->_database_postgresql_tpostgresqlresultset__queryrows =bmx_pgsql_PQntuples(o->_database_postgresql_tpostgresqlresultset_pgresult );
	}else{
		if(bbt_2==1){
			o->_database_postgresql_tpostgresqlresultset__queryrows =-1;
		}else{
			(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,((BBString*)&_s17),database_core_convertUTF8toISO8859(bmx_pgsql_PQerrorMessage(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle )),3,0);
			((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
			return 0;
		}
	}
	BBINT bbt_fieldCount=bmx_pgsql_PQnfields(o->_database_postgresql_tpostgresqlresultset_pgresult );
	((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_initRecord_i((struct database_postgresql_TPostgreSQLResultSet_obj*)o,bbt_fieldCount);
	o->_database_postgresql_tpostgresqlresultset__rowsaffected =bbStringToInt((BBSTRING)bbStringFromCString(bmx_pgsql_PQcmdTuples(o->_database_postgresql_tpostgresqlresultset_pgresult )));
	if(bbt_fieldCount!=0){
		{
			BBINT bbt_i=0;
			BBINT bbt_3=bbt_fieldCount;
			for(;(bbt_i<bbt_3);bbt_i=(bbt_i+1)){
				BBINT bbt_dtype=bmx_pgsql_PQftype(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i);
				struct database_core_TQueryField_obj* bbt_qf=(struct database_core_TQueryField_obj*)database_core_TQueryField_Create_TTQueryField_Si(database_core_convertUTF8toISO8859(bmx_pgsql_PQfname(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i)),o->clas->f_dbTypeFromNative_i_Sii((&bbEmptyString),bbt_dtype,0));
				bbt_qf->_database_core_tqueryfield_length =bmx_pgsql_PQfsize(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i);
				bbt_qf->_database_core_tqueryfield_precision =bmx_pgsql_PQfmod(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i);
				bbt_qf->_database_core_tqueryfield_dtype =bbt_dtype;
				if(bbt_qf->_database_core_tqueryfield_length ==-1){
					bbt_qf->_database_core_tqueryfield_length =(bbt_qf->_database_core_tqueryfield_precision -4);
					bbt_qf->_database_core_tqueryfield_precision =-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*)bbt_qf);
			}
		}
	}
	if(o->_database_postgresql_tpostgresqlresultset__queryrows ==-1){
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	}else{
		o->_database_core_tqueryresultset__isactive =1;
	}
	return 1;
}
void _database_postgresql_TPostgreSQLResultSet_initRecord_i(struct database_postgresql_TPostgreSQLResultSet_obj* o,BBINT bbt_size){
	if(((BBObject*)o->_database_core_tqueryresultset_rec )!= &bbNullObject){
		(o->_database_core_tqueryresultset_rec )->clas->m_clear((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec );
		if(bbt_size>0){
			(o->_database_core_tqueryresultset_rec )->clas->m_Init_i((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec ,bbt_size);
		}
	}
	((struct database_core_TQueryResultSet_obj*)o)->clas->m_resetValues_i((struct database_core_TQueryResultSet_obj*)o,bbt_size);
}
BBINT _database_postgresql_TPostgreSQLResultSet_prepare_S(struct database_postgresql_TPostgreSQLResultSet_obj* o,BBSTRING bbt_statement){
	((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	if(!(bbt_statement!= &bbEmptyString) || ((bbt_statement->length)==0)){
		return 0;
	}
	if(!(o->_database_postgresql_tpostgresqlresultset__preparedstatementname != &bbEmptyString)){
		o->_database_postgresql_tpostgresqlresultset__preparedstatementname =bbStringConcat(((BBString*)&_s18),((BBOBJECT)o)->clas->ToString((BBOBJECT)o));
	}else{
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_executeQuery_S((struct database_postgresql_TPostgreSQLResultSet_obj*)o,bbStringConcat(bbStringConcat(((BBString*)&_s15),o->_database_postgresql_tpostgresqlresultset__preparedstatementname ),((BBString*)&_s16)));
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	}
	BBSTRING bbt_q=database_core_convertISO8859toUTF8(bbt_statement);
	BBBYTE* bbt_ = (BBBYTE*)bbStringToCString(o->_database_postgresql_tpostgresqlresultset__preparedstatementname );
	BBBYTE* bbt_2 = (BBBYTE*)bbStringToCString(bbt_q);
	o->_database_postgresql_tpostgresqlresultset_pgresult =bmx_pgsql_PQprepare(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle ,(bbt_),(bbt_2));
	bbMemFree(bbt_2);
	bbMemFree(bbt_);
	if(!(o->_database_postgresql_tpostgresqlresultset_pgresult )){
		return 0;
	}
	if(bmx_pgsql_PQresultStatus(o->_database_postgresql_tpostgresqlresultset_pgresult )!=1){
		(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,((BBString*)&_s19),database_core_convertUTF8toISO8859(bmx_pgsql_PQerrorMessage(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle )),3,0);
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
		return 0;
	}
	return 1;
}
BBINT _database_postgresql_TPostgreSQLResultSet_execute(struct database_postgresql_TPostgreSQLResultSet_obj* o){
	((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	BBBYTE* bbt_params=0;
	BBINT* bbt_lengths=0;
	BBINT* bbt_formats=0;
	BBINT bbt_paramCount=0;
	BBINT bbt_length=0;
	BBSTRING bbt_s=((BBString*)&bbEmptyString);
	BBARRAY bbt_strings=(&bbEmptyArray);
	BBARRAY bbt_values=o->_database_core_tqueryresultset_boundvalues ;
	if(bbt_values!= &bbEmptyArray){
		bbt_paramCount=(bbt_values->scales[0]);
		bbt_strings=bbArrayNew1D("*b", bbt_paramCount);
		bbt_params=bmx_pgsql_createParamValues(bbt_paramCount);
		bbt_lengths=bmx_pgsql_createParamInts(bbt_paramCount);
		bbt_formats=bmx_pgsql_createParamInts(bbt_paramCount);
		{
			BBINT bbt_i=0;
			BBINT bbt_=bbt_paramCount;
			for(;(bbt_i<bbt_);bbt_i=(bbt_i+1)){
				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)){
					bmx_pgsql_setNullParam(bbt_params,bbt_i);
				}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){
						bbt_s=bbStringFromInt(((struct database_core_dbtypes_TDBInt_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBInt))->_database_core_dbtypes_tdbint_value );
						((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s);
						bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s->length));
					}else{
						if(bbt_3==5){
							bbt_s=bbStringFromLong(((struct database_core_dbtypes_TDBLong_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBLong))->_database_core_dbtypes_tdblong_value );
							((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s);
							bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s->length));
						}else{
							if(bbt_3==4){
								bbt_s=bbStringFromFloat(((struct database_core_dbtypes_TDBFloat_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBFloat))->_database_core_dbtypes_tdbfloat_value );
								((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s);
								bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s->length));
							}else{
								if(bbt_3==3){
									bbt_s=bbStringFromDouble(((struct database_core_dbtypes_TDBDouble_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBDouble))->_database_core_dbtypes_tdbdouble_value );
									((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s);
									bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s->length));
								}else{
									if(bbt_3==7){
										struct database_core_dbtypes_TDBBlob_obj* bbt_b=(struct database_core_dbtypes_TDBBlob_obj*)((struct database_core_dbtypes_TDBBlob_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBBlob));
										bmx_pgsql_setParamBinary(bbt_params,bbt_lengths,bbt_formats,bbt_i,bbt_b->_database_core_dbtypes_tdbblob_value ,bbt_b->_database_core_dbtypes_tdbblob__size );
									}else{
										if(bbt_3==6){
											struct database_core_dbtypes_TDBDate_obj* bbt_5;
											bbt_s=(((struct database_core_dbtypes_TDBDate_obj*)(bbt_5 = ((struct database_core_dbtypes_TDBDate_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBDate))))->clas)->m_getString((struct database_core_dbtypes_TDBDate_obj*)bbt_5);
											((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s);
											bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s->length));
										}else{
											if(bbt_3==8){
												struct database_core_dbtypes_TDBDateTime_obj* bbt_6;
												bbt_s=(((struct database_core_dbtypes_TDBDateTime_obj*)(bbt_6 = ((struct database_core_dbtypes_TDBDateTime_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBDateTime))))->clas)->m_getString((struct database_core_dbtypes_TDBDateTime_obj*)bbt_6);
												((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s);
												bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s->length));
											}else{
												if(bbt_3==9){
													struct database_core_dbtypes_TDBTime_obj* bbt_7;
													bbt_s=(((struct database_core_dbtypes_TDBTime_obj*)(bbt_7 = ((struct database_core_dbtypes_TDBTime_obj*)bbObjectDowncast((BBOBJECT)((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)],(BBClass*)&database_core_dbtypes_TDBTime))))->clas)->m_getString((struct database_core_dbtypes_TDBTime_obj*)bbt_7);
													((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s);
													bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s->length));
												}else{
													struct database_core_dbtypes_TDBType_obj* bbt_8;
													BBSTRING bbt_s2=database_core_convertISO8859toUTF8(((bbt_8 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(bbt_values,1))[((BBUINT)bbt_i)])->clas)->m_getString((struct database_core_dbtypes_TDBType_obj*)bbt_8));
													((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)]=bbStringToCString((BBSTRING)bbt_s2);
													bmx_pgsql_setParam(bbt_params,bbt_lengths,bbt_formats,bbt_i,((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i)],(bbt_s2->length));
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	if(bbt_params){
		BBBYTE* bbt_9 = (BBBYTE*)bbStringToCString(o->_database_postgresql_tpostgresqlresultset__preparedstatementname );
		o->_database_postgresql_tpostgresqlresultset_pgresult =bmx_pgsql_PQexecPrepared(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle ,(bbt_9),bbt_paramCount,bbt_params,bbt_lengths,bbt_formats);
		bbMemFree(bbt_9);
	}else{
		BBBYTE* bbt_10 = (BBBYTE*)bbStringToCString(o->_database_postgresql_tpostgresqlresultset__preparedstatementname );
		o->_database_postgresql_tpostgresqlresultset_pgresult =bmx_pgsql_PQexecPrepared(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle ,(bbt_10),bbt_paramCount,0,0,0);
		bbMemFree(bbt_10);
	}
	{
		BBINT bbt_i2=0;
		BBINT bbt_11=bbt_paramCount;
		for(;(bbt_i2<bbt_11);bbt_i2=(bbt_i2+1)){
			if(((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i2)]){
				bbMemFree((void*)((BBBYTE**)BBARRAYDATA(bbt_strings,1))[((BBUINT)bbt_i2)]);
			}
		}
	}
	if(bbt_params){
		bmx_pgsql_deleteParamValues(bbt_params);
		bmx_pgsql_deleteParamInts(bbt_lengths);
		bmx_pgsql_deleteParamInts(bbt_formats);
	}
	if(!(o->_database_postgresql_tpostgresqlresultset_pgresult )){
		(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,((BBString*)&_s20),((BBString*)&bbEmptyString),3,0);
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
		return 0;
	}
	BBINT bbt_status=bmx_pgsql_PQresultStatus(o->_database_postgresql_tpostgresqlresultset_pgresult );
	BBINT bbt_12=bbt_status;
	if(bbt_12==2){
		o->_database_postgresql_tpostgresqlresultset__queryrows =bmx_pgsql_PQntuples(o->_database_postgresql_tpostgresqlresultset_pgresult );
	}else{
		if(bbt_12==1){
			o->_database_postgresql_tpostgresqlresultset__queryrows =-1;
		}else{
			(o->_database_core_tqueryresultset_conn )->clas->m_setError_SSii((struct database_core_TDBConnection_obj*)o->_database_core_tqueryresultset_conn ,((BBString*)&_s20),database_core_convertUTF8toISO8859(bmx_pgsql_PQerrorMessage(o->_database_core_tqueryresultset_conn ->_database_core_tdbconnection_handle )),3,0);
			((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
			return 0;
		}
	}
	BBINT bbt_fieldCount=bmx_pgsql_PQnfields(o->_database_postgresql_tpostgresqlresultset_pgresult );
	((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_initRecord_i((struct database_postgresql_TPostgreSQLResultSet_obj*)o,bbt_fieldCount);
	o->_database_postgresql_tpostgresqlresultset__rowsaffected =bbStringToInt((BBSTRING)bbStringFromCString(bmx_pgsql_PQcmdTuples(o->_database_postgresql_tpostgresqlresultset_pgresult )));
	if(bbt_fieldCount!=0){
		{
			BBINT bbt_i3=0;
			BBINT bbt_13=bbt_fieldCount;
			for(;(bbt_i3<bbt_13);bbt_i3=(bbt_i3+1)){
				BBINT bbt_dtype=bmx_pgsql_PQftype(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i3);
				struct database_core_TQueryField_obj* bbt_qf=(struct database_core_TQueryField_obj*)database_core_TQueryField_Create_TTQueryField_Si(database_core_convertUTF8toISO8859(bmx_pgsql_PQfname(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i3)),o->clas->f_dbTypeFromNative_i_Sii((&bbEmptyString),bbt_dtype,0));
				bbt_qf->_database_core_tqueryfield_length =bmx_pgsql_PQfsize(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i3);
				bbt_qf->_database_core_tqueryfield_precision =bmx_pgsql_PQfmod(o->_database_postgresql_tpostgresqlresultset_pgresult ,bbt_i3);
				bbt_qf->_database_core_tqueryfield_dtype =bbt_dtype;
				if(bbt_qf->_database_core_tqueryfield_length ==-1){
					bbt_qf->_database_core_tqueryfield_length =(bbt_qf->_database_core_tqueryfield_precision -4);
					bbt_qf->_database_core_tqueryfield_precision =-1;
				}
				(o->_database_core_tqueryresultset_rec )->clas->m_setField_iTTQueryField((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec ,bbt_i3,(struct database_core_TQueryField_obj*)bbt_qf);
			}
		}
	}
	if(o->_database_postgresql_tpostgresqlresultset__queryrows <1){
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	}else{
		o->_database_core_tqueryresultset__isactive =1;
	}
	return 1;
}
BBINT _database_postgresql_TPostgreSQLResultSet_firstRow(struct database_postgresql_TPostgreSQLResultSet_obj* o){
	if(o->_database_core_tqueryresultset_index ==-1){
		return ((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_nextRow((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	}
	return 0;
}
BBINT _database_postgresql_TPostgreSQLResultSet_nextRow(struct database_postgresql_TPostgreSQLResultSet_obj* o){
	if(!(o->_database_core_tqueryresultset__isactive !=0)){
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
		return 0;
	}
	if(o->_database_core_tqueryresultset_index >=(o->_database_postgresql_tpostgresqlresultset__queryrows -1)){
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_cleanup((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
		return 0;
	}
	{
		BBINT bbt_i=0;
		BBINT bbt_=(o->_database_core_tqueryresultset_rec )->clas->m_count((struct database_core_TQueryRecord_obj*)o->_database_core_tqueryresultset_rec );
		for(;(bbt_i<bbt_);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_2;
				((bbt_2 = ((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_2);
			}
			if(!(bmx_pgsql_PQgetisnull(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i)!=0)){
				BBINT bbt_fieldLength=bmx_pgsql_PQgetlength(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i);
				BBINT bbt_3=((struct database_core_TQueryField_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_rec ->_database_core_tqueryrecord_fields ,1))[((BBUINT)bbt_i)]->_database_core_tqueryfield_ftype ;
				if(bbt_3==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_TDBInt_obj*)bbObjectAtomicNew((BBClass *)&database_core_dbtypes_TDBInt),(BBClass*)&database_core_dbtypes_TDBType));
					struct database_core_dbtypes_TDBType_obj* bbt_4;
					((bbt_4 = ((struct database_core_dbtypes_TDBType_obj**)BBARRAYDATA(o->_database_core_tqueryresultset_values ,1))[((BBUINT)bbt_i)])->clas)->m_setInt_i((struct database_core_dbtypes_TDBType_obj*)bbt_4,bbStringToInt((BBSTRING)bbStringFromBytes(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength)));
				}else{
					if(bbt_3==5){
						((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));
						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,bbStringToLong((BBSTRING)bbStringFromBytes(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength)));
					}else{
						if(bbt_3==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_TDBFloat_obj*)bbObjectAtomicNew((BBClass *)&database_core_dbtypes_TDBFloat),(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_SetFloat_f((struct database_core_dbtypes_TDBType_obj*)bbt_6,bbStringToFloat((BBSTRING)bbStringFromBytes(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength)));
						}else{
							if(bbt_3==3){
								((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_7;
								((bbt_7 = ((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_7,bbStringToDouble((BBSTRING)bbStringFromBytes(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength)));
							}else{
								if(bbt_3==6){
									((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)database_core_dbtypes_TDBDate_SetFromString_TTDBDate_S(bbStringFromBytes(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength)),(BBClass*)&database_core_dbtypes_TDBType));
								}else{
									if(bbt_3==8){
										((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)database_core_dbtypes_TDBDateTime_SetFromString_TTDBDateTime_S(bbStringFromBytes(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength)),(BBClass*)&database_core_dbtypes_TDBType));
									}else{
										if(bbt_3==9){
											((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)database_core_dbtypes_TDBTime_SetFromString_TTDBTime_S(bbStringFromBytes(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength)),(BBClass*)&database_core_dbtypes_TDBType));
										}else{
											if(bbt_3==7){
												BBBYTE* bbt_b=bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i);
												BBBYTE* bbt_c=bmx_pgsql_PQunescapeBytea(bbt_b,(&bbt_fieldLength));
												((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)database_core_dbtypes_TDBBlob_Set_TTDBBlob_pbii(bbt_c,bbt_fieldLength,1),(BBClass*)&database_core_dbtypes_TDBType));
												bmx_pgsql_PQfreemem(bbt_c);
											}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(bmx_pgsql_PQgetvalue(o->_database_postgresql_tpostgresqlresultset_pgresult ,(o->_database_core_tqueryresultset_index +1),bbt_i),bbt_fieldLength));
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	o->_database_core_tqueryresultset_index +=1;
	if(o->_database_core_tqueryresultset_index >=(o->_database_postgresql_tpostgresqlresultset__queryrows -1)){
		((struct database_postgresql_TPostgreSQLResultSet_obj*)o)->clas->m_clearResultSet((struct database_postgresql_TPostgreSQLResultSet_obj*)o);
	}
	return 1;
}
BBLONG _database_postgresql_TPostgreSQLResultSet_lastInsertedId(struct database_postgresql_TPostgreSQLResultSet_obj* o){
	if((o->_database_core_tqueryresultset__isactive !=0) && (o->_database_postgresql_tpostgresqlresultset_pgresult )){
		return ((BBLONG)bmx_pgsql_PQoidValue(o->_database_postgresql_tpostgresqlresultset_pgresult ));
	}
	return -1LL;
}
BBINT _database_postgresql_TPostgreSQLResultSet_rowsAffected(struct database_postgresql_TPostgreSQLResultSet_obj* o){
	return o->_database_postgresql_tpostgresqlresultset__rowsaffected ;
}
BBINT database_postgresql_TPostgreSQLResultSet_dbTypeFromNative_i_Sii(BBSTRING bbt_name,BBINT bbt__type,BBINT bbt__flags){
	BBINT bbt_dbType=0;
	BBINT bbt_=bbt__type;
	if(((((((bbt_==16) || (bbt_==21)) || (bbt_==23)) || (bbt_==2278)) || (bbt_==24)) || (bbt_==28)) || (bbt_==29)){
		bbt_dbType=2;
	}else{
		if(bbt_==20){
			bbt_dbType=5;
		}else{
			if(bbt_==700){
				bbt_dbType=4;
			}else{
				if((bbt_==1700) || (bbt_==701)){
					bbt_dbType=3;
				}else{
					if(bbt_==1082){
						bbt_dbType=6;
					}else{
						if((bbt_==1083) || (bbt_==1266)){
							bbt_dbType=9;
						}else{
							if((((bbt_==1114) || (bbt_==1184)) || (bbt_==702)) || (bbt_==703)){
								bbt_dbType=8;
							}else{
								if(bbt_==17){
									bbt_dbType=7;
								}else{
									bbt_dbType=1;
								}
							}
						}
					}
				}
			}
		}
	}
	return bbt_dbType;
}
struct BBDebugScope_17 database_postgresql_TPostgreSQLResultSet_scope ={
	BBDEBUGSCOPE_USERTYPE,
	"TPostgreSQLResultSet",
	{
		{
			BBDEBUGDECL_FIELD,
			"pgResult",
			"*b",
			.field_offset=offsetof(struct database_postgresql_TPostgreSQLResultSet_obj,_database_postgresql_tpostgresqlresultset_pgresult)
		},
		{
			BBDEBUGDECL_FIELD,
			"_queryRows",
			"i",
			.field_offset=offsetof(struct database_postgresql_TPostgreSQLResultSet_obj,_database_postgresql_tpostgresqlresultset__queryrows)
		},
		{
			BBDEBUGDECL_FIELD,
			"_rowsAffected",
			"i",
			.field_offset=offsetof(struct database_postgresql_TPostgreSQLResultSet_obj,_database_postgresql_tpostgresqlresultset__rowsaffected)
		},
		{
			BBDEBUGDECL_FIELD,
			"_preparedStatementName",
			"$",
			.field_offset=offsetof(struct database_postgresql_TPostgreSQLResultSet_obj,_database_postgresql_tpostgresqlresultset__preparedstatementname)
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"New",
			"()",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_New
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"Create",
			"(:TDBConnection,$):TQueryResultSet",
			.func_ptr=(BBFuncPtr)&database_postgresql_TPostgreSQLResultSet_Create_TTQueryResultSet_TTDBConnectionS
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"clearResultSet",
			"()",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_clearResultSet
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"cleanup",
			"()",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_cleanup
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"executeQuery",
			"($)i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_executeQuery_S
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"initRecord",
			"(i)",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_initRecord_i
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"prepare",
			"($)i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_prepare_S
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"execute",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_execute
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"firstRow",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_firstRow
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"nextRow",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_nextRow
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"lastInsertedId",
			"()l",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_lastInsertedId
		},
		{
			BBDEBUGDECL_TYPEMETHOD,
			"rowsAffected",
			"()i",
			.func_ptr=(BBFuncPtr)&_database_postgresql_TPostgreSQLResultSet_rowsAffected
		},
		{
			BBDEBUGDECL_TYPEFUNCTION,
			"dbTypeFromNative",
			"($,i,i)i",
			.func_ptr=(BBFuncPtr)&database_postgresql_TPostgreSQLResultSet_dbTypeFromNative_i_Sii
		},
		{
			BBDEBUGDECL_END
		}
	}
};
struct BBClass_database_postgresql_TPostgreSQLResultSet database_postgresql_TPostgreSQLResultSet={
	&database_core_TQueryResultSet,
	bbObjectFree,
	(BBDebugScope*)&database_postgresql_TPostgreSQLResultSet_scope,
	sizeof(struct database_postgresql_TPostgreSQLResultSet_obj),
	(void (*)(BBOBJECT))_database_postgresql_TPostgreSQLResultSet_New,
	(void (*)(BBOBJECT))_database_postgresql_TPostgreSQLResultSet_Delete,
	bbObjectToString,
	bbObjectCompare,
	bbObjectSendMessage,
	0,
	0,
	offsetof(struct database_postgresql_TPostgreSQLResultSet_obj,_database_postgresql_tpostgresqlresultset__preparedstatementname) - offsetof(struct database_postgresql_TPostgreSQLResultSet_obj,_database_postgresql_tpostgresqlresultset_pgresult) + sizeof(BBSTRING)
	,0
	,offsetof(struct database_postgresql_TPostgreSQLResultSet_obj,_database_postgresql_tpostgresqlresultset_pgresult)
	,database_postgresql_TPostgreSQLResultSet_Create_TTQueryResultSet_TTDBConnectionS
	,_database_core_TQueryResultSet_Init_TTDBConnectionS
	,_database_core_TQueryResultSet_clearBindValues
	,_database_core_TQueryResultSet_clear
	,_database_postgresql_TPostgreSQLResultSet_executeQuery_S
	,_database_postgresql_TPostgreSQLResultSet_prepare_S
	,_database_postgresql_TPostgreSQLResultSet_execute
	,_database_postgresql_TPostgreSQLResultSet_firstRow
	,_database_postgresql_TPostgreSQLResultSet_nextRow
	,_database_postgresql_TPostgreSQLResultSet_lastInsertedId
	,_database_postgresql_TPostgreSQLResultSet_rowsAffected
	,database_postgresql_TPostgreSQLResultSet_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_core_TQueryResultSet_reset
	,_database_core_TQueryResultSet_free
	,_database_postgresql_TPostgreSQLResultSet_clearResultSet
	,_database_postgresql_TPostgreSQLResultSet_cleanup
	,_database_postgresql_TPostgreSQLResultSet_initRecord_i
};

static int __bb_database_postgresql_postgresql_inited = 0;
int __bb_database_postgresql_postgresql(){
	if (!__bb_database_postgresql_postgresql_inited) {
		__bb_database_postgresql_postgresql_inited = 1;
		__bb_brl_blitz_blitz();
		__bb_database_core_core();
		_bb_database_postgresql_common();
		bbObjectRegisterType((BBCLASS)&database_postgresql_TPostgreSQLDatabaseLoader);
		bbObjectRegisterType((BBCLASS)&database_postgresql_TDBPostgreSQL);
		bbObjectRegisterType((BBCLASS)&database_postgresql_TPostgreSQLResultSet);
		database_core_AddDatabaseLoader((struct database_core_TDatabaseLoader_obj*)((struct database_core_TDatabaseLoader_obj*)bbObjectDowncast((BBOBJECT)(struct database_postgresql_TPostgreSQLDatabaseLoader_obj*)bbObjectNew((BBClass *)&database_postgresql_TPostgreSQLDatabaseLoader),(BBClass*)&database_core_TDatabaseLoader)));
		return 0;
	}
	return 0;
}