lua_run require( 'mysqloo' )
lua_run require( 'mysqloo' )
Wut... I typed that to get that message...
The name of the module needs to be enclosed in quotes.
Show me please.
Dude... i type that... and i get this...
Code:> require ( ' mysqloo ' )... LuaGetfile: Not Loading includes\modules\ mysqloo .lua ERROR! Module ' mysqloo ' not found!
You're adding spaces now. Copy and paste this: require("mysqloo")
you can't use " in RCON commands, use [[ and ]]
So if it response with...
Its working?Code:require[[mysqloo]]...
Yes. You might also want to change your rcon password if you haven't already.
Code:require([[mysqloo]])
Its showing...
Im on a wild goose chase...Code:require ( [[mysqloo]] )...
Stop trying to do this in game and just put it straight into your script. You can either use-
require("mysqloo") require('mysqloo') require([[mysqloo]])
I really don't see how you can muck that up.
require[[mysqloo]] should work too, just as require"mysqloo" should work.
I smell a troll =/
Lets not confuse the poster now.
It works, and yes, the only reason I posted this picture was to show off my own steamworks module :)
Hey, myself and 2 other people have been debugging the hell out of this function, and we can NOT figure out what's wrong with it
function DeleteServer(ply) print("Running Delete Server") local playerID= ply:UniqueID() print(playerID) local query = databaseObject:query("DELETE FROM servers WHERE Owner_ID = '"..playerID.."'") query.onSuccess = function() print("Deleted server from database") end query.onError = function() print("Error deleting server from database") end query.onFailure = function() print("Failed to delete server from database") end query.start() print("Server should have been deleted") end
It's being called from another function, which is running fine, and its being called. Here's the console output:
Does anyone have any idea what's up with this function? The same script has 4 other select, insert and update functions, and all of those work fine.Code:Running Delete Server **players uID snipped out** Server should have been deleted Invalid object! (not userdata)
In case anyone is wondering, one of the functions in the same script is inserting data into the same table with the players uID. As you can see, it isn't running the .onSuccess or .onError functions, and status() gives another Invalid Object
query.start()
should be:
query:start()
Are you kidding me. It worked. *facepalm* I can't believe I missed that! I've rewritten that function countless times, and stared at it for hours. And it was something as simple as having a period where a colon should be... Thank you so much Teddi.
Anyone got random crashes while using this module (since latest gmod update)
My server seems to crash when people join, totally bombed while using this!
No issues here.
I was having these issues while experimenting with sourcenet3, would you happen to be using that as well?
Could someone help me, MySql worked perfectly on windows, but now on ubuntu, it doesnt?
yeah, turns out it was the DB itself, being corrupt. Hehe, resetting and dropping all tables worked fine
Are you using the Linux version of the module?
yes
Lol, So im trying to figure this one out
function _R.Player:Exists() Msg("2") local query = databaseObject:query("SELECT * FROM player_info WHERE uniqueid = '"..self:UniqueID().."'") query.onData = function(Q,D) Msg("3") self:LoadStats() Msg("4") end query.onError = function(Q,E) Msg("5") self:NewPlayer() end query:start() end function PlayerInitialSpawn( ply ) ply:Exists() Msg("1") end hook.Add( "PlayerInitialSpawn", "SAVE_PlayerInitialSpawn", PlayerInitialSpawn )
Was wondering why "Exists()" doesnt appear to run, But the "LoadStats()" gets called when this is the only place "LoadStats()" is called...1, and 2 appear. But 3, 4, 5 will not
Is this a pilot error or?
Why is it that connection can be made from the very start but no query will be ran until a player joins?
Queries can be ran, however the results / actions won't be parsed until a player / bot joins due to various reasons (performance mostly).
could i use your mysqloo.dll( s) in another software (not HL2)
I work on lua script(s) with another gaming software and i want to store datas in a mysql database.
Thanks for your help ;-)
mysqloo uses headers and functions specific to Garrysmod so it wouldn't be possible afaik.
Bad news
Thanks
I have also been having issues with my server hanging or crashing while using this module. It seems to only happen when the server has been running idle for a few hours and only player connects and/or disconnects trigger the occurrence. I sometimes see the error in the server console when it crashes and it refers to 'Illegal termination in worker thread'.
I am using it in my gamemode and it works fine on startup and when I join soon after that. I am running the newest version (7).
Here is my gamemode file that handles MySQLOO
Here is an example of how I run queries within my gamemode functions. This is consistent on all functions.Code:local HOST = "localhost" local USER_NAME = "root" local PASSWORD = "*******" local DATABASE = "lprp" local PORT = 3306 require("mysqloo") function GM.MySQLConnect() if !mysqloo then Msg("Error: Check that MySQLOO is installed.\n") return end local dboDB = mysqloo.connect(HOST,USER_NAME,PASSWORD,DATABASE,PORT) print("Connecting to MySQL Server...") dboDB:connect() GAMEMODE.CheckDB(dboDB) print("MySQL connection established!") return dboDB end function GM.CheckDB(dboDB) dboDB = dboDB or DB while dboDB:status() > 0 do if dboDB:status() == 2 then print("Retrying connection to MySQL Server") dboDB:connect() end end end function GM.MySQLError(qQuery,sError) file.Append("lprp_mysql_log.txt",Format("%s %s\n",os.date("%m/%d/%Y %I:%M:%S"),sError)) print(sError) end
Also, it usually hangs most of the time on PlayerDisconnected after i have been connected and idle for a few hours, so here is the function that is ran on this hook.Code:function Player:LoadCharacters() GAMEMODE.CheckDB(DB) local q = DB:query(Format("select * from characters where AID=%q",self.LPRP.Account.ID)) q.onError = GAMEMODE.MySQLError q:start() q:wait() self.LPRP.Characters = q:getData() for k,v in pairs(self.LPRP.Characters) do v.FirstName = string.sub(v.FirstName,1,1)..string.lower(string.sub(v.FirstName,2)) v.LastName = string.sub(v.LastName,1,1)..string.lower(string.sub(v.LastName,2)) local status,r = pcall(glon.decode,v.Inventory) if status then v.Inventory = r or {} else v.Inventory = {} end v.Weight = 0 for k2,v2 in pairs(v.Inventory) do v.Weight = v.Weight + GAMEMODE.Items[k2].Weight*v2 end end end
It usually crashes on PlayerConnect after long idle time but I don't actually run any queries until PlayerInitialSpawn.Code:function Player:SaveAccount() self.LPRP.Account.TimePlayed = self.LPRP.Account.TimePlayed+self:TimeConnected() self.LPRP.Account.LastJoin = os.time() GAMEMODE.CheckDB(DB) local q = DB:query(Format("update accounts set TimePlayed=%q,LastJoin=%q where SteamID=%q",self.LPRP.Account.TimePlayed,self.LPRP.Account.LastJoin,self:SteamID())) q.onError = GAMEMODE.MySQLError q:start() q:wait() end
My code refers to a global var, DB, which is set when the server starts up and connects to the MySQL server.
This module leaks threads. Every time you run a blocking query (with :wait()) the thread never appears to terminate, and over time you will find they grind your servers FPS down and eventually it will crash. tmysql was the only solution I could find, but beware of race conditions since it does not do blocking queries!
You shouldn't be using wait() in the first place. This module is asynchronous and besides, the callback function itself waits to see if it gets a response or not (hence onError and onFailure).
Someone needs to fix the OP since the list tag was removed.
Is there a function alike to PHP's mysql_insert_id in this library?
DATABASE_OBJECT:query("INSERT INTO