private static void CreateTables() { FastQuery("CREATE TABLE IF NOT EXISTS Players (" + "steamid VARCHAR(50) NOT NULL, " + "playername VARCHAR(50) DEFAULT 'Unknown', " + "last_joined VARCHAR(50) DEFAULT 'Never', " + "pingimmunity VARCHAR(10) DEFAULT 'false', " + "last_gimme VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastkillme VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "bank INT DEFAULT 0, " + "wallet INT DEFAULT 0, " + "playerSpentCoins INT DEFAULT 0, " + "hardcoreSessionTime INT DEFAULT 0, " + "hardcoreKills INT DEFAULT 0, " + "hardcoreZKills INT DEFAULT 0, " + "hardcoreScore INT DEFAULT 0, " + "hardcoreDeaths INT DEFAULT 0, " + "hardcoreName VARCHAR(50) DEFAULT 'Unknown', " + "bounty INT DEFAULT 0, " + "bountyHunter INT DEFAULT 0, " + "sessionTime INT DEFAULT 0, " + "bikeId INT DEFAULT 0, " + "lastBike VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "jailTime INT DEFAULT 0, " + "jailName VARCHAR(50) DEFAULT 'Unknown', " + "jailDate VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "muteTime INT DEFAULT 0, " + "muteName VARCHAR(50) DEFAULT 'Unknown', " + "muteDate VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "zkills INT DEFAULT 0, " + "kills INT DEFAULT 0, " + "deaths INT DEFAULT 0, " + "eventReturn VARCHAR(50) DEFAULT 'Unknown', " + "marketReturn VARCHAR(50) DEFAULT 'Unknown', " + "lobbyReturn VARCHAR(50) DEFAULT 'Unknown', " + "newTeleSpawn VARCHAR(50) DEFAULT 'Unknown', " + "homeposition VARCHAR(50) DEFAULT 'Unknown', " + "homeposition2 VARCHAR(50) DEFAULT 'Unknown', " + "lastsethome VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastwhisper VARCHAR(50) DEFAULT 'Unknown', " + "lastWaypoint VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastMarket VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastStuck VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastLobby VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastLog VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastDied VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastFriendTele VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "respawnTime VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastTravel VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastAnimals VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "lastVoteReward VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "firstClaim VARCHAR(10) DEFAULT 'false', " + "ismuted VARCHAR(10) DEFAULT 'false', " + "isjailed VARCHAR(10) DEFAULT 'false', " + "startingItems VARCHAR(10) DEFAULT 'false', " + "clanname VARCHAR(50) DEFAULT 'Unknown', " + "invitedtoclan VARCHAR(50) DEFAULT 'Unknown', " + "isclanowner VARCHAR(10) DEFAULT 'false', " + "isclanofficer VARCHAR(10) DEFAULT 'false', " + "customCommand1 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand2 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand3 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand4 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand5 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand6 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand7 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand8 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand9 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand10 VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "countryban VARCHAR(10) DEFAULT 'false', " + "PRIMARY KEY (steamid)) ENGINE = InnoDB;"); FastQuery("CREATE TABLE IF NOT EXISTS Auction (" + "auctionid INT NOT NULL AUTO_INCREMENT, " + "steamid VARCHAR(50) NOT NULL, " + "itemName VARCHAR(50) NOT NULL, " + "itemCount INT NOT NULL, " + "itemQuality INT NOT NULL, " + "itemPrice INT NOT NULL, " + "cancelTime VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "PRIMARY KEY (auctionid)) ENGINE = InnoDB;"); FastQuery("CREATE TABLE IF NOT EXISTS Waypoints (" + "wayPointid INT NOT NULL AUTO_INCREMENT, " + "steamid VARCHAR(50) NOT NULL, " + "wayPointName VARCHAR(50) NOT NULL, " + "position VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "PRIMARY KEY (wayPointid)) ENGINE = InnoDB;"); FastQuery("CREATE TABLE IF NOT EXISTS Polls (" + "pollid INT NOT NULL AUTO_INCREMENT, " + "pollOpen VARCHAR(10) DEFAULT 'false', " + "pollTime VARCHAR(50) DEFAULT '10/29/2000 7:30:00 AM', " + "pollHours INT NOT NULL, " + "pollMessage VARCHAR(255) NOT NULL, " + "pollYes INT DEFAULT 0, " + "pollNo INT DEFAULT 0, " + "PRIMARY KEY (pollid)) ENGINE = InnoDB;"); FastQuery("CREATE TABLE IF NOT EXISTS Events (" + "eventid INT NOT NULL AUTO_INCREMENT, " + "eventAdmin VARCHAR(50), " + "eventName VARCHAR(255), " + "eventInvite VARCHAR(255), " + "eventTeams INT, " + "eventPlayerCount INT, " + "eventTime INT, " + "eventActive VARCHAR(10), " + "PRIMARY KEY (eventid)) ENGINE = InnoDB;"); FastQuery("CREATE TABLE IF NOT EXISTS EventSpawns (" + "eventid INT NOT NULL, " + "eventTeam INT NOT NULL, " + "eventSpawn VARCHAR(50), " + "eventRespawn VARCHAR(50), " + "FOREIGN KEY (eventid) REFERENCES Events(eventid)) ENGINE = InnoDB;"); FastQuery("CREATE TABLE IF NOT EXISTS Config (sql_version INTEGER) ENGINE = InnoDB;"); int _version = 1; DataTable _result = SQL.TQuery("SELECT sql_version FROM Config"); if (_result.Rows.Count == 0) { FastQuery("INSERT INTO Config (sql_version) VALUES (1)"); } else { int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _version); } _result.Dispose(); if (_version != SQL.Sql_version) { UpdateSQL.Exec(_version); } }
private static void CreateTables() { try { FastQuery("CREATE TABLE IF NOT EXISTS Players (" + "steamid TEXT PRIMARY KEY ON CONFLICT REPLACE, " + "playername TEXT DEFAULT 'Unknown', " + "countryban TEXT DEFAULT 'false', " + "return TEXT DEFAULT 'false', " + "eventReturn TEXT DEFAULT 'false', " + "eventRespawn TEXT DEFAULT 'false', " + "eventSpawn TEXT DEFAULT 'false', " + "extraLives TEXT NOT NULL, " + "lastWaypoint TEXT DEFAULT '10/29/2000 7:30:00 AM' " + ");", "SQLiteDatabase"); FastQuery("CREATE TABLE IF NOT EXISTS Waypoints (" + "wayPointid INTEGER PRIMARY KEY, " + "steamid TEXT NOT NULL, " + "wayPointName TEXT NOT NULL, " + "position TEXT NOT NULL " + ");", "SQLiteDatabase"); FastQuery("CREATE TABLE IF NOT EXISTS Polls (" + "pollid INTEGER PRIMARY KEY, " + "pollOpen TEXT DEFAULT 'false', " + "pollTime TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "pollHours INTEGER NOT NULL, " + "pollMessage TEXT NOT NULL, " + "pollYes INTEGER DEFAULT 0, " + "pollNo INTEGER DEFAULT 0 " + ");", "SQLiteDatabase"); FastQuery("CREATE TABLE IF NOT EXISTS Events (" + "eventid INTEGER PRIMARY KEY, " + "eventAdmin TEXT, " + "eventName TEXT, " + "eventInvite TEXT, " + "eventTeams INTEGER, " + "eventPlayerCount INTEGER, " + "eventTime INTEGER, " + "eventActive TEXT " + ");", "SQLiteDatabase"); FastQuery("CREATE TABLE IF NOT EXISTS EventSpawns (" + "eventid INTEGER NOT NULL, " + "eventTeam INTEGER NOT NULL, " + "eventSpawn TEXT, " + "eventRespawn TEXT, " + "FOREIGN KEY(eventid) REFERENCES Events(eventid) " + ");", "SQLiteDatabase"); FastQuery("CREATE TABLE IF NOT EXISTS Hardcore (" + "eventid INTEGER PRIMARY KEY, " + "steamid TEXT NOT NULL, " + "sessionTime INTEGER DEFAULT 0, " + "kills INTEGER DEFAULT 0, " + "zKills INTEGER DEFAULT 0, " + "score INTEGER DEFAULT 0, " + "deaths INTEGER DEFAULT 0, " + "playerName TEXT NOT NULL " + ");", "SQLiteDatabase"); FastQuery("CREATE TABLE IF NOT EXISTS Tracking (" + "trackid INTEGER PRIMARY KEY, " + "dateTime TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "position TEXT NOT NULL, " + "steamId TEXT NOT NULL, " + "playerName TEXT NOT NULL, " + "holding TEXT NOT NULL " + ");", "SQLiteDatabase"); FastQuery("CREATE TABLE IF NOT EXISTS Config (sql_version INTEGER);", "SQLiteDatabase"); int _version = 1; DataTable _result = TypeQuery("SELECT sql_version FROM Config"); if (_result.Rows.Count == 0) { FastQuery("INSERT INTO Config (sql_version) VALUES (1)", "SQLiteDatabase"); } else { int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _version); } _result.Dispose(); if (_version != SQL.Sql_version) { UpdateSQL.Exec(_version); } else { LoadProcess.Load(4); } } catch (SQLiteException e) { Log.Out(string.Format("[ServerTools] SQLiteException in SQLiteDb.CreateTables: {0}", e)); } }
private static void CreateTables() { FastQuery("CREATE TABLE IF NOT EXISTS Players (" + "steamid TEXT PRIMARY KEY ON CONFLICT REPLACE, " + "playername TEXT DEFAULT 'Unknown', " + "last_joined TEXT DEFAULT 'Never', " + "pingimmunity TEXT DEFAULT 'false', " + "last_gimme TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastkillme TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "bank INTEGER DEFAULT 0, " + "wallet INTEGER DEFAULT 0, " + "playerSpentCoins INTEGER DEFAULT 0, " + "hardcoreSessionTime INTEGER DEFAULT 0, " + "hardcoreKills INTEGER DEFAULT 0, " + "hardcoreZKills INTEGER DEFAULT 0, " + "hardcoreScore INTEGER DEFAULT 0, " + "hardcoreDeaths INTEGER DEFAULT 0, " + "hardcoreName TEXT DEFAULT 'Unknown', " + "bounty INTEGER DEFAULT 0, " + "bountyHunter INTEGER DEFAULT 0, " + "sessionTime INTEGER DEFAULT 0, " + "jailTime INTEGER DEFAULT 0, " + "jailName TEXT DEFAULT 'Unknown', " + "jailDate TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "muteTime INTEGER DEFAULT 0, " + "muteName TEXT DEFAULT 'Unknown', " + "muteDate TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "zkills INTEGER DEFAULT 0, " + "kills INTEGER DEFAULT 0, " + "deaths INTEGER DEFAULT 0, " + "eventReturn TEXT DEFAULT 'Unknown', " + "marketReturn TEXT DEFAULT 'Unknown', " + "lobbyReturn TEXT DEFAULT 'Unknown', " + "newTeleSpawn TEXT DEFAULT 'Unknown', " + "homeposition TEXT DEFAULT 'Unknown', " + "homeposition2 TEXT DEFAULT 'Unknown', " + "lastsethome TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastwhisper TEXT DEFAULT 'Unknown', " + "lastWaypoint TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastMarket TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastStuck TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastLobby TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastLog TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastDied TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastFriendTele TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "respawnTime TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastTravel TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastAnimals TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "lastVoteReward TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "firstClaim TEXT DEFAULT 'false', " + "ismuted TEXT DEFAULT 'false', " + "isjailed TEXT DEFAULT 'false', " + "startingItems TEXT DEFAULT 'false', " + "clanname TEXT DEFAULT 'Unknown', " + "invitedtoclan TEXT DEFAULT 'Unknown', " + "isclanowner TEXT DEFAULT 'false', " + "isclanofficer TEXT DEFAULT 'false', " + "customCommand1 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand2 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand3 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand4 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand5 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand6 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand7 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand8 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand9 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "customCommand10 TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "countryban TEXT DEFAULT 'false' " + ");"); FastQuery("CREATE TABLE IF NOT EXISTS Auction (" + "auctionid INTEGER PRIMARY KEY, " + "steamid TEXT NOT NULL, " + "itemName TEXT NOT NULL, " + "itemCount INTEGER NOT NULL, " + "itemQuality INTEGER NOT NULL, " + "itemPrice INTEGER NOT NULL, " + "cancelTime TEXT DEFAULT '10/29/2000 7:30:00 AM' " + ");"); FastQuery("CREATE TABLE IF NOT EXISTS Waypoints (" + "wayPointid INTEGER PRIMARY KEY, " + "steamid TEXT NOT NULL, " + "wayPointName TEXT NOT NULL, " + "position TEXT NOT NULL " + ");"); FastQuery("CREATE TABLE IF NOT EXISTS Polls (" + "pollid INTEGER PRIMARY KEY, " + "pollOpen TEXT DEFAULT 'false', " + "pollTime TEXT DEFAULT '10/29/2000 7:30:00 AM', " + "pollHours INTEGER NOT NULL, " + "pollMessage TEXT NOT NULL, " + "pollYes INTEGER DEFAULT 0, " + "pollNo INTEGER DEFAULT 0 " + ");"); FastQuery("CREATE TABLE IF NOT EXISTS Events (" + "eventid INTEGER PRIMARY KEY, " + "eventAdmin TEXT, " + "eventName TEXT, " + "eventInvite TEXT, " + "eventTeams INTEGER, " + "eventPlayerCount INTEGER, " + "eventTime INTEGER, " + "eventActive TEXT " + ");"); FastQuery("CREATE TABLE IF NOT EXISTS EventSpawns (" + "eventid INTEGER NOT NULL, " + "eventTeam INTEGER NOT NULL, " + "eventSpawn TEXT, " + "eventRespawn TEXT, " + "FOREIGN KEY(eventid) REFERENCES Events(eventid) " + ");"); FastQuery("CREATE TABLE IF NOT EXISTS Config (sql_version INTEGER);"); int _version = 1; DataTable _result = SQL.TQuery("SELECT sql_version FROM Config"); if (_result.Rows.Count == 0) { FastQuery("INSERT INTO Config (sql_version) VALUES (1)"); } else { int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _version); } _result.Dispose(); if (_version != SQL.Sql_version) { UpdateSQL.Exec(_version); } }