MySQL for TGE
by Ron Yacketta · 03/02/2004 (11:09 am) · 75 comments
Download Code File
I found a forum thread by Felix Kollmann which lead me to a dead end on his site, after reading more of the thread I noticed that Stefan Beffy Moises snagged a copy of the code and tossed it on his www site (Thanxs Beffy!!!).
Looking at the code revealed that it needed a bit of an updated to be TGE 1.2 compliant as well as to get the ball rolling for cross platform compliancy.
I spent an hour or so last night updating the ConsoleMethods and adding a new one, as well as #if def'ing the winsock.h.
Decided to toss this back into the resource section so it does not get lost again. The .zip contains everything you need to get up and running
-Ron
You will need to download the original zip file from Beffy's site in order to use my updates
Updates:
03/04/04 Yacketta updated zip file
Updated 3/15/05
Got am e-mail regarding this resource and the inability to get it working as stated in the documentation. After some minor digging I found that the ConsoleMethod's needed to be updated as follows
the above changes enables one to get this resource compiled using visual studio 2003. I did not perform any unit or end to end tests with a mysql db
-Ron
I found a forum thread by Felix Kollmann which lead me to a dead end on his site, after reading more of the thread I noticed that Stefan Beffy Moises snagged a copy of the code and tossed it on his www site (Thanxs Beffy!!!).
Looking at the code revealed that it needed a bit of an updated to be TGE 1.2 compliant as well as to get the ball rolling for cross platform compliancy.
I spent an hour or so last night updating the ConsoleMethods and adding a new one, as well as #if def'ing the winsock.h.
Decided to toss this back into the resource section so it does not get lost again. The .zip contains everything you need to get up and running
-Ron
You will need to download the original zip file from Beffy's site in order to use my updates
Updates:
03/04/04 Yacketta updated zip file
Updated 3/15/05
Got am e-mail regarding this resource and the inability to get it working as stated in the documentation. After some minor digging I found that the ConsoleMethod's needed to be updated as follows
ConsoleMethod (MySQL, GetRowCellDirect, const char*, 4, 4, "MySQL.GetRowCellDirect (ResultID, FieldNr)")
{
MySQL* pThis= dynamic_cast<MySQL*> (object);
return pThis->GetRowCell (atoi (argv[2]), atoi (argv[3]));
}
ConsoleMethod (MySQL, GetRowCell, const char*, 4, 4, "MySQL.GetRowCell (ResultID, FieldName)")
{
MySQL* pThis= dynamic_cast<MySQL*> (object);
return pThis->GetRowCell (atoi (argv[2]), argv[3]);
}
ConsoleMethod (MySQL, NumFields, S32, 2, 2, "MySQL.NumFields()")
{
MySQL* pThis= dynamic_cast<MySQL*> (object);
return pThis->NumFields();
}
ConsoleMethod (MySQL, GetFieldName, const char*, 4, 4, "MySQL.GetFieldName (ResultID, FieldIndex)")
{
MySQL* pThis= dynamic_cast<MySQL*> (object);
return pThis->GetFieldName (atoi (argv[2]), atoi (argv[3]));
}the above changes enables one to get this resource compiled using visual studio 2003. I did not perform any unit or end to end tests with a mysql db
-Ron
About the author
#2
Thanks for the contribution, I will be needing this.
Thanks, Ben
03/02/2004 (2:48 pm)
Hmm, I had not problems with the link. Thanks for the contribution, I will be needing this.
Thanks, Ben
#4
03/03/2004 (3:55 am)
Thanks for updating it to 1.2. :)
#5
03/03/2004 (12:49 pm)
yeh just needed a litle time to be submitted properly i guess..
#6
03/04/2004 (12:42 am)
Ron: looks like you didn't include your updated source files, only change I spotted was the .cs file, the others were the old ones...
#7
// NEVER USE THE OBJECT AS GLOBAL ONE
// SOMEONE COULD RETRIEVE THE PASSWORD, THEN!!!
why? could someone explain it to me please?
03/04/2004 (3:18 am)
In the included .cs file there is this comment:// NEVER USE THE OBJECT AS GLOBAL ONE
// SOMEONE COULD RETRIEVE THE PASSWORD, THEN!!!
why? could someone explain it to me please?
#9
a global variable (one prefaced with a $) can be accessed from the console as such echo($DaGlobalVariable); while a local variable (prefaced with a %) is only valid within the scope of the function it was created. Once the function exits all local variables created within it are destroyed.
This follows the same basic principals for local and global variables in C/C++ (as well as other languages)
-Ron
03/04/2004 (10:19 am)
@Hadoken a global variable (one prefaced with a $) can be accessed from the console as such echo($DaGlobalVariable); while a local variable (prefaced with a %) is only valid within the scope of the function it was created. Once the function exits all local variables created within it are destroyed.
This follows the same basic principals for local and global variables in C/C++ (as well as other languages)
-Ron
#10
thanks for this cool resource
03/04/2004 (11:24 am)
Ron: ok, i misunderstood what you said, i thought you meant that clients could retrieve the password (i guess the code in the .cs is supposed to be run on the server)thanks for this cool resource
#11
Yes, the mysqltest.cs file should be placed in the server\scripts directory.
-Ron
03/05/2004 (7:34 am)
@Hadoken,Yes, the mysqltest.cs file should be placed in the server\scripts directory.
-Ron
#12
03/05/2004 (8:25 am)
Question: according to the guidelines posted on the MySQL site, does this constitute a product which requires a paid MySQL license?
#13
03/05/2004 (8:38 am)
Got a link to the page with the guidelines? I was going to take a look, and can't find it.
#14
-Ron
03/05/2004 (2:02 pm)
As far as I can tell, you can use MySQL without paying for a license as long as you use the built in "C" api. If you wanted to use the MySQL++ or one of the other API's in a commercial application then you would need to fork out the $ for a license.-Ron
#15
add ../lib/mysql/lib to your lib search path
add libmysql.lib to additional libraries
-These steps could be further commented.
03/05/2004 (7:33 pm)
add ../lib/mysql to your include pathadd ../lib/mysql/lib to your lib search path
add libmysql.lib to additional libraries
-These steps could be further commented.
#16
03/05/2004 (9:13 pm)
I just get a sh*tload of errors after ALOT of different approaches.. useful resource, but not a useful documentation at all. :/
#17


Maybe you also have to add the path to the mysql/lib (and maybe mysql/include) directory to your global options, too...

And of course, copy the files to the right places and add the source files to the project...
and maybe it would help if you posted the errors you are getting...
03/06/2004 (12:57 am)
All I had to do back then is this (which is kinda standard for any lib to add to TGE...)

Maybe you also have to add the path to the mysql/lib (and maybe mysql/include) directory to your global options, too...

And of course, copy the files to the right places and add the source files to the project...
and maybe it would help if you posted the errors you are getting...
#18
I would have posted the log of the errors if they were not so freaking many :P 83 errors and 16 warnings, even.
The lib/mysql/include thing was and still is something unknown to me, as I thought I was meant to go to the include search path under Options and add the path there. (which obviously didn't work) - just like I did with the Directx SDK.
also, mysql/include wasn't even created as a folder when I extracted all the zips, so I took away the "include" path and just left it there.
going to test this when I get home. thanks.
03/06/2004 (5:04 am)
Stefan:I would have posted the log of the errors if they were not so freaking many :P 83 errors and 16 warnings, even.
The lib/mysql/include thing was and still is something unknown to me, as I thought I was meant to go to the include search path under Options and add the path there. (which obviously didn't work) - just like I did with the Directx SDK.
also, mysql/include wasn't even created as a folder when I extracted all the zips, so I took away the "include" path and just left it there.
going to test this when I get home. thanks.
#19
03/06/2004 (5:13 am)
Weird, mysql/include should be in there... at least in my original zip which Ron mentioned above... did you dl that?
#20
03/06/2004 (12:26 pm)
yes, well. there were 3 zip files contained within the archive. I'm going to repeat everything again with the help you offered above and see how it works out.
Torque Owner Westy