tmysql4 I can't make "Query" work?

Hello guys… :smile:

Okay so I got this kinda problem before, with tmysql4 not working so I hope someone can help.

This is what I’m trying to do:


function GM:Initialize ( )
	Msg("Loading tmysql module... ");
	require("tmysql4");
	
	if (tmysql) then
		Msg("Loaded tmysql module... 
");
	else
		Msg("Failed to load tmsql module... 
");
	end
	
	local db, err = tmysql.initialize("**IP**", "**USERNAME**", "**PASSWORD**", "**DATABASE**", **PORT**);
	
	if db then
         
        print("[MySQL] Connected to SV_DATABASE!
")
        SV_DATABASE = db
         
    else
         
        print("[MySQL] Error connecting to SV_DATABASE:
")
        print(err)
         
    end
     
    db = nil
    err = nil  

The problem is not to “connect” to the database that works just fine. This is my problem:

When I do:


SV_DATABASE:Query("UPDATE `system` SET `value`='" .. os.time() .. "' WHERE `key`='online_" .. GAMEMODE.ServerIdentifier .. "' LIMIT 1");

Just an example.

Then I get this error:


"calling 'Query' on bad self <<null> expected, got userdata>"

I know that this have been working, but now it doesn’t?

You have a very old and broken version of it.

Grab the latest here: http://blackawps-glua-modules.googlecode.com/svn/trunk/gm_tmysql4_boost/Release/

Oh okay thanks. I far as I remember I need to rename it from “gm_tmysql4_win32” to “gmsv_tmysql4_win32”, because if I doesn’t it won’t load it right?

EDIT: It’s working now. I had to get my hands on “msvcr110.dll” and “msvcp110.dll” to get it working.