MYSQLOO not Creating Tables

Hello, our gamemode is supposed to automatically set up mysql tables in the init.lua using the mysqloo module. The foolowing lines of code are:


function GM:InitPostEntity()
	-- CCGM tables
	if not sql.TableExists("zs_players") then
		sql.Query("CREATE TABLE `zs_players` (  `player_id` INTEGER PRIMARY KEY,  `player_name` varchar(66) NOT NULL,  `steam_id` varchar(22) NOT NULL,  `player_cash` int(11) default NULL,  `player_title` varchar(66) default NULL,  `title_style` varchar(22) default NULL,  `title_color` varchar(22) default NULL,  `title_size` decimal(11,0) default NULL)")
		CCGM_THINK_SQL_NEXTRESYNC = 9999 -- Prevent writing blank info to the SQL, so we can resync(MySQL->Server)!
	end
	if not sql.TableExists("zs_player_achievements") then sql.Query("CREATE TABLE `zs_player_achievements` (`achieve_id` INTEGER PRIMARY KEY,`player_id` INT( 11 ) NOT NULL ,`achieve_type` VARCHAR( 33 ) NOT NULL ,`achieve_value` INT( 11 ) NOT NULL);") end
	if not sql.TableExists("zs_player_exp") then sql.Query("CREATE TABLE `zs_player_exp` (  `exp_id` INTEGER PRIMARY KEY,  `player_id` int(11) NOT NULL,  `playertype_id` int(4) NOT NULL,  `experience` int(11) NOT NULL);") end
	if not sql.TableExists("zs_player_inventory") then sql.Query("CREATE TABLE `zs_player_inventory` (  `inventory_id` INTEGER PRIMARY KEY,  `player_id` int(11) NOT NULL,  `inventorytype_str` varchar(33) NOT NULL,  `inventory_quantity` int(11) NOT NULL);") end
	if not sql.TableExists("zs_player_levels") then sql.Query("CREATE TABLE `zs_player_levels` (  `player_level_id` INTEGER PRIMARY KEY,  `player_id` int(11) NOT NULL,  `playertype_id` int(11) NOT NULL,  `level` int(11) NOT NULL);") end
	if not sql.TableExists("zs_player_upgradepoints") then sql.Query("CREATE TABLE `zs_player_upgradepoints` (  `upgradepoint_id` INTEGER PRIMARY KEY,  `player_id` int(11) NOT NULL,  `playertype_id` int(11) NOT NULL,  `upgrade_points` int(11) NOT NULL);") end
	if not sql.TableExists("zs_player_upgrades") then sql.Query("CREATE TABLE `zs_player_upgrades` (  `upgrade_level_id` INTEGER PRIMARY KEY,  `player_id` int(11) NOT NULL,  `playertype_id` int(11) NOT NULL,  `upgradetype_str` varchar(33) NOT NULL,  `upgrade_level` int(11) NOT NULL);") end

Please help. I can make the tables manually, but then the gamemode does not add steam and and other info into the tables like it’s coded to do. btw… this isn’t perp. I didn’t get the gamemode off DU.

Maybe you should actually use the mysqloo functions.



	Example
	
	require("mysqloo")
	
	local DATABASE_HOST = "localhost"
	local DATABASE_PORT = 3308
	local DATABASE_NAME = "test"
	local DATABASE_USERNAME = "root"
	local DATABASE_PASSWORD = "1234"
	
	function printQuery(query)
	PrintTable(query:getData())
	end
	
	function afterConnected(database)
	local query1 = database:query("SELECT ID, Name, Cost FROM test WHERE Cost > 0.50")
	query1.onData = function(Q,D) print("Q1") PrintTable(D) end
	query1.onSuccess = printQuery
	query1.onError = function(Q,E) print("Q1") print(E) end
	query1:start()
	
	local query2 = database:query("SELECT ID, Name, Cost FROM test")
	query2.onData = function(Q,D) print("Q2") PrintTable(D) end
	query2.onError = function(Q,E) print("Q1") print(E) end
	query2:start()
	end
	
	function connectToDatabase()
	local databaseObject = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)
	databaseObject.onConnected = afterConnected
	databaseObject:connect()
	end
	
	connectToDatabase()
	
	Usage
	Basic functionality:
	
	* mysqloo.connect - Create a new database connection
	Parameters: (hostname, username, password, database, port, 
	unix socket, client flag)
	Returns: Database object
	
	Database object:
	
	* Database:connect - Start connecting to the database
	Parameters: ()
	Returns: Nothing
	
	* Database:escape - Make text safe for queries
	Parameters: (text)
	Returns: Escaped string
	
	* Database:abortAllQueries - Aborts all running queries
	Parameters: ()
	Returns: Nothing
	
	* Database:status - Check database status
	Parameters: ()
	Returns: One of:
	* mysqloo.DATABASE_CONNECTED - (0) - Connected to the database.
	* mysqloo.DATABASE_CONNECTING - (1) - Current is attempting to connect
	* mysqloo.DATABASE_NOT_CONNECTED - (2) - Connection was not successful or has failed
	* mysqloo.DATABASE_INTERNAL_ERROR - (3) - Some internal error occured
	
	* Database:query - Query the database
	Parameters: (query)
	Returns: Query object
	
	* Database:onConnected - Callback when connected successfully
	Parameters: ()
	Returns: Nothing
	
	* Database:onConnectionFailed - Callback when connection could not be established.
	Parameters: (error_message)
	Returns: Nothing
	
	Query object:
	
	* Query:start - Start a query running
	Parameters: ()
	Returns: Nothing
	
	* Query:abort - Abort a query running
	Parameters: ()
	Returns: Nothing
	
	* Query:getData - Get all data from a query
	Parameters: ()
	Returns: Table containing all the data that has been read so far
	
	* Query:setOption - Change query options
	Parameters: (Flag, set)
	Flag is one of:
	* mysqloo.OPTION_NUMERIC_FIELDS - (1) - Use numeric fields when presenting data [default:off]
	* mysqloo.OPTION_NAMED_FIELDS - (2) - Use named fields when presenting data [default:on]
	* mysqloo.OPTION_INTERPRET_DATA - (4) - Auto-convert int/float fields to int/float representation [default:on]
	* mysqloo.OPTION_CACHE - (8) - Cache the data after reading it [default:on]
	
	Returns: Nothing
	
	* Query:status - Check query status
	Parameters: ()
	Returns: One of:
	* mysqloo.QUERY_NOT_RUNNING - (0) - Query has not been started yet.
	* mysqloo.QUERY_RUNNING - (1) - The query is executing on the database.
	* mysqloo.QUERY_READING_DATA - (2) - The query has been run, and is now reading the data back.
	* mysqloo.QUERY_COMPLETE - (3) - The query has completed (successfully or with an error).
	* mysqloo.QUERY_ABORTED - (4) - The query has been aborted.
	
	* Query:onData - Callback when a single row has been received
	Parameters: (data_row)
	Returns: Nothing
	
	* Query:onSuccess - Callback when all data has been received
	Parameters: ()
	Returns: Nothing
	
	* Query:onFailure - Callback when an error occured
	Parameters: (error_message)
	Returns: Nothing
	
	* Query:onAborted - Callback when a query was aborted
	Parameters: ()
	Returns: Nothing


It only uses my mysqloo to connect to the DB. the rest uses sqlite.

sqlite and MySQL are two different types of databases. You can’t expect to use mysqloo to set up a database and then use sqlite to interact with it.