Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SQL_CheckTables() {
- g_hDB.Query(SQL_OnCheckedTables, "SHOW TABLES;", 0, DBPrio_High);
- }
- public void SQL_OnCheckedTables(Database hDB, DBResultSet hResults, const char[] szError, any data) {
- bool bClients = false;
- bool bChannels = false;
- char szTableName[20];
- while (hResults.FetchRow()) {
- hResults.FetchString(0, szTableName, sizeof(szTableName));
- if (StrEqual(szTableName, "vc_channels")) {
- bChannels = true;
- } else if (StrEqual(szTableName, "vc_clients")) {
- bClients = true;
- }
- if (bChannels && bClients) {
- g_bSQL_Ready = true;
- break;
- }
- }
- if (!bChannels || !bClients) {
- SQL_CreateTables(!bChannels, !bClients);
- }
- }
- void SQL_CreateTables(bool bChannels, bool bClients) {
- Transaction hTransaction = new Transaction();
- if (bChannels) {
- hTransaction.AddQuery(g_szQueriesTpl_CreateTables_Channels[g_iDriverType]);
- hTransaction.AddQuery(g_szQueriesTpl_IndexesTables_Channels[g_iDriverType]);
- hTransaction.AddQuery(g_szQueriesTpl_AITables_Channels[g_iDriverType]);
- }
- if (bClients) {
- hTransaction.AddQuery(g_szQueriesTpl_CreateTables_Clients[g_iDriverType]);
- hTransaction.AddQuery(g_szQueriesTpl_IndexesTables_Clients[g_iDriverType]);
- hTransaction.AddQuery(g_szQueriesTpl_AITables_Clients[g_iDriverType]);
- }
- g_hDB.Execute(hTransaction, SQL_OnTablesCreated_OK, SQL_OnTablesCreated_Error, 0, DBPrio_High);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement