Raised This Month: $ Target: $400
 0% 

SQL Advice


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-19-2007 , 11:53   SQL Advice
Reply With Quote #1

Don't worry ... I'm not a total newb and I know how to use SQL.

This thread is about incorporating it into AMX.
If you have ever used SQL in a plugin you will almost surely be able to help


I'm really quite experienced with SQL itself, and I've taught myself about all I can find to learn about AMX Mod X's SQLX (apart from threaded queries, atm)
[and short of reading lots of plugins ]

But what I really need is some advice on the accepted practice of how to deal with usernames, passwords et c. and also with installing the plugin.

As for usernames:
1) Should I just use the amx_sql_user cvar?
2) Naturally, if so then also for host and for pass, but what about db?
Do people usually take the cvar database or hard-code it?

And installation:
There's a few options here, so it's a little harder.

Option 1) Create a script file to create the tables et c, and tell users to run it when they install the plugin

2) Code this into the plugin ( i.e. if table doesn't exist, run the install code )


The problem with #1 is that users are award-winningly retarded and I really can't be arsed to teach people to run a script.
The problem with #2 is that if they change the amx_sql_db cvar, it will create the tables afresh in the new database.

So, if anyone has experience of using SQL in plugins, a bit of advice would be awesome.

Oh, and finally - do people usually include SQL as "an option" (i.e. as opposed to nVault or w/e) or just as the storage method.

Last edited by purple_pixie; 09-19-2007 at 11:56.
purple_pixie is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 09-20-2007 , 03:28   Re: SQL Advice
Reply With Quote #2

I was in your boat 2 weeks ago. I knew SQL but never used it in AMXX.

I checked out the AMXBans code and that explained some stuffs, and I also searched the forums and read the SQLx.inc include. I then coded a damn smooth plugin that checks a mysql database everytime someone joins the server. It's not too difficult - you should look at other code to start.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-20-2007 , 04:14   Re: SQL Advice
Reply With Quote #3

Awesome - thanks for the confidence and that.

I think I've gotten most of it down, it's only a question of installing and usernames, really.

And you're right - I can get that from some other plugins ... I'll start with AMXBans.

I've already written a script file to install the database, so all it needs is someone to run
Code:
mysql -u root -p < install.txt
and enter their root password.
purple_pixie is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode