Hello one, hello all! I have been studying using SQL for a while on these forums with DarkBasic Pro. Now, I have FINALLY made that happen, thanks to someone on this forum, known as "n0isy". All credit goes to him for the making of this SQL plugin and DECLS file.
To download the NO .NET needed SQL plugin, go here:
http://forum.thegamecreators.com/?m=forum_view&t=184486&b=18
You will ALSO need to download the simple message box plugin (Credit: Twisted Steel Software)
You can download THAT at:
http://forum.thegamecreators.com/?m=forum_view&t=127624&b=1
You will ALSO need BBB GUI (when I upload the NEW library file I'm making). (You do NOT need it right now.
I will add the BBB GUI link with a credit to Brendy Boy in a bit.
And NOW. Without further adieu, I give you my MySQL NO .NET MySQL Library:
Rem Project: NO .NET SQL
Rem Created: Thursday, August 18, 2011
Rem Created By: Mugen Wizardry
Rem Copyright 2011 - 2012
Rem You MAY not sell this code.
Rem If you do, you are subject to the copyright laws not only myself, but N0isy abides by as well
Rem You MUST keep this header intact
Rem ***** Main Source File *****
`CONNECTION STRINGS
`===================================================
global conn
global connstring$
`===================================================
`CONNECTION LOGIN STUFF
`===================================================
global driver$
global host$
global mydb$
global user$
global pass$
global option
`===================================================
`MYSQL QUERY
`===================================================
global query$
global myquery
`===================================================
`BBB GUI LOGIN
`===================================================
global username$
global password$
`===================================================
`DATABASE LOGIN
`===================================================
driver$ = "{MySQL ODBC 3.51 Driver}"
host$ = "your MySQL host"
mydb$ = "your MySQL database"
user$ = "your MySQL username"
pass$ = "your MySQL password"
option = 3 `do you want to encrypt your MySQL connection?
username$ = user1$ `user1$ will be used in future versions of this library as the value that is in the BBB GUI user1$ textbox :)
password$ = pass1$ `pass1$ will be used in future version of this library as the value that is in the BBB GUI pass1$ textbox :)
connstring$ = "DRIVER="+driver$+";Server="+host$+";Database="+mydb$+";User="+user$+"; Password="+pass$+";Socket=MySQL;"+"Option="+str$(option)+";"
conn=ODBC CONNECT(1, connstring$)
if conn = -1 then errormsg=TSS_message_box("ERROR!",ODBC ERROR$(1),TSS_MB_OK()+TSS_MB_ICONSTOP()) : end
if conn = 0
msg=TSS_message_box("CONGRATS!","You have been successfully connected to the "+mydb$+" database!",TSS_MB_OK()+TSS_MB_ICONEXCLAMATION())
query$ = "SELECT * FROM `users` WHERE `username` = '"+username$+"';"
myquery=ODBC EXECSQL(1, query$)
if myquery = -1
errormsg = TSS_message_box("ERROR!", ODBC ERROR$(1), TSS_MB_OK()+TSS_MB_ICONSTOP())
else
WHILE ODBC FETCHROW(1) = 0
username$ = ODBC GETVALUE$(1,3) // String
msg=TSS_message_box("CONGRATS!",username$,TSS_MB_OK()+TSS_MB_ICONEXCLAMATION())
ENDWHILE
`Check that the user is authenticated here
`===================================================
if username$ = user1$ and password$ = pass1$
msg=TSS_message_box("CONGRATS 2!","Welcome, "+username$+"!",TSS_MB_OK()+TSS_MB_ICONEXCLAMATION())
endif
`===================================================
endif
endif
`===================================================
`MAIN LOOP
`===================================================
do
sync
loop
`===================================================
I hope this helps everyone!
EDIT: I forgot to mention, if you do NOT have the ODBC DLL file, needed to connect using MySQL, you can download it from the uploaded attachment!
I have already scanned it for viruses, there are none at all. If you want to scan it more, feel free!
You will then need to put it inside of a folder in your Program Files OR Program Files (X86) folder, depending on your version of Windows.
In my case, it's C:\Program Files (x86)\MySQL\Connector ODBC 3.51\
Because I have Windows 7 - 64 Bit.
In the case of Vista and under, use C:\Program Files\MySQL\Connector ODBC 3.51
If you do NOT have the folder in your program files called MySQL (Yes, spell it the EXACT way I did. Grammar and all)., Then make that folder there. And then INSIDE of the MySQL folder, create a folder named "Connector ODBC 3.51". (Again, spell it the EXACT same way I did). THEN you need to put myodbc3.dll inside the Connector ODBC 3.51 folder AFTER extracting it.
EDIT 2: Added to Codebase - In the Libraries section!
Have a nice day!
~MW~
CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !