MySQL dll

Posted By: Destop

MySQL dll - 02/25/05 19:28

Here is a dll that permits to connect A6 with a MySQL database
Get it here

There is documentation and FULL source code (cause otherwise, you need to compile MySQL and mysql++ to get the libs)

I hope that you will find this usefull.
And feel free to send me a pm if this was usefull to you.
Destop
Posted By: AndyH

Re: MySQL dll - 02/26/05 02:01

I have tried to use this in my project and I get:

Quote:

A6mysql.dll - no valid Acknex DLL




Here is what I do in main:

Code:
 function main()
{
ifdef server;
mysql_handle = dll_open("A6mysql.dll");
endif;

[snip]



I actually hit this barrier writing my own mysql.dll and thought it was my dll creation skills. What am I doing wrong when trying to use this dll please?

A6 commercial - 6.31.4

Andy
Posted By: Konrad_Neitzel

Re: MySQL dll - 02/26/05 03:30

Hmm ... I tried the DLL, too. I get the same error. And I have A6 Commercial 6.31.4, too.

I just checked the DLL I compiled on my own and I get the error message with that DLL, too.

Could it be, that the commercial version has a problem with loading DLLs?

Does the DLL work for some people?

Konrad
Posted By: Konrad_Neitzel

Re: MySQL dll - 02/26/05 04:07

Ok - it was my fault. The a6mysql.dll works fine now. I just tried it without the mysql Libs available. After installing mysql on my computer, the dll could be loaded without problems.

I installed the whole server - not sure, which DLLs are needed to use that DLL.

Hope that helps a little.

(But then I still don't know, why my DLL couldn't be loaded.)

Konrad

Edit: I should test more before posting You need the libmysql.dll! Just copy it into your project. Then you should be able to load the a6mysql.dll.
Posted By: AndyH

Re: MySQL dll - 02/26/05 04:26

Quote:

Edit: I should test more before posting You need the libmysql.dll! Just copy it into your project. Then you should be able to load the a6mysql.dll.




Fantastic! Many thanks, putting the libmysql.dll, from the mysql install directory (/bin), into my project directory solved this problem for me as well.

Many thanks again,

Andy
Posted By: Konrad_Neitzel

Re: MySQL dll - 02/26/05 04:32

Great, that I could help you. And with my quick test, I made the same error. My lib also needed 2 otehr DLLs to be loaded. Not my day

Konrad
Posted By: JvsJGameDesign

Re: MySQL dll - 02/26/05 05:30

This DLL can be handy by creating a register page on your website to store data in a database, so you can let your game retreive information from the database.
Posted By: Samb

Re: MySQL dll - 02/26/05 06:10

I can only see "get" commandos
can this plugin also write in a databse?
Posted By: AndyH

Re: MySQL dll - 02/26/05 06:25

By using mySQL_ExecQuery you can perform any legal query you want as though you were entering it directly into your MySQL client. eg.

mySQL_ExecQuery("INSERT INTO `players` (`name`) VALUES ('new_char')");

or

mySQL_ExecQuery("UPDATE `players` SET `passwd`='new_passwd' WHERE `name`='new_char'");

or

mySQL_ExecQuery("DELETE FROM `players` WHERE `name`='new_char'");

etc., etc.

This is an awesome contribution!

Andy
Posted By: Excessus

Re: MySQL dll - 02/26/05 06:42

Is mySQL free? Where can I get it?
Posted By: AndyH

Re: MySQL dll - 02/26/05 06:58

Quote:

Is mySQL free? Where can I get it?




Yes, it is free, try http://dev.mysql.com/
Posted By: Excessus

Re: MySQL dll - 02/27/05 01:33

I have copied the libmySQL.dll in my project, but it still gives the error "A6mySQL - no valid ACKNEX DLL".. What other plugins did you have to copy, and where?
Posted By: Konrad_Neitzel

Re: MySQL dll - 02/27/05 03:50

Hmm ... sounds strange.

What I found until now, that single DLL shouls be enough.

At the moment, I can think of two possibilities:
1) maybe some standard Libary is used, that is still missing on your system? Like the mfc*.dlls?
2) I found multiple libmysql.dll on my system. One direktly inside the bin directory (which should be the right one) and then unter "embedded". Don't know, what is that for.

I would try to install mysql 4.1 server on the system. That should solve the problem. When you install the mysql 4.1 server using the installer, you can tell the installation to insert the bin directory to your path. Then you must not copy any lib - the system finds all on its own.

Hope that works for you. I checked the Project of the a6mysqlk.dll and found no need for other libs. So mybe your libmysql.dll is the wrong one or this lib has another dependency, that is not matched.

With kind regards,

Konrad Neitzel
Posted By: Excessus

Re: MySQL dll - 02/27/05 04:19

Quote:

What I found until now, that single DLL shouls be enough.



Ok, I thought you mentioned above that you needed another 2 plugins:
Quote:

My lib also needed 2 otehr DLLs to be loaded. Not my day



Could that be the same problem as mine?


Quote:

1) maybe some standard Libary is used, that is still missing on your system? Like the mfc*.dlls?



I don't know what those mfc dlls are for, but when doing a search for them I found a few mfc*.dll's in C:\WINDOWS\SYSTEM and some in other directories, but none in a mySQL or related folder..


Quote:

2) I found multiple libmysql.dll on my system. One direktly inside the bin directory (which should be the right one) and then unter "embedded". Don't know, what is that for.



I found only one libmySQL.dll on my system, plus the one I copied in my project.


Quote:

I would try to install mysql 4.1 server on the system. That should solve the problem. When you install the mysql 4.1 server using the installer, you can tell the installation to insert the bin directory to your path. Then you must not copy any lib - the system finds all on its own.



I only installed mySQL 4.1 yesterday, so doing that again seems useless.. Also, when I install I didn't get choice to place the bin directory in another path.
Posted By: Konrad_Neitzel

Re: MySQL dll - 02/27/05 17:06

Some points, I can explain:

1) There are some Libaries from Microsoft that were commonly used. One Library is "Microsoft Foundation Classes" short MFC. They exist in multiple version. Most commonly used are 4.2, 7.0 and the newest is 7.1 I think.
When a product uses them, they will normaly install it through a redistribution-pack from microsoft. They install under system32 directroy. (So it is ok)

2) That error message from conitec simple means, that the DLL cannot be used. This could be, because the DLL is not valid or that some requirements are not available. The a6mysql.dll needs the libmysql.dll. My own DLL, that I am writing at the moment, needs 2 Libs (pthreads and HawkNL).

When you look at the MFC-DLLs, you will see, that the version is available inside the name. mfc42* (4.2) mfc70* (7.0) and so on.
The libmysql.dll has no version in it's name, but you can be sure, that there are different versions available. And you got another installer than me. So I think, that you are using a different Version than me and the author.

I am using mysql-4.1.10-win32.zip from mysql.com. So maybe it works for you with this DLL.

Destop: Could you add the libmysql.dll in your zip File? So that all requirements are met with your distribution? Thank you in advance!

I hope, that this helps a little. If you want, I can send you my libmysql.dll (1MB only unzipped).

With kind regards,

Konrad
Posted By: Destop

Re: MySQL dll - 02/27/05 21:46

libmysql.dll is now included in the archive.
There is no need for the MFC dll, as this project is not MFC, it is plain win32.
Posted By: Konrad_Neitzel

Re: MySQL dll - 02/27/05 22:16

Heya ... thank you for your quick reaction! That was really quick!
Posted By: AndyH

Re: MySQL dll - 03/04/05 00:59

I am getting into this dll now and have the basics sorted out (INSERT, UPDATE, DELETE)

What I need to do moving forward is to run a SELECT query to get a result:

"SELECT FROM `player_index` WHERE `name` = 'player'"

I then need to simply see if this returns a row or does not. Basically it is to see if the player exists in the database prior to creating him/her. If exists then ask for passwd, if doesn't exist then start player creation.

What dll functions can I use to do this that are in this dll? I am looking at mySQL_GetStr but cannot figure it out!

Thanks for any help,

Andy
Posted By: Destop

Re: MySQL dll - 03/04/05 22:20

To check if your player is already created or not, I would use this SQL order:
"SELECT count(*) FROM player_index WHERE name='player'"
And then check the result with mySQL_GetVal(0, 0), if you got a 0, MySQL didnt found your player.

Or, use the mySQL_RowNumber() - Return the number of row in the result dataset.

Destop
Posted By: AndyH

Re: MySQL dll - 03/10/05 23:09

Thanks Destop,

Things are falling into place nicely. Thanks again for this contribution

AndyH
Posted By: Destop

Re: MySQL dll - 03/11/05 00:27

I am glad this was usefull to you and to your project
Posted By: mission_fatal_forces

Re: MySQL dll - 04/05/05 00:38

wich port does this use?
because i doesnt connect for me, even if i try to connect to the localhost.
Posted By: athur_dent

Re: MySQL dll - 04/05/05 05:03

it depends wether there is a mysql database aviable on your localhost or not, i guess...

thanks, destop, nice thing, useful for lot of things...

what about any credit or royalty?

@ other users: did you expirience any bugs? i want to use it in professional products, so i need closure...

thanks
Posted By: mission_fatal_forces

Re: MySQL dll - 04/05/05 05:06

Quote:

it depends wether there is a mysql database aviable on your localhost or not, i guess...





yes, ofcourse there is a database availble.
im having a sql database for ages on my pc, for some other game hosting. but this one cant connect to it.
very strange.
Posted By: Destop

Re: MySQL dll - 04/05/05 05:21

Quote:

what about any credit or royalty?



Free for all!

There is an example I think in the help file, with a local db example!
Posted By: Konrad_Neitzel

Re: MySQL dll - 04/05/05 13:50

In Antwort auf:

yes, ofcourse there is a database availble.




Pls check the configuration of your database! Then you will see the the port your database is using and you will see, if tcp/ip is enabled! A lot of default installations just disable tcp/ip for security reasons, so that you are safe!

That way you need to know, what you are doing and until you learned, how to activate it, you also have learned to set passwords and so on

All details can be found in the mysql manual.

Hope that helped a little.

With kind regards,

Konrad
Posted By: mission_fatal_forces

Re: MySQL dll - 04/05/05 16:03

tcp/ip was already enabled.
and im using the db connect script from the readme as base.
so i dont know what the problem is.
tcp/ip port is btw: 3306(standard)
Posted By: Wiz

Re: MySQL dll - 04/22/05 20:19

Thanks man! Great plug-in, and more functions like a fetch-array function would only make it better...
Posted By: KyiasShadow

Re: MySQL dll - 04/28/05 23:59

Hey guys just read all of this. i have done work with SQL on numerous occasions. BUT, im having trouble using it in 3DGS. how do i connect to teh database? what funcitons do i use? never used DLL's in 3DGS either can anyone help?? i assume the same as everything else PHP,Javascript etc you need to connect to teh database before i can do anything, how in C can i do this?
Posted By: KyiasShadow

Re: MySQL dll - 04/29/05 15:01

ANyone?
Posted By: Wiz

Re: MySQL dll - 04/30/05 08:29

First define the function:
Code:
 
//--------------------------------------------------------------------
// DLL-declarations
//--------------------------------------------------------------------
dllfunction mySQL_Connectdb(w,x,y,z); // declaration of a DLL function
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();



Then you can connect to the database with this little piece of code:
Code:
 mySQL_Connectdb("database","localhost","username","password") 


Change the database, localhost, username and password to your own.

Then you can execute a normal mysql query with mySQL_ExecQuery('query');
(there are tons of tutorials explaining this on the internet).

Now it's time to look at the information using either:
Code:
 
mySQL_GetVal(x, y); // gets the var value of the position x,y in the returned data
mySQL_GetStr(string, x, y); // assigns the value of x,y to the string string



Hope this helped a bit.
Posted By: KyiasShadow

Re: MySQL dll - 04/30/05 09:51

Yep this has helped allot.

Has anyone done any work on a user login and register part in there game? just thinking thru ho w the hell im gona go thru this in C, its not the same as doing it in php :P

Anyone got any tips?
Posted By: Wiz

Re: MySQL dll - 04/30/05 11:06

I am working on a system for that right as I type, but I just started out so it may take a while before I have something to show.
Posted By: Wiz

Re: MySQL dll - 04/30/05 13:23

Ok, now I've made a simple login system using inkey and a short sql query. It works quite well actually. First it takes input from the user stating both username and password, then it puts that information into a string containing a query for the a record with this username and password in the users table. If there is no such record it terminates, if it exists it continues to load information about the user from the db.
Posted By: KyiasShadow

Re: MySQL dll - 05/01/05 01:10

Thisis the bt that lost me, using the SQL in with C. how using th strings with the SQL? you have a small example? i learn faster that way lol.

done php about 2 years ago and it was much different using sql.

Im using Inkey anyway.

thanks
Posted By: Wiz

Re: MySQL dll - 05/01/05 08:00

You can make the normal type of sql query:
select * from users WHERE username='USERNAME' AND password='PASSWORD';

You can create this string in c-script using the str_cat function:
Code:
 
string query; // holds the mysql query
string username; // holds the username
string password; // holds the password

//Take input here//

str_cat(query, "select * from users WHERE username='");
str_cat(query, username);
str_cat(query, "' AND password='");
str_cat(query, password);
str_cat(query, "';");



The str_cat function basically adds the second string given to the function at the end of the first string. For more information on this function, look it up in the manual.
Posted By: KyiasShadow

Re: MySQL dll - 05/01/05 08:54

Ok. yep i understand this.

Now what happens if the user gets their password of username wrong? how do i check to see if its in the database and if its right or wrong? could i put this SQL into a IF statment?
Posted By: Wiz

Re: MySQL dll - 05/01/05 09:14

You could check how many rows are returned after the query by using the command mySQL_RowNumber(). If it returns 1 then it should be ok, but if it returns 0 something is wrong because then it hasn't found anything.
Posted By: KyiasShadow

Re: MySQL dll - 05/01/05 16:44

Yes yes. but how? i really stuck here. i have inkey on the username? do i need 2 inkeys? no? And do i use if staments to work this out if theres a user in teh databse or not? is what ima sking :P

Do you know of any examples? been screwing my brain over this all night
Posted By: Wiz

Re: MySQL dll - 05/01/05 17:17

Call this from main:
Code:
 

string query;
string username;
string password;

function userlogin(){

if(!mySQL_IsConnected()&&!mySQL_Connectdb("dbname","localhost","dbuser","dbpass")){
beep;exit;
}


inkey(username);
inkey(password);

str_cat(query, "select * from users WHERE username='");
str_cat(query, username);
str_cat(query, "' AND password='");
str_cat(query, password);
str_cat(query, "';");

if(mySQL_ExecQuery(query)&&mySQL_RowNumber()==1){
loggedinok=true;
}else{
exit;//if no entry, exit
}


//now you can gather info from the db

mySQL_Closedb();
}


This is a quick code I trew togheter, but you will see the main principles. Of course you may alter the code that exits if there is no such account, maybe show an error and let the user try again.
Posted By: KyiasShadow

Re: MySQL dll - 05/01/05 18:13

Yep cool thank you very much, whilst waitign for a reply i spent an hour wopkring it all out and throwing some togather it runs but it doesnt work :P ill use yours as a guide lines lol thanks man.
Posted By: KyiasShadow

Re: MySQL dll - 05/02/05 16:27

if(!mySQL_IsConnected()&&!mySQL_Connectdb("******","localhost","root","****"))

it doesnt do ntohign i mean it beeps and exits liek it shoujdl if theres no conectionb ut there is a ocnection ebcaue there son in teh main
Posted By: KyiasShadow

Re: MySQL dll - 05/02/05 16:42

Stupid Kyias. dont wory blond monmey i didnt change teh sql.

ok no nvm i just trid it with eveyrthing correct it still exits and does not wotk.
Posted By: KyiasShadow

Re: MySQL dll - 05/04/05 09:48

Ok.

Sorted everything out and now. its saying. Not a valid dll. hmm ive tried all the dll's that are suplied and all of the DL's on the MYSQL Server i have and still nothin. i alsp updated patch and still no luck? can anyone help?
Posted By: Wiz

Re: MySQL dll - 05/05/05 07:49

Do you have both:
libmysql.dll AND A6mysql.dll
in the acknex plug-in folder?
Posted By: KyiasShadow

Re: MySQL dll - 05/06/05 00:24

No. i dont.
Ther ein my work folder. i need them there? my work folder is not in the actual GStudio folder in Program folder
Posted By: Wiz

Re: MySQL dll - 05/06/05 06:05

If they are in your work folder you need to be sure that you have opened the dll-file from inside the script before you try to use it.
Posted By: KyiasShadow

Re: MySQL dll - 05/06/05 14:29

Ok.

Im abotut o try both of these files are now in the plug folder. im only using Libmysql.dll

Its also in my publised folder.

Lets see the result. ill update in a bit later.

Do i need to open Libmysql and A6Mysql. because it still does not understand some of teh comands. but no more A6 error.
Posted By: KyiasShadow

Re: MySQL dll - 05/07/05 23:12

Done and dusted thanks. it works all good now.



5* topic here.
Posted By: KyiasShadow

Re: MySQL dll - 05/07/05 23:52

Well im back for more..


God damn.

All compiled to check what its like compiled run the EXE and it just doesnt like it. when it gets to checking to see weather or not the it is connected to the database it replies with a no. lol. and my game ends. but when i runt he game from C Script it works fine. wich i find strangley odd.


Any ideas? its not my fire wall i turned it off.

Oh another thing. i have LibMySQL.dll and A6MySQL.dll in the plugins folder and my compiled game folder. for some reason when i am running it through the C edditor it compiles the A6MySql.dll instead of the one that am telling it to use in my script wich is the LibMySql.dll


Heres the cutouts of my script wich im using.
Code:


string libmysqldll = <libmysql.dll>;
var_nsave mysql_handle;

..


Then in the main
Code:

mysql_handle = dll_open(libmysqldll);
mySQL_Connectdb("Database","localhost","root","yeah");


Finally teh actual script wich uses this.
Code:

if(!mySQL_IsConnected()&&!mySQL_Connectdb("Database","localhost","root","yeah"))
{
beep;
exit; //If no conection to that database then give error
}

txtName.visible = on;
inkey(username);
txtName.visible = off;
txtPassword.visible = on;
inkey(password);
txtPassword.visible = off;

str_cat(Login_Query, "select * from Accounts WHERE Account_Name='");
str_cat(Login_Query, username);
str_cat(Login_Query, "' AND Password='");
str_cat(Login_Query, password);
str_cat(Login_Query, "';");
mySQL_ExecQuery(Login_Query);

if(mySQL_ExecQuery(Login_Query)&&mySQL_RowNumber()==1)
{
Join_Lan();
}
else
{
beep;
exit;//Wrong exit

}




I cant see what it is doing wrong. when compiled it doesnt work. when runt hrough C Script edditor it all works Ace. even tho its trying to use the A6 Dll.

Thanks.
Posted By: Wiz

Re: MySQL dll - 05/08/05 16:01

I think you may have to open the A6MySQL.dll from your script and not the other one.
Posted By: KyiasShadow

Re: MySQL dll - 05/08/05 18:31

Have done. still nothing lol
Posted By: frescosteve

Re: MySQL dll - 05/10/05 20:25

Argh! Im having problems still with just opening the dll. I copyed the libmysql.dll into the plug-in folder and work folder i done the same with the other dll to. Any more suggestions?
Posted By: Wiz

Re: MySQL dll - 05/11/05 13:55

Have you defined the dll-functions? And if it still doesn't work try open the A6mysql.dll manually from main.
Posted By: KyiasShadow

Re: MySQL dll - 05/12/05 07:08

Fres. go over this thread copy most of the code to get it working. read alll the opsts ands you should get to where i am. the fact Achnex dont like the files still. this is weird and doing my head in. it works fine then run form C script and Wed but when compiled and run it doesnt like and and cant pick up tyhe database.
Posted By: KyiasShadow

Re: MySQL dll - 05/12/05 07:09

Anyone who has this working oplease help. ive done everything it works fine. j7ust when compikled it doesnt connect or pick up theres a conection between the databses and close as its told. Scipts are on teh othe rpage all defined all included.
Posted By: Wiz

Re: MySQL dll - 05/12/05 12:22

It works great for me, before and after publish. Just remember to put the dll-files in the .cd directory(I had to do this manually).
Posted By: KyiasShadow

Re: MySQL dll - 05/12/05 15:19

Yeah so did i. i might re install 3DGS.

It just doesnt like it once its published ive tried eveything lol
Posted By: KyiasShadow

Re: MySQL dll - 05/12/05 15:22

This is so Weirdy.
Posted By: KyiasShadow

Re: MySQL dll - 05/14/05 15:21

Hmm. this is ANOYING me lol

Unistalled done everything i know of and still when compiled it does not connect to teh database and close.

This sucks, I might ask Conitec.
Posted By: frescosteve

Re: MySQL dll - 05/14/05 23:13

ok i have this at the top of the script:

dllfunction mySQL_Connectdb(w,x,y,z); // declaration of a DLL function
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();

this at the bottom of the main function:

dll_open("A6mySQL.dll");
mySQL_Connectdb( "mytablename", "localhost", "myusername", "mypassword");

i have the two dll's in the directry my work is in and in the acknex_plugins folder.?? any ideas?
Posted By: KyiasShadow

Re: MySQL dll - 05/18/05 23:46

Jesus ****, about time lol.

Thanky you. i changed the

dll_open("A6mySQL.dll");
mySQL_Connectdb( "mytablename", "localhost", "myusername", "mypassword");

Form the top of my main to the bottom and it worked fine. wtf weird.

Thanks all this is a 5***** Topic.
Posted By: Captain_Kiyaku

Re: MySQL dll - 06/30/05 14:38

hmm i can't connect to my database o_O
this is my script:

function fnc_connect_to_database()
{
wait(1);
dll_open("A6mysql.dll");
hr = mySQL_Connectdb("databse", "host", "user", "password");
while(1)
{
draw_text(str_for_num(blub, hr), 200,200, vector(0,0,255));
wait(1);
}
}

of course i used my real log in data in the script, but i can't connect.
my PHP files works all with thoose settings.

I can ping my website too so i don't think it's an internet problem? i even closed the firewall.

Do i have to tell 3dgs it should connect to the internet before i start it?
(i even can't do network tests with 3dgs anymore...)

well the variable hr always returns 0, so it's not connected.
Posted By: KyiasShadow

Re: MySQL dll - 07/01/05 12:32

Ok.

Just a couple of things i would like to know before i help.

What Version are you using?
Are you using Commercial or Pro?

Ok. Whats in your function main you need to connect to the Database within your Main function or before you do ANY querys. Have you donwloaded teh file that is on page one and put all DLL's in the right folders of your Game Studeio folder. Have you "Included" them into your script and all of teh commands.

For example. Below is every single bit of script i have in my login script for my game but it connects locally to 127.0.0.1 because i dont have pro..
Code:

//LOGIN STERINGS
string Login_Query; // holds the mysql query
string username[16]; // holds the username
string password; // holds the password
string libmysqldll = <libmysql.dll>;
var_nsave mysql_handle;



Then
Code:

////////////////////
//DATABASE FUNCTIONS
dllfunction mySQL_Connectdb(w,x,y,z);
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();



After this i have all of my panels/texts that are in the login script. have you added functions to these to handle the login scripts wich mine will be below.

Code:

////////////////////
//TEXT'S
text txtName
{
pos_x = 575;
pos_y = 115;
layer = 30;
font fnt_century12;
string username;
}
text txtPassword
{
pos_x = 575;
pos_y = 115;
layer = 30;
font fnt_century12;
string password;



Now for what is in my function Main.
Code:

//Main Function
function main()
{

mouse_on();
level_load(MPLevel); //Load the first level
sleep(.2);
While (!bat_set)
{
wait(1);
}
mysql_handle = dll_open(libmysqldll);
mySQL_Connectdb("databse","host","user","password");
}



Ok now i have a buttony ou push then a login apears. within this is the login script that i use for the 2 Textxs that were showsn earlier.
Code:

mySQL_Connectdb("databse","host","user","password");
if(!mySQL_IsConnected()&&!mySQL_Connectdb("databse","host","user","password"))
{
beep;
exit;
}
txtName.visible = on;
inkey(username);
txtName.visible = off;
txtPassword.visible = on;
inkey(password);
txtPassword.visible = off;

str_cat(Login_Query, "select * from Accounts WHERE Account_Name='");
str_cat(Login_Query, username);
str_cat(Login_Query, "' AND Password='");
str_cat(Login_Query, password);
str_cat(Login_Query, "';");
mySQL_ExecQuery(Login_Query);
if(mySQL_ExecQuery(Login_Query)&&mySQL_RowNumber()==1)
{
Join_Game();
}
else
{
beep;
exit;//if no entry, exit

}



Ok thats it all of my scripts that are needed for a logging but make sure that te game is being hosted first or else it wil not work.

Make sure you downloaded the MYsql software that you need and that it is all hosted. If your doing it localy. if your doing it on a Dedicated server it should be on there. Make sure that the hjost of your Ded Server allows you to connect to the database like this it should.

If you are still havign problems the reply again you shoudl have ot tell it to connect to teh internet as your net should always be open. or you will have to connect.

Think thats everything.
Posted By: Captain_Kiyaku

Re: MySQL dll - 07/01/05 12:51

that's a good explanation, thanks :>

you said: "but it connects locally to 127.0.0.1 because i dont have pro.."
Does it mean only the pro version can connect to a webserver?
Well i have the newest com version. So this might be the problem?
Posted By: KyiasShadow

Re: MySQL dll - 07/01/05 14:14

Yes. only Pro can connect to a web server. From what i understand this may be your problem.

You might have ot ask conitec them selfs but i think thats your problem im saving up for pro so i can do mor then 4 players
Posted By: Captain_Kiyaku

Re: MySQL dll - 07/01/05 17:01

-_- so this will be the problem :<

That sucks a lot ^^'' Well i have no money for the pro so i better find another way...
Posted By: KyiasShadow

Re: MySQL dll - 07/02/05 13:22

Yes same here.

Just do what im doing do it locally and test it on a lan like i am you dont even need 2 computers just run server then player on teh same computer and connect to 127.0.0.1 and install all MYSql that you need on your computer. or you could just say connect to localhost , user = root, password what ver you set when you set it up.. Check page 1 to find out where you can get it from.

Good luck.
Posted By: Captain_Kiyaku

Re: MySQL dll - 07/02/05 14:01

hmm yes, but i actually want people to connect over the internet to my server program and send there position and other informations to a database to save it there.
^^
Posted By: KyiasShadow

Re: MySQL dll - 07/04/05 21:47

Sounds like a way that may cause some Lag.

Lets see if i thinkw hat your saying is:
They to run the game
You to run game as server
Them to connect to your server over internet?
all stats saved to SQL server....

they will still have to connect to the server. you might still need pro..
Posted By: Captain_Kiyaku

Re: MySQL dll - 07/04/05 22:14

yepp i think i really need the pro for it ^^' so i can forget it -_+
Posted By: Wolfgang_Knecht

Re: MySQL dll - 07/09/05 22:15

i own a6 pro, but i can't connect to my database over the internet.

i have tested the c-script with a local database... no problem, it works fine.
i have tested the online database with php... no problem, i can connect the online database with php.

can anyone help me, connecting my online database via c-script?
Posted By: Wiz

Re: MySQL dll - 07/11/05 20:49

Maybe the dll don't support other than localhost connections.
Posted By: KyiasShadow

Re: MySQL dll - 07/13/05 01:23

It should work. Nothing wrong with the DLL as far as i know. Should be teh same scripting just a different connection IP.
Posted By: KyiasShadow

Re: MySQL dll - 07/13/05 01:24

Oh make sure all Capital and Lower case letters are the same.
Posted By: Wolfgang_Knecht

Re: MySQL dll - 07/13/05 12:28

thanks for your replies, but i think, i know the problem now.
because of security risk may the database can only be connected from the server, where the webpage is saved.

so it's not a problem from the dll.

i have contacted my webspace provider to ask if they can do something against that "problem"... but i havn't got a reply until now.

have a nice day!
wolfgang
Posted By: Leonardo

Re: MySQL dll - 07/14/05 14:19

I have a problem. I can't even connect to the database. Correct me if I'm wrong, but all the names of the databases are shown at the right side, when you work with the Query Browser, right? By default there is a mysql and a test database in the beginning, correct? and by default there is a user "root", to whom I assign a password. If that's all correct I don't see the problem. My code:

mySQL_Connectdb("test","localhost","root","password");

I copied this exactly the way i have it, besides the password of course...

Help me!!
Posted By: KyiasShadow

Re: MySQL dll - 07/14/05 16:35

Ok. Its best to download a agent to manage the database SQLyog is a very good one. Create your own database for starter. Make sure you have configured teh database using the MYSQL Configure that is in teh start menu. And make sure in the configure you made an account. The Password will be the password you created in teh configure, yes its root. yes its localhost or 127.0.0.1 and the table "test" can be what ever table you have created wich is best. i had problems but i just kept trying and figured it out read this whole thread youll find it easier.

Oh and turn of your fire wall when you are testing.
Posted By: tHePrO3Et

Re: MySQL dll - 07/24/05 16:24

Can someone give me a tutorial for the MySQL plugin on how to use it. I'm totally clueless.
Posted By: Leonardo

Re: MySQL dll - 07/24/05 17:24

Your not the only one. I wish someone could talk to me on MSN or Skype who has a working example of this mySQL plugin. If someone can do that, please PM me. Please!! I'm desperate!
Posted By: Destop

Re: MySQL dll - 07/25/05 09:05

I ll post a quick example of how to retreive data from MySQL using the plug-in to help you all!
I dont know why I didnt put a tutorial in it at first, but I ll do it.
Posted By: BoH_Havoc

Re: MySQL dll - 08/06/05 23:06

I have a question concerning mySQL_GetVal(x, y)

Quote:

Return the value of the numeric field x at the line y of the resultset




err... how can i set the resultset?
At the moment, everytime i call that function, i get a crash in mySQL_GetVal ... which is logical as no resultset is set.


and just as a side note: your dll really kicks ass! good job!

[edit]

here's my code

Code:
function mySQL_read_position
{
mySQL_ExecQuery("USE test");
mySQL_ExecQuery("SELECT * FROM position");
temp = mySQL_GetVal(1,1);
if (temp > 0)
{
msg_show("mySQL data read!");
}
if (temp == 0)
{
msg_show("mySQL data does not exist!");
}
if (temp == -1)
{
msg_show("not a numeric field!");
}
}



this leads to "crash in mySQL_GetVal: waitt(secs*16)" .
so what needs to be changed?

[edit2]
well, as this is really important for me (mySQL is the heart of my game. Without it, the game is technically not possible) here's some candy for you: the person that helps me out gets this model-/texturepack:
http://projecthavoc.pr.funpic.de/gallery/sci-fi-pack/

you can do everything with the pack you want. change it, sell it, burn it ... it's up to you
Posted By: BoH_Havoc

Re: MySQL dll - 08/09/05 15:31

c'mon guys, i can't belive that there's nobody who can tell me how to set the resultset.
*falls on his knees* pleeeease
Posted By: KyiasShadow

Re: MySQL dll - 08/09/05 21:45

HAvent used it yet so i dont know mate sorry.
Posted By: BoH_Havoc

Re: MySQL dll - 08/10/05 20:19

omg i'm such a dumbass xD
have a look at this line:

msg_show("mySQL data read!");

now what's wrong about it?
I FORGOT TO SET THE TIME THE MSG IS SHOWN! OMG xD

-> msg_show("mySQL data read!",10);

=> everything works fine! no more errors!

PS: you are allowed to laugh
Posted By: KyiasShadow

Re: MySQL dll - 08/11/05 13:51

LMFAO io didnt even look at your script either. Its always best to make sure you like check it and keep checking it.
Posted By: Specterdragon

Re: MySQL dll - 08/17/05 02:59

OK.. have to finally chime in... I managed to connect the DB without any problems... heres my code snippit:

Code:


str_cpy(test_text.string[1], "Connecting to DB");
sleep(1);

var hr;
hr = mySQL_Connectdb("dbname","localhost","root","password");
if(hr == 1)
{
str_cpy(test_text.string[1], "DB is connected and online");
sleep(1);
mySQL_ExecQuery("use table01;");
}
else
{
str_cpy(test_text.string[1], "DB failed to connect");
sleep(5);
exit;
}

// get an entry from the DB
str_cpy(test_text.string[1], "Performing query");
sleep(1);
hr = mySQL_ExecQuery("select * from table01 where name='index';");
str_cpy(test_text.string[1], "Aquiring result");
sleep(1);
mySQL_GetStr(test_text.string[2],0,0);




At the moment, it crashes when I make the mySQL_GetStr(test_text.string[2],0,0); call.

test_text is a text object just for displaying some results and includes a couple of strings. Everything works up untill I try to extraxt info from the resultset (which I'm assuming is being returned as part of the query?). I've tried using 0, 1, and mySQL_RowNumber() for the third peram... Since 'index' is the first field in the DB row, I expected it to return exactly what I put out to the query.

So, the question is... now that I can connect, and seemingly access the table... how do I extract info from the DB?
Posted By: Destop

Re: MySQL dll - 08/17/05 09:30

I am back from holidays!
I ll try to dig in my old computer for the example file I used to make test whyle developping! (gave a quick try this morning, but I couldnt find it)
Destop
Posted By: Specterdragon

Re: MySQL dll - 08/18/05 01:56

Well.. well... in the ancient language:
"Owa tafoo lyam!"

I see the error.. and it seems to be working now

Code:

hr = mySQL_Connectdb("dbname","localhost","root","password");
if(hr == 1)
{
str_cpy(test_text.string[1], "DB is connected and online");
sleep(1);
mySQL_ExecQuery("use table01;");
}


I changed to a non-existant DB with a "use" query (thinking it was for switching from one table to another) LOL... ok.. ok... laugh now... I'm an SQL newbie

Would be nice if there was a simpler form of array gathering.. hemm... perhaps a wrapper <include> for use with 3DGS... I'll have to work on that..

Two questions for the gurus:
1> Can you perform ANY query that MySQL can understand? I know (from tutorials) that the query can get pretty long and complicated. Unfortunatly, I dont have a complex database (yet) to test that out on.
2> How do you connect this to an off-site DB (i.e. over the net)? I figured that the MySQL server has to be running, and rumor is that I would have to upgrade to pro (which I'm considering doing anyhow), but what would I replace "localhost" with in order to get across the net?
Posted By: BoH_Havoc

Re: MySQL dll - 08/18/05 11:49

1:
dunno, haven't tested it myself yet. But i don't see a problem here.

2:
I have COM and connecting to a database through the internet works great (if not to say fantastic ^^).
To connect to an "off-site db" (as you name it) change "localhost" to "my-rootserver.ath.cx" (which points to your rootserver's ip. check out http://www.dyndns.org for more info). Instead of my-rootserver.ath.cx you could also write your rootserver's public ip (e.g. 173.16.232.85).
If you don't have a rootserver but webspace with a db then you have to ask your webspace-provider what your db's pub ip/rootdir is. That should also work (haven't tested it myself as i "only" have a rootserver )

Hope that helps you out
Posted By: Specterdragon

Re: MySQL dll - 08/19/05 20:35

Quote:

To connect to an "off-site db" (as you name it) change "localhost" to "my-rootserver.ath.cx"




OK, so I'm not a wizard at these things... lack of a beter name LOL

That's awsome news, though. For my app, it could mean alot less work trying to get a website and clients to match info... this is looking better and beter ... if only we could retrieve data by name rather then by column number hehe... but can't have everything right? I'm just glad it works
Posted By: Excessus

Re: MySQL dll - 10/09/05 14:34

Should this plugin work with MySQL v5.0?
Posted By: Remo_L

Re: MySQL dll - 10/13/05 00:46

Im having a little trouble getting these plugin to work .

I have the dll files (both) in both folders (a plug ins and my project folder). First I tried it without loading anything but declaring the functions and it didnt work. Then I tried loading the DLL manually in the bottom of Main and it says that this is not a valid acknex dll plug-in. Anyone knows why am I getting that error?
Posted By: HPW

Re: MySQL dll - 10/17/05 06:48

Don't forget to open the incomming ports for MySql(Port number: 3306) to connect to a database on a Server OS!
Posted By: Gho5tFac3K1llah

Re: MySQL dll - 11/26/05 04:10

Quote:


//LOGIN STERINGS
string Login_Query; // holds the mysql query
string username[16]; // holds the username
string password; // holds the password
string libmysqldll = <libmysql.dll>;
var_nsave mysql_handle;




I understand this.
Quote:


Then
Code:

////////////////////
//DATABASE FUNCTIONS
dllfunction mySQL_Connectdb(w,x,y,z);
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();



After this i have all of my panels/texts that are in the login script. have you added functions to these to handle the login scripts wich mine will be below.

Code:

////////////////////
//TEXT'S
text txtName
{
pos_x = 575;
pos_y = 115;
layer = 30;
font fnt_century12;
string username;
}
text txtPassword
{
pos_x = 575;
pos_y = 115;
layer = 30;
font fnt_century12;
string password;






I understand all that also. What I do not understand is this:
Quote:


Now for what is in my function Main.
Code:

//Main Function
function main()
{

mouse_on();
level_load(MPLevel); //Load the first level
sleep(.2);
While (!bat_set)
{
wait(1);
}
mysql_handle = dll_open(libmysqldll);
mySQL_Connectdb("databse","host","user","password");
}






What is the mySQL_Connectdb("databse","host","user","password"); mean? Do I leave it as it is or do I fill in that info.
Quote:


Ok now i have a buttony ou push then a login apears. within this is the login script that i use for the 2 Textxs that were showsn earlier.
Code:

mySQL_Connectdb("databse","host","user","password");
if(!mySQL_IsConnected()&&!mySQL_Connectdb("databse","host","user","password"))
{
beep;
exit;
}
txtName.visible = on;
inkey(username);
txtName.visible = off;
txtPassword.visible = on;
inkey(password);
txtPassword.visible = off;

str_cat(Login_Query, "select * from Accounts WHERE Account_Name='");
str_cat(Login_Query, username);
str_cat(Login_Query, "' AND Password='");
str_cat(Login_Query, password);
str_cat(Login_Query, "';");
mySQL_ExecQuery(Login_Query);
if(mySQL_ExecQuery(Login_Query)&&mySQL_RowNumber()==1)
{
Join_Game();
}
else
{
beep;
exit;//if no entry, exit

}






All I ask from you, KyiasShadow, is that you go into more detail for people, like me, who do not fully understand this. Cheers.

Domingo
Posted By: Bilbo

Re: MySQL dll - 11/26/05 11:16

What is the mySQL_Connectdb("databse","host","user","password"); mean? Do I leave it as it is or do I fill in that info.

-i can answer this question, you have to fill in your details host is usually localhost
Posted By: Gho5tFac3K1llah

Re: MySQL dll - 11/26/05 16:07

Can someone just write up a simple tutorial for people that still can't follow on this topic?
Posted By: Zio

Re: MySQL dll - 01/17/06 03:52

This has to be the strangest bug I've run across. I've been using the mySQL dll and it's been working beautifully. However I can't figure out why this is happening, it makes no sense.

I'm trying to fill up a text object with a list of the currently online users.

You would think this this code would work:
Code:
while(line < users)
{
mySQL_GetStr(txtOnlineUsers.string[line],0,line);
line += 1;
}



However that prints out the same username on every line of text. Sort of. It's hard to describe, but it basically does this: The first line prints the correct name. The second line prints the correct name, but also overwrites the first line with the second name. Etc etc. The end result is that every line contains the last name pulled.

But that isn't the strange part. Trying to debug the code, I tested out this snippet instead of the loop:

Code:
mySQL_GetStr(txtOnlineUsers.string[line],0,line);
line += 1;
mySQL_GetStr(txtOnlineUsers.string[line],0,line);
line += 1;
mySQL_GetStr(txtOnlineUsers.string[line],0,line);
line += 1;
mySQL_GetStr(txtOnlineUsers.string[line],0,line);
line += 1;
//etc etc



THAT works PERFECT. How is that any different than what the loop is doing?! I seriously can't figure it out.



EDIT:
Hmm, did a bunch more tests and the problem is completely unrelated to pulling the string with mySQL_getStr(), so this doesn't really belong in the thread.

That's what I get for being impatient and posting before exhausting all possible tests.
Posted By: JetpackMonkey

Re: MySQL dll - 02/10/06 18:21

That's really nice of you, desktop! Thanks !


Posted By: noxy

Re: MySQL dll - 02/23/06 16:53

Hi,
i tried everything but i allways become the Errormessage: Not vault Acknex DLL.
Yes i put it in the Pluginfolder and in the Gamefolder.
And the libmysql.dll i copied too...
Please Help o.O

Regards
Raphy
Posted By: Twecea

Re: MySQL dll - 04/28/06 17:21

I have the same Problem
Posted By: DavidLancaster

Re: MySQL dll - 04/29/06 00:47

I remember having a whole load of trouble with it. Not sure if this will work but try it:

Remove the A6MySqld.dll and the libmysql.dll from your game folder and just have it in your Gamestudio6/AcknexPlugin folder. I think I had them both in the game folder and plugin folder but the moment I removed it from the game folder it started working.
Posted By: Twecea

Re: MySQL dll - 04/29/06 08:34

It doesn't work also

I have mysql 4.1.18
I had try 5.0.20

And I have 3D GameStudio 6.22 pro
Posted By: Aaron

Re: MySQL dll - 05/16/06 19:56

what's a MySQL database ? I heard that it's like a server data base but how can you use it for a game? would it be for a mutiplayer online game?
Posted By: Michael_Schwarz

Re: MySQL dll - 05/24/06 22:22

sorry to pick this old thread up, but I'd rather use an existing one instead of making a new one, but I dont get how I do use mySQL_GetVal(x, y) and mySQL_GetStr(string, x, y)

what exactly is FIELD x and LINE Y?

Lets suppose my database looks like:

1 Test1 123 887
2 test2 456 998

and i want to get the number 998, what values would i have to give x and Y then?
Posted By: Michael_Schwarz

Re: MySQL dll - 05/25/06 14:54

I know people have problems answering a question in old threads, but I need an answer.
Posted By: Michael_Schwarz

Re: MySQL dll - 05/25/06 22:51

After a lot of long and frustrating series of tests, I figured it out. Thanks for your exessive help!
Posted By: Captain_Kiyaku

Re: MySQL dll - 05/26/06 12:12

maybe yoiu could share your solution for other people who wants to know it too.
Posted By: Michael_Schwarz

Re: MySQL dll - 05/26/06 14:03

Give me just ONE reasonable reason why I should do that.

It's this take and give thing, and i didn't take anything, so why should I give?
Posted By: Excessus

Re: MySQL dll - 05/26/06 14:49

Quote:

so why should I give?



You can find the answer to that question by asking yourself: what would the person that should have helped you gained by helping you?

BTW, digging up an age old thread and expecting help within 24 hours is a bit unrealistic.
Posted By: ulf

Re: MySQL dll - 05/26/06 18:38

Quote:

Give me just ONE reasonable reason why I should do that.

It's this take and give thing, and i didn't take anything, so why should I give?




i really hope this mickey-mouse-reaction is not starting to become common behaviour here... 3dgs community lives by people helping each other even if they dont get an answer during 24h...
Posted By: Captain_Kiyaku

Re: MySQL dll - 05/26/06 21:10

why you should do that? do you think people didnt help you cause they dont like you or whatever? How can people help you when they dont know the answer either?
Imagine someone else allready know the answer of a question you will ask oneday. If he post it allready in the Forum, you wouldnt need to ask anymore. So it's easier for other people to get knowledge.
Why should someone share his/her knowledge with you, when you are not able to share YOUR knowledge with other people either?
Posted By: Gho5tFac3K1llah

Re: MySQL dll - 05/28/06 22:22

To clarify:

Field x is the field number to use to retrieve a value, starting at 0.
Line y is the row number to use to retrieve a value, starting at 0.

So in the case of:
1 Test1 123 887
2 test2 456 998

To get 998, x = 1 and y = 1. Test1 is row 0 and test2 is row 1. The numbers 123 and 456 are in field 0, which makes x equal 0. The numbers 887 and 998 are in field 1, which makes x equal 1. The numbers 123 and 887 are in row 0, which makes y equal 0. The numbers 456 and 998 are in row 1, which makes x equal 1. Hope this helps.
Posted By: Xarthor

Re: MySQL dll - 05/28/06 23:28

@Gho5tFac3K1llah:
That doesn't make any sense to me, sorry.
But what about the fields 1 and Test 1 (and the row under it 2 and test2) ?
Wouldn i by like:
Code:

y/x | 0 | 1 | 2 | 3
0 | 1 | Test1 | 123 | 887
1 | 2 | Test2 | 456 | 998


Well I didn't write that .dll and I think its great there is something like that.
Haven't touched it yet though.
But from a programming point of view this would be -for me- the most logical way.
Or is the first column an index column with a self-incrementing index and the second column the name for the fields which then follow in other columns while x increases?
Like:
Code:

Index | Name |
1 | Test1 | x=0/y=0 | x=1/y=0
2 | Test2 | x=0/y=1 | x=1/y=1


Posted By: Michael_Schwarz

Re: MySQL dll - 05/29/06 00:34

Either way, its no difference if the first column is a self incrementing index.

Thunder is right.
Posted By: pipiak

Re: MySQL dll - 06/02/06 16:46

PLS i cant handle these dlls . it tell me that is wrong acnex dll. can someone write some generaly use code.
Posted By: Michael_Schwarz

Re: MySQL dll - 06/02/06 22:44

actually you should NOT load the DLL manually, let it being loaded automatically instead, that happens automatically with standart settings if you have the DLL located in the gamestudio/ackenx_plugins folder, or you can set your plugin directory manually by adding:

plugindir = "pluginfoldername";

at the top of your script (NOT inside a function).

just copy the DLL into that folder and it should work.
Posted By: pipiak

Re: MySQL dll - 06/03/06 05:56

i have in plugin folder both dlls -> a6myslq.dll and libmysql.dll ,but when i dont set it manualy (dll_open) ,engine tell me that mySQL_Connectdb not found in dll!!!

i thinkin about other way to store many variables (files and array ),but why i can store only 500items in array and why array is not multidimensional. (exist some way to connect access database ->mdb files???)
Posted By: Gho5tFac3K1llah

Re: MySQL dll - 06/07/06 02:03

Well if you haven't already, place a6mysql.dll and libmysql.dll in the acknex_plugins folder. Next, on the white dialogue that pops up before the game starts, if it does not say A6mysql.dll loaded, something is not right. Either the dll you are using requires files that your system does not have or something else. Btw what version of Windows do you use?
Posted By: Michael_Schwarz

Re: MySQL dll - 06/07/06 05:34

Quote:

if it does not say A6mysql.dll loaded, something is not right.




It doesn't say that on my System ( allthough I know its supposed to say that ) but it works fine for me.
Posted By: xXxGuitar511

Re: MySQL dll - 06/07/06 17:30

what about when u publish ur game? Then do you copy it to the .cd folder?

Does this DLL require PRO edition?
Posted By: PHeMoX

Re: MySQL dll - 06/08/06 10:30

It works with A6 com and pro, I don't know about lower versions but it should work with every version that supports plug-in dlls...

Remember: You need the libmysql.dll too, just copy it into your project's .cd folder. Then you should be able to load the a6mysql.dll, which must also be copied into the project's folder.

Cheers
Posted By: hack-panther

Re: MySQL dll - 07/27/06 00:45

THX
I am am so happy...
That is very cool an works 'boundlessly' with the A6 Com :-D

But one Problem:
When you not have the pro, every user can see your dbconnect-funktion,
therefore the passwort, too.
Is there a secure possibility to hide the passwort?

But THX Again...
It`s "GEIL" :-D

Sry for bad english
Posted By: Michael_Schwarz

Re: MySQL dll - 07/27/06 04:45

Quote:

THX
I am am so happy...
That is very cool an works 'boundlessly' with the A6 Com :-D

But one Problem:
When you not have the pro, every user can see your dbconnect-funktion,
therefore the passwort, too.
Is there a secure possibility to hide the passwort?

But THX Again...
It`s "GEIL" :-D

Sry for bad english




you could do a DLL that passes the password, username and DB-adress to the engine. Contact me via PM so we can do something on that.
Posted By: Excessus

Re: MySQL dll - 07/27/06 16:59

That sounds like a really bad idea.

You shouldn't try to hide the password. Instead make sure the user can only do what he is supposed to do with that password. What I mean is that you should limit the rights for that account on the server side. That way, even if they have the password and connect to your server they can only do what they are allowed to do(which is the same as the app would normaly do).
Posted By: hack-panther

Re: MySQL dll - 07/29/06 15:02

When i do a query the game freeze mostly for a very short moment.

Is this known?

Can you improve this or is that not possible?
Posted By: Michael_Schwarz

Re: MySQL dll - 07/30/06 02:06

Quote:

That sounds like a really bad idea.

You shouldn't try to hide the password. Instead make sure the user can only do what he is supposed to do with that password. What I mean is that you should limit the rights for that account on the server side. That way, even if they have the password and connect to your server they can only do what they are allowed to do(which is the same as the app would normaly do).




imagine this: an MMORPG, we need to write/change and delete(delete account) data. so anyone could just login and delete all other users, or just make his char "ubar"... hiding the password in this case is ESSENCIAL.
Posted By: Albysan

Re: MySQL dll - 08/09/06 23:57

This would seems like a very nice dll if i could get it to work...

What happens:

* If i put the dll in the acknex plugin folder only it says it can't load the dlls even if i put plungindir ("C:\Program Files\GStudio6\acknex_plugins") its like it doesn't exist.

* If i put it in the work folder it says that the dlls are not valid acknex dlls. well that is a start at least it recognises the dlls, even if it is not usefull at all.

* If i put one at a time, it's not any better i just get one error message instead of two (one for each dll)

this is my code (with a LOT of variations, i've tested a lot of things without success):


plugindir"C:\Program Files\GStudio6\001_Project_test_mysql";
//C:\Program Files\GStudio6\acknex_plugins
string libmysqldll = <libmysql.dll>;
string libmysqldlll = <A6mySQL.dll>;

//--------------------------------------------------------------------
// DLL-declarations
//--------------------------------------------------------------------
dllfunction mySQL_Connectdb(w,x,y,z); // declaration of a DLL function
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();

var hr

Function main{
//dll_open(libmysqldll);
//dll_open(libmysqldlll);
hr = mySQL_Connectdb("test","localhost","root","********")
}

Oh yeah and another thing it doesn't recognise any of the dll functions, witch i suppose is normal since it doesn't recognise the dlls.

Can anybody help?
I would relly appreciate it.
Hope i've been clear enough thanx in advance
-----------------------------
Pro version 6.20
Mysql 4.1 and 5 tested without success
Posted By: Michael_Schwarz

Re: MySQL dll - 08/11/06 12:13

First: "C:\Program Files\GStudio6\001_Project_test_mysql" is no valid path syntax -> "C:\\Program Files\\GStudio6\\001_Project_test_mysql"
NOTE: Always use double-backslashes!

Second, the actual better way is to place all your plugins into your Project work folder and make plugindir:
plugindir = ".";
Posted By: ISG

Re: MySQL dll - 08/11/06 13:50

@Michael

I think what Excessus is trying to say is allow any player to sign onto any account - however - each account save files are on YOUR computer so if you log onto someone else's account they can't do anything because they don't have YOUR save information. Make the login part just for that, really nothing, but if you sign on to that account on your computer then it loads YOUR save file(s).

Maybe I'm the one that has it wrong now hehe, but that's what I thought when I first read it.
Posted By: Albysan

Re: MySQL dll - 08/11/06 16:17

Thank you for the code correction i'm a bit sluggish when i write code at midnight trying to get it to work, but even so i tried again i all i get is this once the engine starts:

This seems to work fine but the dlls dont load here. (Are they supposed to?)

note: i added the debug.dll and 1 object because i couldn't make the screen after that (A6 engine pops up) but in the fraction of a second thats what is written

Then the engine starts with a black backround and popups say this:
*Malfunction W1522(libmysql.dll-no valid acknex dll)
*Malfunction W1522(A6mysql.dll-no valid acknex dll)
*Malfunction w1523(mySQL_Connectdb() not found in dll)

Note: the last one loops

One problem is solved: dll non existant
Another one to go: acknex error

-----------------
Thank you for your help!
Posted By: Michael_Schwarz

Re: MySQL dll - 08/11/06 16:17

Quote:

@Michael

I think what Excessus is trying to say is allow any player to sign onto any account - however - each account save files are on YOUR computer so if you log onto someone else's account they can't do anything because they don't have YOUR save information. Make the login part just for that, really nothing, but if you sign on to that account on your computer then it loads YOUR save file(s).

Maybe I'm the one that has it wrong now hehe, but that's what I thought when I first read it.




well, you could then just edit your whole character on your PC and make it ubar then...
Posted By: Michael_Schwarz

Re: MySQL dll - 08/11/06 16:19

Quote:


http://img45.imageshack.us/img45/192/setupzb7.jpg




Maybe you should consider BUYING 3DGS LEGALLY

...
Posted By: FBL

Re: MySQL dll - 08/11/06 16:20

Why should a game client allow access to other data than just the player?

Apart from that:
Ask someone you trust and owns pro to build a resource for you which includes the password.

I owuldn't let the clients connect to the database directly anyway. If it does not produce too much load I'd let the server handle such things.

And if this won't work out due to stress on the server, then create a login system and when the user logs in with HIS account (not the mysql account), send back the sql server login data in an encoded way. This way only the decoding routines will be visible for anyone who is looking at the scripts.

While this is not 100% safe either (packet sniffer and all those nice toolies), it's better than having the password and login written clearly anywhere in the client code.
Posted By: Michael_Schwarz

Re: MySQL dll - 08/11/06 16:23

Quote:


Ask someone you trust and owns pro to build a resource for you which includes the password.




wouldnt a DLL be easier, faster and cheaper?
Posted By: FBL

Re: MySQL dll - 08/11/06 16:28

Of course it can be done with a dll, but it's quite some effort to set it up for just the login data. And it looks and feels... dirty... but that's up to the user to decide. I'm only giving some ideas.

btw: cheaper is not possible. Letting some script resource is afaik legal and costs you nothing. It can't get any cheaper than that.
Posted By: ISG

Re: MySQL dll - 08/11/06 16:28

@Albysan

Please contact Conitec with proof of your version of 3DGS, you currently have a Warez version and thus the reason you've been banned.

Thanks,

-ISG
Posted By: Sorry

oh sorry didn't know - 08/11/06 16:49

When i used the program i didn't know it was not valid (i am at a friends house)
not that i am going to explain my life but hey at least i'm thinking about buying it for myself i'll contact you when i do then thanx,

note : i know this is not the place to write this just delete it after its read.

i apologize for any inconvinence.
Posted By: Captain_Kiyaku

Re: oh sorry didn't know - 10/04/06 22:00

Hmpf i own the pro, i have the latest update, i closed my firewall and i used the same Login Informations from my websites, and i still can't login to my database on my webserver :<

here is the code:

Code:

//declaration of all mysql DLL functions
dllfunction mySQL_Connectdb(w,x,y,z);
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();


string output_text = [255]; //max 255 chars

//just a textfield for testing
text combatskills_txt
{
pos_x = 20;
pos_y = 20;
string = output_text;
flags = visible;
}

function main()
{
if(!mySQL_IsConnected()&&!mySQL_Connectdb("database","host","user","passwort"))
{
beep;
exit;
}
str_cpy(output_text, "Connected!");
while(1)
{
wait(1);
}
}



of course i replaced host, user, database, etc.
but when i run it, i always get '0' returned ;<
The mysql and lib dll are in the acknex folder AND in the game folder.

whats wrong there? :/
Posted By: Michael_Schwarz

Re: MySQL dll - 10/05/06 05:09

try:

function main()
{
mySQL_Connectdb("database","host","user","passwort");
if(!mySQL_IsConnected())
{
beep;
exit;
}
str_cpy(output_text, "Connected!");
while(1)
{
wait(1);
}
}
Posted By: Captain_Kiyaku

Re: MySQL dll - 10/05/06 06:00

still doesnt work. i even tried another server and it still doesnt work, so i don't think it's my webserver..

do i have to activate something in 3dgs to use the mysql o_O? I also tried to start it as -sv -cl, but still nothing :<
Posted By: Captain_Kiyaku

Re: MySQL dll - 10/05/06 09:37

Well i tried to connect to localhost (installed XAMPP) and this works. but if i use my IP, i can't connect to me either :<
Posted By: D3D

Re: MySQL dll - 10/05/06 22:03

@ Kihaku:

Tried to test the mysql dll and it works. Sounds like you make little mistake with the MySQL server, router, firewall setup to accept outside connections. Not all webhosts allow you to connect from anywhere else then localhost.

Do your outside mysql database testing here --> Freesql.org

A lot of webhosts add a prefix to database names and usersnames, so then username becomes prefix_username. Remember if your behind a firewall and or router, you must allow access and port forward from there too.

Dusty

Code:
plugindir = ".";

//--------------------------------------------------------------------
// DLL-declarations
//--------------------------------------------------------------------
dllfunction mySQL_Connectdb(w,x,y,z); // declaration of a DLL function
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();

string output_text = [255]; //max 255 chars

text combatskills_txt
{
pos_x = 20;
pos_y = 20;
string = output_text;
flags = visible;
}

function main()
{
// database,host,user,password
mySQL_Connectdb("dbname","www.freesql.org","dbuser","dbpass");
if(!mySQL_IsConnected())
{
beep;
exit;
}
str_cpy(output_text, "Connected!");
while(1)
{
wait(1);
}
}


Posted By: D3D

MySQL dll - MD5 or SHA encryption - 10/08/06 22:20

I have a question about encryption. Do you have to add MD5 somewhere in the c-script if you send the password from the inkey to the mysql database server and the password on the server uses MD5 of SHA? Could anyone explain this?


Code:
function userlogin()
{
mySQL_Connectdb("gsa6db","mydomain","gsa6","xs4all");
if(!mySQL_IsConnected())
{
beep;
exit; // Connection failed, exit to Windows.
}

inkey(username);
inkey(password);

str_cat(query, "select * from Players WHERE username='");
str_cat(query, username);
str_cat(query, "' AND password='");
str_cat(query, password);
str_cat(query, "';");

if(mySQL_ExecQuery(query)&&mySQL_RowNumber()==1){
// do something

}else{
exit; // No entry or false, exit to Windows.
}



Dusty
Posted By: Gho5tFac3K1llah

Re: MySQL dll - MD5 or SHA encryption - 10/08/06 22:59

For the column of the table that has the password, you can set its type to MD5 or SHA and it converts what you put in it to the MD5 or SHA hash.
Posted By: D3D

Re: MySQL dll - MD5 or SHA encryption - 10/08/06 23:04

Do you mean change the value next to password to md5 inside phpmyadmin? So I don't have to make changes in the c-script? Just enter the password trough inkey and send it to the mysql database server, the server knows how to convert?

Dusty
Posted By: Gho5tFac3K1llah

Re: MySQL dll - MD5 or SHA encryption - 10/08/06 23:40

yes
Posted By: D3D

Re: MySQL dll - MD5 and SHA encryption working! - 10/09/06 13:09

Hmm I have tried both MD5 and SHA, but they didn't worked. The only time it did was when I used plain passwords in the mysql database. I tested this both on mysql 4.1.21-standard and 5.01-community database server with the same result.

In PHP you have to script like this: $password = md5(password), but not in c-script? Anyone using encrypted password could show me a example or give a little hint for fixing?

DB COLLATION = Latin_swedish_ci
STORAGE ENGINE = MyISAM
pack_keys = DEFAULT
__________________________________________________________________________

TEST1 MD5

FIELD | TYPE | LENGTH | COLLATION | NULL

Username VARCHAR 16 Latin_swedish_ci Not NULL
Password VARCHAR 32 Latin_swedish_ci Not NULL

MD5
FIELD: Password
TYPE: VARCHAR
FUNCTION: MD5
LENGTH: 32
COLLATIE: Latin_swedish_ci
NULL: Not NULL

TEST2 SHA

FIELD | TYPE | LENGTH | COLLATION | NULL

Username VARCHAR 16 Latin_swedish_ci Not NULL
Password VARCHAR 40 Latin_swedish_ci Not NULL

SHA
FIELD: Password
TYPE: VARCHAR
FUNCTION: SHA
LENGTH: 40
COLLATIE: Latin_swedish_ci
NULL: Not NULL


Dusty
Posted By: D3D

Re: MySQL dll - MD5 and SHA encryption working! - 10/09/06 19:03

Looks like MD5 encryption is working if I change the code to:

Code:
str_cat(query, "select * from Players WHERE gsa6user='");
str_cat(query, username);
str_cat(query, "' AND gsa6password=MD5('");
str_cat(query, password);
str_cat(query, "');");



Are you sure that encryption works straight away and I not need to change this in the c-script?

Dusty
Posted By: Gho5tFac3K1llah

Re: MySQL dll - MD5 and SHA encryption working! - 10/09/06 20:29

yes, it should work.
Posted By: D3D

Re: MySQL dll - MD5 and SHA encryption working! - 10/11/06 15:47

edit: Solved. Continue working on the demo..

Ok, I now have plain text, md5 and sha passwords working. Also I figured out how to extract data (strings) from the database, but I have a problem due to bad scripting I guess. So could anyone help me with the inkey problem in the script?

Run program -> press L -> enter username -> press ENTER -> enter password -> press ENTER (done)

The problem i'm having with the inkey thingy is when I login the first time and I enter the correct user+pass, all works no problem. However if I press L to login again it doesn't work anymore. (need to refresh inkey username+password somehow reset it) In the case I enter a wrong username and or password it should be reset too, but I have no luck with the inkey.

How do I reset the login function and inkey to be able to try login again when I enter a wrong username and or password. Or just want to login with another username? When I'm done with this I can upload a little example program for all to download and show how easy using this dll actualy is.

The script is a mess I know, but i'm still working on it and it will be cleaned afterwards removing what is not needed.

Dusty



Code:

plugindir = ".";

//--------------------------------------------------------------------
// DLL Declarations
//--------------------------------------------------------------------
dllfunction mySQL_Connectdb(w,x,y,z); // declaration of a DLL function
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();

//--------------------------------------------------------------------
// VARIABLES
//--------------------------------------------------------------------

var video_mode = 7; // 800x600
var video_screen = 2; // window mode
var video_depth = 32; // 32bit color

var_nsave mysql_handle;

//--------------------------------------------------------------------
// STRINGS
//--------------------------------------------------------------------

string offline_text = [80]; // max 255 chars
string online_text = [80]; // max 255 chars
string login_text = [80]; // max 255 chars
string player_text = [80]; // max 255 chars
string username;
string password;
string query;

//--------------------------------------------------------------------
// FONTS
//--------------------------------------------------------------------

font standard_font = "Verdana",1,12; // Truetype font

//--------------------------------------------------------------------
// BITMAPS
//--------------------------------------------------------------------

bmap pcxLogin = <login.pcx>; // Skin for login panel

//--------------------------------------------------------------------
// PANELS
//--------------------------------------------------------------------

panel pnlLogin
{
bmap = pcxLogin;
layer = 18;
pos_x = 5;
pos_y = 420;
flags = refresh;
}

//--------------------------------------------------------------------
// TEXT
//--------------------------------------------------------------------

text txtUsername
{
layer = 30;
string = username;
pos_x = 26;
pos_y = 480;
font = standard_font;
red = 75;
green = 100;
blue = 180;
flags = visible;
}

text txtPassword
{
layer = 30;
string = password;
pos_x = 26;
pos_y = 528;
font = standard_font;
red = 75;
green = 100;
blue = 180;
flags = visible;
}

text txtOffline
{
layer = 28;
string = offline_text;
pos_x = 650;
pos_y = 40;
//flags = visible;
}

text txtOnline
{
layer = 28;
string = online_text;
pos_x = 650;
pos_y = 20;
//flags = visible;
}

text txtLogin
{
layer = 28;
string = login_text;
pos_x = 650;
pos_y = 60;
//flags = visible;
}

text txtPlayerMSG
{
layer = 28;
string = player_text;
pos_x = 15;
pos_y = 80;
//flags = visible;
}

//--------------------------------------------------------------------
// HEART OF THE GAME
//--------------------------------------------------------------------

function main()
{
screen_color.blue = 128;
// database,host,user,password
mySQL_Connectdb("gsa6db","www.mydomain.com","gsa6","xs4all");
//mySQL_Connectdb("gsa6db","localhost","gsa6","xs4all");

if(!mySQL_IsConnected()) // Connection failed
{
txtOnline.visible = off;
txtOffline.visible = on;
str_cpy(offline_text, "Connection failed");
//beep;
//exit; // Connection failed, exit to windows.
}
// Do something
while (mySQL_IsConnected()) // Connection established
{
txtOffline.visible = off;
txtOnline.visible = on;
str_cpy(online_text, "Connection established");
wait(1);
}
// mySQL_Closedb();
}

//--------------------------------------------------------------------
// FUNCTIONS
//--------------------------------------------------------------------

function refreshAuth()
{
str_cpy(username, "");
str_cpy(password, "");
}

function dbExtract()
{
//mySQL_ExecQuery("select * from Player where query='player_msg';");
//mySQL_ExecQuery("select * from Player;");
str_cpy(player_text, "Aquiring result");
sleep(1);
mySQL_GetStr(player_text,3,0); // 1,0 = username | 3,0 = welcome message
}

function userlogin()
{
// mySQL_Connectdb("gsa6db","localhost","gsa6","xs4all");
if(!mySQL_IsConnected())
{
beep;
exit; // Connection failed, exit to windows.
}

pnlLogin.visible = on; // Make the login visible with L key
inkey(username);
inkey(password);

// Plain text passwords
/*str_cat(query, "select * from Players WHERE player_nick='");
str_cat(query, username);
str_cat(query, "' AND player_pass='");
str_cat(query, password);
str_cat(query, "';");
*/

// SHA Password Encryption
/*str_cat(query, "select * from Players WHERE player_nick='");
str_cat(query, username);
str_cat(query, "' AND player_pass=SHA('");
str_cat(query, password);
str_cat(query, "');");
*/

// MD5 Password Encryption
str_cat(query, "select * from Players WHERE player_nick='");
str_cat(query, username);
str_cat(query, "' AND player_pass=MD5('");
str_cat(query, password);
str_cat(query, "');");

if(mySQL_ExecQuery(query)&&mySQL_RowNumber()==1)
{
// The query returned true, do something
txtLogin.visible = on;
str_cpy(login_text, "Login accepted");
txtPlayerMSG.visible = on;
//str_cpy(player_text, "extract from db");
str_cpy(player_text, query);
dbExtract();
}
else
{
txtLogin.visible = on;
str_cpy(login_text, "Login failed");
//exit; // No entry or failed, exit to Windows
}
// pnlLogin.visible = off; // Hide the login
// Now you can gather info from the db

//while(1)
//{
// do some more
// wait(1);
//}
//refreshAuth();
//mySQL_Closedb();
}
on_L = userlogin;



SQL
Code:
CREATE TABLE `Players` (
`player_id` int(10) unsigned NOT NULL auto_increment COMMENT 'player id',
`player_nick` varchar(16) NOT NULL default '' COMMENT 'player nick',
`player_pass` varchar(32) NOT NULL default '' COMMENT 'player password',
`player_msg` text NOT NULL COMMENT 'player message',
PRIMARY KEY (`player_id`),
KEY `player_nick` (`player_nick`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='GameStudio A6MySQL Database' AUTO_INCREMENT=2 ;



Username: demo
Password: demo
Code:
INSERT INTO `Players` VALUES (1, 'demo', 'fe01ce2a7fbac8fafaed7c982a04e229', 'Welcome to mydomain.com');




Posted By: Captain_Kiyaku

Re: MySQL dll - MD5 and SHA encryption working! - 10/12/06 09:16

actually it should work if you call this:

str_cpy(username, "");
str_cpy(password, "");

well, i have a fixed string with a length of 200 so i do this at the end of my function to clear the string again:

str_cpy(strChatEntry[0], "#200");

You need to clear the string, not the inkey. theres nothing to clear. it only uses the string "username" for example. and if there is still text inside, it shoes that the next time you want to login
Posted By: D3D

Re: MySQL dll - MD5 and SHA encryption working! - 10/12/06 13:48

Yes you are right, in the begin of my script I forgot to make the strings fixed for username and password. Therefore this function doesn't work. Zeitwerk made me understand that last night and saved me from a long night with trial and error.

Code:

string username;
string password;
Function refreshAuth()
{
str_cpy(username, "");
str_cpy(password, "");
}



So now I have changed the code again to:

Code:

string username "#16";
string password "#32";
Function refreshAuth()
{
str_cpy(username, "");
str_cpy(password, "");
}



And this works perfect, but if you make it fixed at the begin of the script and afterwards empty the string with str_cpy(username, ""); does it stay fixed? I tried and it looks like that, or do I need to empty with str_cpy(username, "#16"); instead??

Dusty
Posted By: Captain_Kiyaku

Re: MySQL dll - MD5 and SHA encryption working! - 10/12/06 20:35

well i defined a fix string like this:

strChat1 = str_create("#200");

and if i just do "str_cpy(strChat1, "");" i had problems with it, it cutted the length, it only worked with "str_cpy(strChat1, "#200");" so maybe you need to do that. at least only this method worked for me.
Posted By: Captain_Kiyaku

Re: MySQL dll - MD5 and SHA encryption working! - 10/13/06 18:34

I have a question.
When i start my games with the mysql database (using my internal IP), everyone works fine. but when i try it over network, it somehow doesnt work, the client can't find the database on the server (or connect to it).
i even have a website running in my htdocs and people can success it from everywhere else. So that means it can connect to the database (using the same IP in the php files). But why doesn't it work with the game then? It can find the session and connects to it, but can't connect to the database :/
Do i need to change something in the config file?
Posted By: D3D

Re: MySQL dll - MD5 and SHA encryption working! - 10/13/06 21:26

Well, I can give exclusive access to a database, then try if you are able to connect from a remote location. If you can connect, again it must be a problem with the mysql server configuration, your router and or firewall. You tried this with freesql.org in the past.

Have you tried to connect to your mysql database server with a php script from another webhost at remote location? Also, is the ip address you have static or dynamic? Did you setup a (free)domain pointed to your external ip address? What does your host look like in the c-script? For privacy not show real ip here, but to sample:

-> www.myhost.com
-> 192.168.1.11 (intern ip)
-> http://192.168.1.11
-> 213.105.17.33 (extern ip)

Furthermore, your webserver has nothing to do with your mysql database server. Even though people can access your website and load your php scripts, this doesn't mean they should be able to connect to the database too.

The webserver uses port 80 (if not selected another port) and the database server run on port 3306, so even though people can connect to your webserver that doesn't say anything about the sql server. Just let the sql server and the webserver run on localhost and from the router forward the ports 80/3306 for both to the correct system. Also trough php admin you must setup a wildcard '%' in order to allow connections from remote locations.

Maybe you did something wrong during installation or configuration and now only allow access from localhost or the internal ip address of the computer running the mysql server. I made that mistake in the past thinking I setup the ip for the server, but instead I restricted access to it only from that ip address.

Dusty
Posted By: Captain_Kiyaku

Re: MySQL dll - MD5 and SHA encryption working! - 10/14/06 00:00

Hi

well i didnt mean i can run my php scripts so the webserver works. i mean i connect to my database with php files, to registrate users. This website works perfect and it creates users. Even people from outside can access it. (though you have to do it like "http://123.123.123.123:3306/reg.php" cause i didnt forward port 80, shouldnt even be necessary for the mysql server)

I tried to use my internal AND external IP adress, and forwarded port 3306 and 3307.
I set the wildcard in the past allready (before it didnt work at all, of course).

i guess it might be a router problem. though i think if i connect in my network over my internal IP Adress, it should work... (like when you play in LAN and use that IP or do network connections for file transfer, etc)
Posted By: PHeMoX

Re: MySQL dll - MD5 and SHA encryption working! - 10/14/06 02:29

Quote:

and if i just do "str_cpy(strChat1, "");" i had problems with it, it cutted the length, it only worked with "str_cpy(strChat1, "#200");" so maybe you need to do that. at least only this method worked for me.




I think Code:
str_cpy(strChat1,"     ");

should work ... Wasn't there this rule that you need to define the amount of characters when using str_cpy?

Cheers
Posted By: nkl

Re: MySQL dll - MD5 and SHA encryption working! - 10/14/06 05:48

Hi!
It is a cool login code.
But people can see what password you typed.
In many login systems, the dialog box use password masking so any people can't see what password you typed.
How do I displaying the password character as an asterisk '*' instead of the characters that users type?
for example


Thanks for any advice on this problem
Thanks already.
Posted By: D3D

Re: MySQL dll - MD5 and SHA encryption working! - 10/14/06 12:15

@ nkl:

For fast and easy fix, i'll suggest downloading the free font generator made by a user on this forum. Then replace the standard font for the password with a font file that has only * inside. There must be a way to do this with c-script too. However, i'm lazy and have used a font-file. Also I have changed the code I found here and post a little working sample for this dll soon.

Only want to ask Michael_Schwarz if he can tell me the secret about password in dll Although this login sth is very nice it's also a security risk, as anyone could intercept the master password for the database and insert his own highscore to cheat for instance. You don't want that

Was thinking about using the gshttp plugin I heard about on the forum and use that to make the first connection to a php file on my website and afterwards connect to the database with the mysql-dll to make things a little more difficult perhaps with encryption.

Code:

font standard_font = "Verdana",1,12; // Truetype font
font password_font = <pwfnt.tga>,12,10; // Astrix font

text txtUsername
{
layer = 30;
string = username;
pos_x = 27;
pos_y = 360;
font = standard_font;
red = 75;
green = 100;
blue = 180;
flags = visible;
}

text txtPassword
{
layer = 30;
string = password;
pos_x = 24;
pos_y = 409;
font = password_font;
}



@ PHeMoX:

Sometimes my strings must be always the same size (fixed), So at the top of my script I use(for example), string hello "#6"; and deeper in the script I would use str_cpy(hello,"#6"); to clear and make available for input again.

Dusty
Posted By: nkl

Re: MySQL dll - MD5 and SHA encryption working! - 10/15/06 03:20

Hi dusty!

Thanks for your helps.

nkl.
Posted By: D3D

Re: MySQL dll - MD5 and SHA encryption working! - 10/19/06 16:10

I'm making a -simple- example with Destop's A6MySQL DLL and so far i've got this companion website (PHP based) were you can actualy add new players, delete players, view highscore and player list.

You can login with a gamestudio application to a database somewhere else in the world. ATM i'm using a remote connection, because I want it to run even if I don't have my own workstation running.

The demo doesn't include a full game, but any client can connect with his or her gamestudio application + Destop's MySQL DLL and update their own highscore which in turn can be viewed on the website. You can extend this yourself with a nice game and saving the player's score in a variable.

Maybe nothing for the advanced, but nice start for anyone new to using this dll and want a tryout. I could upload the sample and all sources for download if someone is interested. Otherwise i'll keep it for my own learning experience





Dusty
Posted By: Destop

Re: MySQL dll - MD5 and SHA encryption working! - 11/08/06 13:30

Very good job dusty!
Posted By: Freaky

Re: MySQL dll - 01/18/07 19:26

When I start the game I get this errors:
libmysql.dll - no valid Acknex DLL
A6mySQL.dll - no valid Acknex DLL
mySQL_Connectdb not found in DLL
mySQL_IsConnected not found in DLL
mySQL_IsConnected not found in DLL

and then a blue screen
Please help me!
Posted By: D3D

Re: MySQL dll - 02/02/07 08:36

You must also copy libmysql.dll and a6mysql.dll to your acknex_plugin folder.

All the best,

Dusty
Posted By: Aaron

Re: MySQL dll - 02/10/07 15:41

Hi so what does this really do again?? is this an dll that I can work with my mysql data base??
Posted By: khanoftruth

Re: MySQL dll - 02/26/07 21:43

It helps C script "contact" the mysql db
Posted By: hack-panther

Re: MySQL dll - 05/12/07 23:45

The MySQL-Plugin don`t work with lite-C... :-(

It`s there any (other!?!) possibility to work with MySQL an lite-c?
Posted By: D3D

Re: MySQL dll - 05/24/07 11:08

Yes sure it would work with Lite-C. Only it would require to re-write the plugin Destop created. The source is included in the download. Guess its not easy, but it can be done
Posted By: D3D

MySQL dll for A7 - 08/07/07 15:23

Compiled Destop's MySQL DLL for A7 if anyone is still interested in this engine extension.
Posted By: D3D

MySQL dll for A7 - 08/07/07 16:33

Just for testing i've made this little example with A7 Commercial. If you get some error please let me know. However, it should work without problems. In some time i'll post the final release and update the demo with encryption. If you need encryption right now, look above in this thread for the updated code.

Download A7MySQL Demo (beta).
Posted By: hack-panther

Re: MySQL dll for A7 - 08/08/07 08:20

Thats`s cool....

At the moment i work on another part of my project,
but soon I will need mysql.

Already big thx for that...
Posted By: D3D

Re: MySQL dll for A7 - 08/08/07 09:02

Good to hear. Also it looks like you can use this plugin with Lite-C
Posted By: picoder

Re: MySQL dll for A7 - 08/21/07 13:59

Thanks D3D and Destop!
This plugin will be very useful for me. I have tested your demo in A7 and it worked great. But when I tested it in lite-c, it didn't work

In my project, I'm using lite-c language and I need your plugin for mysql connection.

Can you please release MySQL dll for lite-c?

Thanks again!
Posted By: D3D

Re: MySQL dll for A7 - 09/01/07 04:47

Yes I will release and hopfully very soon. In the meantime you can try this beta for Lite-C though.
Posted By: frazzle

Re: MySQL dll for A7 - 09/01/07 09:29

Indeed, thanks for the great effort

Cheers

Frazzle
Posted By: maxxoros

Re: MySQL dll for A7 - 09/09/07 09:41

ops. that s a great plugin. I am finding a database solution for 3DGS and this s a life saver
Posted By: D3D

Destop's Litec MySQL DLL for A7 - 11/26/07 06:24

The A7/Litec engine extension for MySQL (by Destop) has been updated with adll.lib fix and current A7SDK. Also dll name has been changed to A7LitecMySQL.dll for easy use alongside the C-Script dll version. Remember this is just a beta release.

To download the most recent files look here A7LitecMySQL!
Posted By: fastlane69

Re: Destop's Litec MySQL DLL for A7 - 12/06/07 23:08

Hey double D's (Destop and D3D),

We are testing your plugin with A7 C-Script but running into problems, as in we can't even establish a connection.

When tested with lite-c, we connect fine. It's with c-script that we have a problem.

We are using code that was working fine with Destop's A6 plugin and havent changed a thing codewise.

We have (what we think) is your latest A7litecmysql.dll and libmysql.dll in our plugin folder but no go.

Any advice you can give us would be most welcome!
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 - 12/06/07 23:24

Will try to create a demo for C-Script today and update the dll. The Litec dll doesn't work for C-Script btw.
Posted By: Samb

Can't Count the results I get - 12/06/07 23:42

ok, I got a problem.
I need to know how many characters the plugin found when I ask for a account ID.

lets say I want to get all characters for account "1"
there are 5 characters in the database:
Code:

account|name |size
1 |Hans | 2
1 |Franz | 3
1 |Lutz | 1
2 |Tim | 3
3 |John | 2



temp = mySQL_ExecQuery("Select * from Charaktere where Account = 1");
And... now?
the game doesnt know how much characters there are.
intval = mySQL_GetVal(1,x); = account
intval = mySQL_GetStr(temp_string,2,x); = Name
intval = mySQL_GetVal(3,x); = Size

if X is higher than 3, the whole plugin will crash.
so I can't just go trough all rows and if it won't return anything then it were the last row.
what should I do?
I even can't use "SELECT COUNT( * ) FROM " because the query function does only return a 1 for sucessful and 0 for error :/
Posted By: fastlane69

Re: Destop's Litec MySQL DLL for A7 - 12/06/07 23:44

Quote:

The Litec dll doesn't work for C-Script btw




LOL!

Well that explains that!

Looking forward to your update... an A7 plugin for c-script would really help us as we are not ready to migrate several thousand lines of code to c-lite... yet.
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 *DELETED* - 12/07/07 01:30

Post deleted by D3D
Posted By: Samb

Re: Destop's Litec MySQL DLL for A7 - 12/07/07 02:39

@D3D
well its hard for me to put a demo together, because I don't know HOW to do it
you can't test something if you just don't know how

but here are some more information:
this is the GSTsqlite version of the code:
Code:
		
str_cpy(temp_string3,"Select * from Charaktere where Account = ");
str_cat(temp_string3,str_bearb); // str_bearb contains the account-ID
query_handle = GSTsqlite_ExecuteQuery(data_handle,temp_string3);
while(!GSTsqlite_EOF(query_handle))
{
str_cat(str_info,"&");
GSTsqlite_GetString(query_handle,"CharName", str_bearb);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Charakter", temp);
str_for_num(str_bearb,temp);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Groesse", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Red", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Green", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
str_cat(str_info,"&");
GSTsqlite_GetInteger(query_handle,"Blue", GSTsqlite_VarResult);
str_for_num(str_bearb,GSTsqlite_VarResult);
str_cat(str_info,str_bearb);
GSTsqlite_NextRow(query_handle);
}


GSTNet_ServerSend(vSender, 12, str_info);


how it works: the server wants to send the character infos to the client. it opens the database and select the characters with the same account-ID.
now, the server is on the first row. it's reading all character infos and put them into a string, that will be send to the client.
that will look like that (the first number is the account ID) "1&Franz&2&1&100&200&100"
then, the server goes to the next row, reading the next character of the account. the string will look like that:
1&Franz&2&1&100&200&100&Hans&1&3&50&255&100"
and it goes on and on and on.
TILL it comes to the last row. if the server got to the last row, it will stop the while and send the information to the client.
ok, how to do that with mysql?
I heard that the query commands also returns information, like the "count(*)" command. but the plugin only returns "1" or "0".

also, the problem is easy to describe:
I want to read out of the database information that is more than in one row and I don't know how much rows it will have.

hope that explains it a little more

P.s.: I'm Using A6, so no lite-c
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 *DELETED* *DELETED* *DELETED* - 12/07/07 04:15

Post deleted by D3D
Posted By: Samb

Re: Destop's Litec MySQL DLL for A7 - 12/07/07 10:20

yes, the A7 dll seems to work with A6. but the crash when you use an invalid x,y value, it also crashs. if it wouldnt crash and just returns something like "0" for error, it would be ok
but then getval need to be like this "var getval(varname,x,y)"

also, I can't use GSTsqlite anymore, cause something is wrong with it.. it crashes sometimes. thats why I try out mysql.
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 - 12/07/07 10:49

Could not edit/delete previous posts. Maybe moderator can remove them to avoid confusion..

@ Samb:
All functions for the Lite-C version seem to be working correctly. Guess the CSMySQL engine extension for A7 could also run with A6.60 C-Script. Although I haven't tried yet and therefore i'm not really certain. Furthermore i've created a new demo that shows most features.



Here are the current A7 MySQL beta engine extensions for A7 C-Script and Lite-C. Tonight i'll update the downloads with clean examples.

C-Script

Lite-C
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 - 12/08/07 12:00

Samb i'm trying to understand what you want to do. About the invalid x,y value. This can be solved by programming while keeping that in mind. Anyways i'm going to try today.

Code:
#include <acknex.h>

//----------------------------------------------------------------------------
// DLL FUNCTIONS
//----------------------------------------------------------------------------
function mySQL_Connectdb(char* w,char* x,char* y,char* z);
function mySQL_Closedb();
function mySQL_ExecQuery(string);
function mySQL_GetVal(x, y);
function mySQL_GetStr(string,x,y);
function mySQL_RowNumber();
function mySQL_IsConnected();

//----------------------------------------------------------------------------
// VARIABLES
//----------------------------------------------------------------------------

var mysql_handle_n;
var rxrownr;

//----------------------------------------------------------------------------
// STRINGS
//----------------------------------------------------------------------------

STRING* MyAppTitle;
STRING* MyConnection = "#80";
STRING* MyQuery = "#255";

//----------------------------------------------------------------------------
// FONTS
//----------------------------------------------------------------------------

FONT* standard_font = "ackfont.pcx";
FONT* digit_font = "digfont.pcx";

//----------------------------------------------------------------------------
// PANELS
//----------------------------------------------------------------------------

PANEL* demo_logo =
{
layer = 1;
bmap = "logo.tga";
flags = VISIBLE;
}

PANEL* rxrownr_panel =
{
layer = 2;
digits(15,75,"Row in dataset:",standard_font,0,0);
digits(0,85,4,digit_font,1,rxrownr);
flags = VISIBLE;
}

//----------------------------------------------------------------------------
// TEXT
//----------------------------------------------------------------------------

TEXT* connection_txt =
{
layer = 3;
string = ("MySQL Server Status:", MyConnection);
pos_x = 15;
pos_y = 15;
font = standard_font;
flags = VISIBLE;
}

TEXT* query_txt =
{
layer = 4;
string = ("MySQL Query:", MyQuery);
pos_x = 15;
pos_y = 40;
font = standard_font;
flags = VISIBLE;
}

//----------------------------------------------------------------------------
// HEART OF THE GAME
//----------------------------------------------------------------------------

function main()
{
fps_max = 60;

MyAppTitle = str_create("Lite-C MySQL A7.06.1");
video_window(vector(0,0,0),NULL,112,MyAppTitle);
video_set(640,480,32,2);

mySQL_Connectdb(&"dbname",&"dbhost",&"dbadmin",&"dbpass");
if(!mySQL_IsConnected())
{
str_cpy(MyConnection, "Connection closed");
str_cpy(MyQuery, "unknown");
}
else
{
str_cpy(MyConnection, "Connection established");
str_cpy(MyQuery, "SELECT * FROM players");
}

// Show the number of rows in players table
if(mySQL_ExecQuery(MyQuery) && mySQL_RowNumber() >0)
{
rxrownr = mySQL_RowNumber(); // Return the number of rows
wait(1);
}

while(1)
{
wait(1);
}
//mySQL_Closedb();
}


Posted By: Samb

Re: Destop's Litec MySQL DLL for A7 - 12/08/07 12:57

oh god, somehow mysql_rownumber does now that what I want.. it returns the value of rows.
ok, so my problem will be solved
but anyway, the function shouldn't crash when you type in an non existing row
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 - 12/08/07 13:01

Can you post the function that crash? Currently i'm testing the DLL with MySQL server 5.0 that comes with WAMP server software.
Posted By: Samb

Re: Destop's Litec MySQL DLL for A7 - 12/08/07 14:47

just try: temp = mySQL_GetVal(100,100);
crash because that field doesn't exist.
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 - 12/08/07 16:19

That will return 0 and doesn't crash engine in Lite-C. Are you using CSMySQL.dll for C-Script?
Posted By: fastlane69

Re: Destop's Litec MySQL DLL for A7 - 12/10/07 18:28

Quote:

Here are the current A7 MySQL beta engine extensions for A7 C-Script and Lite-C. Tonight i'll update the downloads with clean examples.




ROCK AND RULE!
Testing them out today!
Thanks, D3D!
Posted By: D3D

Re: Destop's Litec MySQL DLL for A7 - 12/10/07 18:53

The link to most current files are stored here. The zipped upload for C-Script/Lite-C will also be moved to those directories.
Posted By: fastlane69

A7csMySql- Preliminary Testing - 12/11/07 03:13

SETUP

1)I'm using your latest version, the one posted up on saturday. Both dll files are in my projects folder. I'm using A7.07.4b, C-script, and Mysql 5.1

2) My system has 7 applications that connect to the Database, each under a different username but same password.

3) The queries, when they work, work fine

PROBLEMS

1) HOWEVER, I'm getting an intermittent error where I connect to the database (I can see my user connected on the MySql Administrator) but when the application runs, it crashes because mysql_rownum() returns zero and this is later used as a get call.

Code:
 	
num_rows = mySQL_RowNumber(); <--- num_rows == 0 on failure
randomize();

//get Id from Id_List
id_chose = int(random(num_rows)); <--- id_chose == 0 on failure

mySQL_GetStr(Physics1_ID,0,id_chose); <--- CRASH



2) This error does not happen all the time and sometimes it happens with different applications (though it seems to occur more often to applications/connections that connect later to the database).

3) We never encountered this problem with A6.6

SOLUTION

In every case, if I go into the MySql Administrator, delete the offending user, and remake him, on the next run it will work (until it or another application fails).

SUMMARY

Intermittently (ie: we can reproduce the error on demand), the user will connect to the DB but the mysql_rownumber will return a zero down the line. Upon deletion and recreation of the user (same name; same password), the mysql_rownumbers() works fine again.

COMMENT

This sounds similar to the problem Samb was having with mysql_rownumbers(). Samb, if you get the crash, try what I did and redo the user. See if that clears it up. I would be nice to have the same error across the board.

Any idea what could be causing this?

UPDATE
I am definitely getting an error with mysql_rownumbers(). I leave my application running after a successful load in. It runs and runs mysql_rownumbers several times. Then all of the sudden the system crashes when this call is made:

Code:
                 diag("mysql row 1");
mySQL_execQuery(sql_cmd);
diag("mysql row 1.1");
if (mySQL_RowNumber() == 1)
{
diag("mysql row 1.2");
mySQL_getStr(id, 0, 0);
diag("mysql row 1.3");
playerType = mySQL_getVal(1, 0);
}
diag("mysql row 2");



We get to 1.1 but do not get to 1.2 or 2.0. Hence the crash is distinctly when the mysql_rownumbers() call is made.
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/11/07 05:55

I will take a look at CSMySQL today, but I can only test on MySQL 5.0.45 server with A7.06.1 Public release.
Posted By: fastlane69

Re: A7csMySql- Preliminary Testing - 12/11/07 06:20

Using the public version "shouldn't" change things. I'm pretty sure we got the same behaiviour but after so much testing, who knows. We have to use the beta because of an ent_create problem that keeps cropping up. However, I thought we had to be on server 5.1... would that make a huge difference difference?

We'll revert to your settings tomorrow and test it out. I would ask you to upgrade to 5.1 to match our version and since it's the latest free version (unless you know of a reason why it would be a problem).

Furthermore, if you release the source code to me, I can have my people look it over and we can both work towards this. If you don't want to release the source publically, I can send you an email to send it to us privately.

I really want to extend my heartfelt thanks to you, D3D. As you can tell, this is a REALLY big deal for us. Our entire MMOG runs off of MySQL and thus any problems with the plugin grinds our development to a halt! Anything you can do to help us is greatly appreciated!
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/11/07 07:26

@Fastlane: If needed I can setup database on my server and PM you the code. Only it will be MySQL 4.1.xx, but enough for testing..

Note: Make sure you're using the libmysql.dll included in the download. Do not use older/newer version or the one that is inside VC directory. You could test my database file with demo and rows to see how things are working. The source code for Destops MySQL engine extension can be found here and is open source. The plan is to rewrite the DLL for MySQL 6.0+ and A7 next year.

Reason for me using 4.1+ and 5.0.45 is that my website offers 4.1+ and for offline testing i'm using WAMP server which comes with 5.0.45. Not really like to install the latest because it might break my WAMP installation, but I remember that libmysql worked up to MySQL 5.1 when creating PHP frontend for A6MySQL last year..

Guess if you really need reliable MySQL support right now. Best thing would be to rewrite with current MySQL SDK. Or you could wait until I find some help to do the same. I did test the current DLL with the samples included and not encountered problems with either C-Script/Lite-C A7.06.1 at this moment though.

Let me know what happens if you try with my database and C-Script samples. I don't understand the random function with rows. From what I understood, there are no 1.0,2.0 rows. Only row1, row2, etc etc. If i'd inserted the first user into a clean database in the rxplayers table, it gets row 1 and if I add another it will be on row 2 and so on. In my samples I have used all functions of the MySQL engine extension, although the query and actual data handling can be changed in many different ways.




A7 C-Script MySQL
A7 Lite-C MySQL
A7 MySQL Source
PHP FrontEnd in development.
MySQL C/C++ Forum
MySQL++
Posted By: fastlane69

Re: A7csMySql- Preliminary Testing - 12/11/07 23:01

Thanks D!

I'll give these a look see over the next few days and see if we can track down the issue.
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/11/07 23:53

Just tested MySQL 5.1.22-rc-community Server. Have not noticed any problems using release 5.1.22 or 5.0.45, which is installed by default as WAMP addon. Tried with both demo.wdl and rows.wdl from the CSMySQL Demo.
Posted By: fastlane69

Re: A7csMySql- Preliminary Testing - 12/12/07 01:51

Thanks for the testing. Here is what we are finding out:

1) Everyone connects fine but and at some seemingly random point, the queries don't get through. All mysql dll functions return zero for their function call.

2) Another piece to the puzzle is that the crash is being recorded on windows as coming from libmysql.dll. I searched the 5.1 folders and found a different libmysql.dll in there (Sept vs July creation date). I don't know if that has ANYTHING to do with anything, but it is clear that 1) our crash is intermittent and b) it's libmysql.dll that windows says is at fault.

3) If application number 5 for example fails once, I can restart it and the other applications and application number 5 will consistently fail. However, if I restart the MySql service, application 5 will ussually work but then application 6 may or may not work (and usually doesn't).

None of the above may help us any, but at least it's helpful to catalog our behaiviour in case someone else has the same problem.

Do me a quick and easy favor. Put your calls on a loop so you do several in a row. In our case, it's never the early applications that fail, but the later ones which leads me to believe that you won't see the problem by running the demo once or twice but you may see it after 10 or 100 calls.

Now that we have the source code, I'm going to put my people on it. I have one programmer in particular who is very c++ and mysql savvy. If I can get him to put in the time (he's currently away but back on the 20th), we might be able to crack this nut in no time!
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/12/07 06:07

The libmysql that I included with the CSMySQL example was the latest that worked without crashing the engine/plugin last year. When I was trying to get it working again I just tried any libmysql that I could find. Could be that you actually need a previous version or might be that it works with later release also. Not really sure about that though.

Have to say that my demos are very basic and not require heavy load on the database, but I do know that in your case the database connections must be persistent. If I would put a lot of query for the dll to handle it will require a wait(1) to allow the task to complete, at least that's what I thought read somewhere in this topic.

Anyways I think it's best to rewrite with current sdk from http://tangentsoft.net/mysql++/
Posted By: fastlane69

Re: A7csMySql- Preliminary Testing - 12/12/07 21:20

Quote:

but I do know that in your case the database connections must be persistent




That may have been it after all. We went into the MySQL administrator and changed the max queries per hour per user from 100 to 10000... that seems to be working for us right now.

But thanks for the tip on the new MySQL SDK. 5.1 has a new libmysql.dll and it might be easier to attack this from the ground up instead of building on legacy code. Even if we do have to rebuild completely, Destop's and your work will be of great help. After all, things are easier once you know they CAN be done.

More to come but for now, the max quries change has apprearently stablized things.
Posted By: fastlane69

Re: A7csMySql- Preliminary Testing - 12/13/07 20:01

Pretty sure that was it. Two days several restarts and no failures.
We still have a memory leak coming from it. Not conversant on the details but does that sound familiar (it was a problem with the A6 version as well).
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/13/07 20:27

Have setup a ready-made project for VC++ 2008 Express, MySQL 5.1 SDK and mySQL++ 2.3.2 SDK. Unfortunately I did not yet ported the functions from Destops DLL, but it's a nice start. I'm just hobbyist so this will take me some time and I can learn from the process. Maybe if there is a strong C++ programmer he/she can do this in a hour.
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/13/07 23:26

Tried to update the code a little and got it compiling with few warnings and bunch of linker errors perhaps forgot to add something somewhere, but it's a start.

Code:
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <math.h.>// engine specific header file
#define DLL_USE // always define before including adll.h
#include "stdafx.h"
#include "adll.h" //A6 dll include

#include "mysql++.h" // MySQL++ header

using namespace std;
using namespace mysqlpp;

Result res;
Connection con(use_exceptions);

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
engine_bind();
return TRUE;
}

//Open database connection
DLLFUNC var mySQL_Connectdb(STRING *db,STRING *host,STRING *user,STRING *password)
{
try { // its in one big try block
//con.connect("test","localhost","user1","password");
con.connect(db->chars,host->chars,user->chars,password->chars);
if ( !con.connected() ) {
return _VAR(0);
}
}
catch (BadQuery er) { // handle any connection or
// query errors that may come up
return _VAR(0);
}
// The full format for the Connection constructor is
// Connection(cchar *db, cchar *host="",
// cchar *user="", cchar *passwd="")
// You may need to specify some of them if the database is not on
// the local machine or you database username is not the same as your
// login name, etc..

//INSERT INTO testtable (name,strengh,stamina,coord) VALUES ("plouf",20,20,20)

return _VAR(1);
}

DLLFUNC var mySQL_ExecQuery(STRING *str)
{
if ( !con.connected() ) {
return _VAR(0);
}

Query query = con.query();// This creates a query object that is bound to con.

query << str->chars;// You can write to the query object like you would any other ostrem

try{
res = query.store();
}
catch(BadQuery er){
return _VAR(0);
}
return _VAR(1);
}

//Reterne result item x of line y from resultset
//Uses Dramatic Result Set
//result[2][5] or result[2]["price"]
DLLFUNC var mySQL_GetVal(var x, var y)
{

double result;

try{
//result=(double)(res[_INT(y)])[_INT(x)];
result=(double)(res.at(_INT(y))).at(_INT(x));
}
catch (BadQuery& er) {
return _VAR(0);
}
catch (BadConversion& er) {
return _VAR(-1);
}
return _VAR(result);
}

//Reterne result item x of line y from resultset
//Uses Dramatic Result Set
//Return value: -2 str too small
// 0 Bad Query
// -1 Not Text Field
DLLFUNC var mySQL_GetStr(STRING *str, var x, var y)
{
try{
//string my_str((res[_INT(y)])[_INT(x)]);
string my_str((res.at(_INT(y))).at(_INT(x)));
my_str+='\0';
if(str->length >= my_str.length())
strcpy(str->chars,my_str.c_str());
else return _VAR(-2);
}
catch (BadQuery& er) {
return _VAR(0);
}
catch (BadConversion& er) {
return _VAR(-1);
}
return _VAR(1);
}

DLLFUNC void mySQL_Closedb()
{
con.close();
}


DLLFUNC var mySQL_IsConnected()
{
return _VAR(con.connected());
}

DLLFUNC var mySQL_RowNumber()
{
return _VAR((double)res.rows());
}


Posted By: fastlane69

Re: A7csMySql- Preliminary Testing - 12/14/07 00:45

Looking good D!

I'll send this to my guys (who are a lot more than Hobbiest when it comes to programming) and we'll see what we see.

We'll of course post anything we come up with immediately.
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/14/07 02:23

Yesterday i've uploaded the wrong files, but those are replaced now. I have started to put the commands back into the new dll one by one. The connection function and test if connection is true or false has been completed. If anyone like to try the project and source code can be found on the website's url below. Also if someone know how to do things better don't hesitate to improve

You will need VC++ 2008 and mySQL 5.0+ Server in order to recompile the DLL. To try the current demo.wdl in CSDemo directory, just change the code inside to reflect your personal database configuration and run from SED with -diag.

C-Script mySQL DLL
http://a7-files.nixip.com/gsmysql/BETA/ (files are updated frequently)
Posted By: D3D

Re: A7csMySql- Preliminary Testing - 12/14/07 19:13

Might have it working now and uploaded a new beta dll, with all features as shown in the demo.wdl for C-Script
Requires mySQL Community Server 5.0 or higher. http://a7-files.nixip.com/gsmysql/BETA/
Posted By: D3D

CSmySQL New functions (SSL comming soon) - 12/17/07 00:27

Today i've added some new features to CSmySQL engine extension for GameStudio.

+ Host Info
+ Client Info
+ Database Stats
+ Ping
+ SSL (comming soon)
Posted By: Joozey

Re: CSmySQL New functions (SSL comming soon) - 07/01/08 20:54

I havent got into all the updates and stuff, but I want to give my thanks to the original contribution. I got it fully working and it's very easy grin, thanx for this great plugin!

And yes, this is worthy enough to dig it up from it's grave.
Posted By: pegamode

Re: CSmySQL New functions (SSL comming soon) - 07/13/08 10:45

I have a problem with that plugin.

I'm using mySQL 5.0.51b-community-nt and A 7.07.6 with the GSmysql Lite-C version.

The connection to the db works fine, but when calling the exec query function the engine crashes ... any ideas?
Posted By: N3oz

Re: CSmySQL New functions (SSL comming soon) - 07/17/08 13:02

I have also the same problem but I solved.
The problem is in the query sintax.

I'have used the sintax for php that propose me phpMyadmin like this:

INSERT INTO `dbname`.`table` (`id`, `username`, `password`, `score`, `msg`) VALUES (NULL, \'michey\', \'mouse\', \'700000\', \'hello world\')

and now work fine. No "error in engine".

Sorry I forgot:
I use a7.10 Pro edition and MySQL: 5.0.51b-community-nt

I hope this is useful.

Posted By: joh

Re: MySQL dll - 12/02/09 03:04

is this working for A7?
Posted By: MMike

Re: MySQL dll - 12/02/09 11:01

it it just me or the files are BROKEN? i can even open .. none of the links here that you ppl posted.

pitty
Posted By: SchokoKeks

Re: MySQL dll - 12/02/09 18:43

I can download and open the .rar file in the first post,

@joh: that first file definitely works with A7.

@MMike: maybe you don't have a program to open rar files, try 7zip (free) or WinRar (trial version).
Posted By: joh

Re: MySQL dll - 12/03/09 03:28

@SchokoKeks can i use the mySQL in wamp?
Posted By: SchokoKeks

Re: MySQL dll - 12/03/09 12:23

Originally Posted By: joh
@SchokoKeks can i use the mySQL in wamp?


Yes you can, I'm using the mySQL server from XAMPP, which is very similar to wamp.
Posted By: MMike

Re: MySQL dll - 12/05/09 03:40

no it says the download is broken, the link! not the rar thing i have that. i will try again.
Posted By: MMike

Re: CSmySQL New functions (SSL comming soon) - 12/05/09 03:42

this link is broken ..

http://a7-files.nixip.com/A7LitecMySQL.zip
Posted By: joh

Re: CSmySQL New functions (SSL comming soon) - 12/05/09 06:36

i used the xampp as well but maybe ill just use the wamp thank u
Posted By: joh

Re: CSmySQL New functions (SSL comming soon) - 01/14/10 10:39

can someone teach me how am i going to get record from the database and use it as a name of my character? i want to put it at the top of my player's head
Posted By: Joozey

Re: CSmySQL New functions (SSL comming soon) - 01/14/10 13:44

Code:
var char_id = 5; //we want the name of character number 5
str_for_num( strChar_id, char_id );
str_cpy( query, "SELECT name FROM characters WHERE char_id = " );
str_cat( query, strChar_id );

//do the mysql query with query string



Like that?
Posted By: joh

Re: CSmySQL New functions (SSL comming soon) - 01/14/10 14:33

but my character has no id? its not actually a game that you have to sign up.

so what im going to use instead of id? i just use ent_create for the player and what i want is that when my admin updates the database the name at the top of the character should update too
Posted By: Quad

Re: CSmySQL New functions (SSL comming soon) - 01/14/10 14:46

@jooz
thanks to str_printf we can do

str_printf(query,"SELECT name FROM characters WHERE char_id = %d",(int)char_id);

instead of

str_for_num( strChar_id, char_id );
str_cpy( query, "SELECT name FROM characters WHERE char_id = " );
str_cat( query, strChar_id );

sorry for oftopic.
Posted By: MMike

Re: CSmySQL New functions (SSL comming soon) - 01/14/10 20:38

guys can someone give ma Valid Link? to it, i cant download.. its broken:S
Posted By: SchokoKeks

Re: CSmySQL New functions (SSL comming soon) - 01/14/10 20:46

Originally Posted By: MMike
guys can someone give ma Valid Link? to it, i cant download.. its broken:S


The link on the first page still works for me:
download here, original version

dll also works great for me.
Posted By: MMike

Re: CSmySQL New functions (SSL comming soon) - 01/17/10 15:10

OH ok that on did... a6 dll works on a7 right? Thanks now i can test myself
Posted By: Joozey

Re: CSmySQL New functions (SSL comming soon) - 01/19/10 01:21

Oh right, thanks Quadraxas laugh. I'm too old fashioned.

@joh:
Not sure what you want, but you need to know what player you want to pull out of the database. if there is only one player, you can simply do "SELECT name FROM players" or something the like. If there are more players... I don't know how this DLL handles arrays, but you'd probably get the first result found returned.
Posted By: joh

Re: CSmySQL New functions (SSL comming soon) - 01/19/10 13:52

@joozey i load a player using ent_create so definitely there's no record in the database to select player. i want to assign a name on my players above their head which is found in the database
Posted By: Carlos3DGS

Re: CSmySQL New functions (SSL comming soon) - 04/12/10 11:37

Hi I am trying to use this but i get the error "E1512 Empty prototype called in main"

Mabe I am not putting the files in the correct folder or am missing some files?
I placed "A6mySQL.dll" and "libmysql.dll" in "C:\3D GameStudio A7\sdk_plugin"

If it helps, here is my very basic test code:
Code:
dllfunction mySQL_Connectdb(w,x,y,z);
dllfunction mySQL_Closedb();
dllfunction mySQL_ExecQuery(string);
dllfunction mySQL_GetVal(x,y);
dllfunction mySQL_GetStr(string,x,y);
dllfunction mySQL_RowNumber();
dllfunction mySQL_IsConnected();

void main()
{
	int hr;
	hr = mySQL_Connectdb('mydb','localhost','root','passblablabla');
}


Am I missing some include or something here?

Any help would be greatly apreciated, thanks in advance
Posted By: SchokoKeks

Re: CSmySQL New functions (SSL comming soon) - 04/12/10 12:07

"sdk_plugin "is not the right directory, place the files either in the "acknex_plugin" folder or in your game folder if its just this game that's supposed to use this plugin.
Posted By: Carlos3DGS

Re: CSmySQL New functions (SSL comming soon) - 04/12/10 13:04

Thanks for your reply, I tried your solution but am still having problems.

I deleted from "sdk_plugin" folder and put both files into "acknex_plugin" and now when I run it gives no error message, it only cancels and shuts down.

In debug mode here is what i got in my "acklog.txt":
Quote:
C:\3D GameStudio A7\acknex_plugins\A6mySQL.dll - can't load DLL
Program aborted
ackwii.dll opened
t7.dll opened
Compiling SERVER.C - [Esc] to abort.......
mySQL_Closedb: function not found
mySQL_Connectdb: function not found
mySQL_ExecQuery: function not found
mySQL_GetStr: function not found
mySQL_GetVal: function not found
mySQL_IsConnected: function not found
mySQL_RowNumber: function not found.... 0.150 sec
Running SERVER.C.
Cancelled
Program aborted
Shutdown





If i delete the files from "acknex_plugin" and place them into my work folder I get this error:
Quote:
Error E1513 Crash in main

and the "acklog.txt" says this:
Quote:
A6mySQL.dll opened
ackwii.dll opened
t7.dll opened
Compiling SERVER.C - [Esc] to abort........... 0.148 sec
Running SERVER.C.
2 objects
Main started at 2.233 in debug mode
Error E1513: Crash in main
def_startup started
D3D_Init Window: 800x600 -> Window: 1x800x600x32
Video memory found: 740 MB
Main loop at 44.325...
Server started at 44.326
Client started at 44.326.
1st frame with 740 MB at 44.326
Normal exit at 46.004
Close level,DLL,objects
Free input,funcs,panels,defs,syns,views,strings,vars..ok
Free sounds,bmaps,fonts,hash,defs1,script..ok
Close dx,multimedia,D3D,engine,physics,nexus..ok
A7 Engine - Commercial Edition V7.82.3 - Jan 7 2010
Close window at 46.019


Any Ideas of what I am doing wrong?
Posted By: MasterQ32

Re: CSmySQL New functions (SSL comming soon) - 04/25/10 09:50

Cool!
I had some troubles with starting but now it works.
Its a cool system for highscores or also mmo games!
i will try a onlinegame only based on a mysql database
if it works, it would be a good alternative to the normal multiplayer games

EDIT:

my first test works with three different player models with no frame rate loss.
my test:
3 clients running with server on the same computer nearley
30% cpu usage by 3 GHz dual core.
i will try to reduce this to use more connections at one time but i am looking forward for better performance

Posted By: SchokoKeks

Re: CSmySQL New functions (SSL comming soon) - 06/24/10 14:58

Very late reply, but i now know the solution: to Carlos3DGS Problem: you also need to copy libmysql.dll into the same folder (acknex_plugin) where you put A6mySQL.dll

If you already did that, your system is missing another dll that A6mySQL or libmysql need to function.
© 2024 lite-C Forums