AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SQL Advice (https://forums.alliedmods.net/showthread.php?t=61051)

purple_pixie 09-19-2007 11:53

SQL Advice
 
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.

Wilson [29th ID] 09-20-2007 03:28

Re: SQL Advice
 
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.

purple_pixie 09-20-2007 04:14

Re: SQL Advice
 
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.


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

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