[Include] Database dump parser - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Database dump parser (
/showthread.php?tid=487540)
Database dump parser - Emmet_ - 13.01.2014
Database dump parser
Introduction
This is just a simple include which parses database dumps (.sql files) into a MySQL database. It will search the file for any tables, and create those, aswell as any corresponding table data, and extra queries.
What's the point?
The point is that it can save you a load of time. You can parse queries easily without having to log into phpMyAdmin all of the time, and could be useful for some server owners (like me).
Installation
Simply download "sql-parser.inc" and add it to the top of your script:
An example with "mysql_parse":
pawn Код:
new
handle = mysql_connect("127.0.0.1", "root", "my_database", "");
if (fexist("db_dump.sql"))
{
mysql_parse("db_dump.sql", handle);
fremove("db_dump.sql");
}
Compatible versions
This is compatible with MySQL R7 and newer versions (thanks to iZN).
Download
Pastebin
Re: Database dump parser -
Pottus - 13.01.2014
Good idea there.
Re: Database dump parser -
Rapeassboi - 15.01.2014
Improving the query mechanism, sweet!