bool InitGameDB() { DBInterface* db = new SQLiteInterface(); if(!db->Open("gametest.db")) return false; // account--accountid|username||password if(!db->CreateTable("create table if not exists account(accountid INTEGER primary key AUTOINCREMENT, username TEXT UNIQUE, password TEXT)")) return false; // role--roleid|rolename|accountid|money|exp|level if(!db->CreateTable("create table if not exists role(roleid INTEGER primary key AUTOINCREMENT, rolename TEXT UNIQUE, accountid INTERGER, money INTERGER ,exp INTERGER, level INTERGER)")) return false; db->Close(); delete db; return true; }
int _tmain(int argc, _TCHAR* argv[]) { DBInterface* pInterface = new SqliteInterface(); pInterface->Open("..\\test"); DBTable table; int Col_Content = table.GetColumnIdx("Content"); if (Col_Content == -1) { printf("Invalid Column Name\n"); return false; } pInterface->ExecuteSql("select * from test", table); // for (;;) // { // // } printf("I am here, waiting for u\n"); return 0; }