library/src/databases/bpdb/BP-DB.cc
// simple routine to sintall a table into a buffer
simple routine to sintall a table into a buffer
simple routine to sintall a table into a buffer
BP_ERROR_T BP_DBSchemaInstallTableFromBufferLocal(P_BPDB bpdb, char * table_sql)
{
	if(!bpdb)
		return ERR_FAILURE;
	if(!bpdb->sqlite)
		return ERR_FAILURE;
	if(!table_sql)
		return ERR_FAILURE;
	if(!BP_StringIsReasonablePrintableString(table_sql, bpstrlen(table_sql), BP_TRUE, BP_FALSE))
		return ERR_FAILURE;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(bpdb->system_hreg);
	BP_SQLiteAddQuery
	(
			bpdb->sqlite,
			BP_DB_SQLITE_QUERY_TYPE_CREATE_TABLE,
			table_sql
	);
	BP_SQLiteRunQueries(bpdb->sqlite);
	BP_SQLiteClearBothQueryAndResultCaches(bpdb->sqlite);
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(bpdb->system_hreg);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_DBSchemaInstallTableFromBufferLocal ( P_BPDB bpdb , char * table_sql ) { if ( ! bpdb ) return ERR_FAILURE ; if ( ! bpdb -> sqlite ) return ERR_FAILURE ; if ( ! table_sql ) return ERR_FAILURE ; if ( ! BP_StringIsReasonablePrintableString ( table_sql , bpstrlen ( table_sql ) , BP_TRUE , BP_FALSE ) ) return ERR_FAILURE ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( bpdb -> system_hreg ) ; BP_SQLiteAddQuery ( bpdb -> sqlite , BP_DB_SQLITE_QUERY_TYPE_CREATE_TABLE , table_sql ) ; BP_SQLiteRunQueries ( bpdb -> sqlite ) ; BP_SQLiteClearBothQueryAndResultCaches ( bpdb -> sqlite ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( bpdb -> system_hreg ) ; return ERR_SUCCESS ; }
simple routine to sintall a table into a buffer
simple routine to sintall a table into a buffer
// ensure we have a bpdb // table must be reasonable/printable // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Enter Critical Section and Install Tables %%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // enter critical section // add query // run table queries // clear query and result caches // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Leave Critical Section and Exit %%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // enter critical section // return indicating success