2004-01-31 20:56:22 +00:00
|
|
|
/* MySQL functions
|
2004-02-08 11:31:54 +00:00
|
|
|
*
|
2004-02-21 20:30:04 +00:00
|
|
|
* by the AMX Mod X Development Team
|
|
|
|
* originally developed by OLO
|
2004-02-08 11:31:54 +00:00
|
|
|
*
|
|
|
|
* This file is provided as is (no warranties).
|
|
|
|
*/
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-02-21 20:30:04 +00:00
|
|
|
#if defined _mysql_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _mysql_included
|
|
|
|
|
2004-04-02 23:45:26 +00:00
|
|
|
#include <dbi>
|
|
|
|
|
2004-01-31 20:56:22 +00:00
|
|
|
/* Opens connection. If already such exists then that will be used.
|
2004-02-21 20:30:04 +00:00
|
|
|
* Function returns sql id to use with other sql natives.
|
|
|
|
* Host can be plain ip or with port seperated with ':' char. */
|
2004-04-02 23:45:26 +00:00
|
|
|
stock mysql_connect(host[],user[],pass[],dbname[],error[],maxlength)
|
|
|
|
{
|
|
|
|
dbi_connect(host, user, pass, dbname, error, maxlength)
|
|
|
|
}
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
/* Uses an existing connection (sql) to perform a new query (query) (might close previous query if any). */
|
2004-06-24 08:37:34 +00:00
|
|
|
native mysql_query(sql,query[]);
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
/* Prepares next row of current query (sql) for read access ; returns the number of the row, 0 at end. */
|
2004-06-24 08:37:34 +00:00
|
|
|
native mysql_nextrow(sql);
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
/* Stores specified column (fieldnum) of current query (sql) in (dest) with (maxlength) characters maximum. */
|
2004-06-24 08:37:34 +00:00
|
|
|
native mysql_getfield(sql,fieldnum,dest[],maxlength);
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
/* Clears query (sql) and closes connection (if any other plugin doesn't use it). */
|
2004-04-02 23:45:26 +00:00
|
|
|
stock mysql_close(sql)
|
|
|
|
{
|
|
|
|
dbi_close(sql)
|
|
|
|
}
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
/* Stores last error of current query/connection (sql) in (dest) with (maxlength) characters maximum. */
|
2004-04-02 23:45:26 +00:00
|
|
|
stock mysql_error(sql,dest[],maxlength)
|
|
|
|
{
|
|
|
|
dbi_error(sql, dest, maxlength)
|
|
|
|
}
|