хотел попробовать подключиться к базе данных по уроку на сайте
Код
#include <sourcemod>
public Plugin myinfo =
{
name = "sqltest",
author = "Collesss",
description = "sql",
version = "0.1",
url = "url"
};
new Handle:g_SQL = INVALID_HANDLE, bool:MYSQL;
public OnPluginStart()
{
if (!SQL_CheckConfig("test"))
{
SetFailState(" ne ydalos naiti \"test\" databases.cfg");
return;
}
decl String:error[256];
g_SQL = SQL_Connect("test", true, error, 256);
if (g_SQL == INVALID_HANDLE)
{
LogError(error);
SetFailState("SQL erorr connect");
return;
}
new String:driver[15]; SQL_ReadDriver(g_SQL, driver, 15);
MYSQL = StrEqual(driver, "mysql", false);
LogMessage(" %s ", MYSQL ? "MYSQL" : "SQLite");
if (!MYSQL)
{
SQL_TQuery(g_SQL, SQL_DefCallback, "CREATE TABLE IF NOT EXISTS `my_tab` (\
steamid TEXT PRIMARY KEY, \
points NUMERIC, \
nick TEXT)", 0);
}
else
{
SQL_TQuery(g_SQL, SQL_DefCallback, "CREATE TABLE IF NOT EXISTS `my_tab` (\
`steamid` varchar(25) NOT NULL, \
`points` int(20) NOT NULL, \
`nick` varchar(32) NOT NULL, \
PRIMARY KEY (`steamid`))", 0);
}
}
public SQL_DefCallback(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE) LogError(error);
}
в database.cfg всё правильно прописал перепроверил раз десять
вот ошибка
L 09/21/2015 - 22:41:31: SourceMod error session started
L 09/21/2015 - 22:41:31: Info (map "de_dust2") (file "errors_20150921.log")
L 09/21/2015 - 22:41:31: [sqltest.smx] [1045]: Access denied for user 'sql290339'@'87-119-240-227.saransk.ru' (using password: YES)
L 09/21/2015 - 22:41:31: [SM] Plugin encountered error 25: Call was aborted
L 09/21/2015 - 22:41:31: [SM] Native "SetFailState" reported: SQL erorr connect
L 09/21/2015 - 22:41:31: [SM] Displaying call stack trace for plugin "sqltest.smx":
L 09/21/2015 - 22:41:31: [SM] [0] Line 28, C:\Users\admin\Desktop\Новая папка (23)\spedit\script\sqltest.sp::OnPluginStart()
L 09/21/2015 - 22:41:41: Error log file session closed.
L 09/21/2015 - 22:41:43: SourceMod error session started
L 09/21/2015 - 22:41:43: Info (map "de_dust2") (file "errors_20150921.log")
L 09/21/2015 - 22:41:43: [sqltest.smx] [1045]: Access denied for user 'sql290339'@'87-119-240-227.saransk.ru' (using password: YES)
L 09/21/2015 - 22:41:43: [SM] Plugin encountered error 25: Call was aborted
L 09/21/2015 - 22:41:43: [SM] Native "SetFailState" reported: SQL erorr connect
L 09/21/2015 - 22:41:43: [SM] Displaying call stack trace for plugin "sqltest.smx":
L 09/21/2015 - 22:41:43: [SM] [0] Line 28, C:\Users\admin\Desktop\Новая папка (23)\spedit\script\sqltest.sp::OnPluginStart()
L 09/21/2015 - 22:42:26: Error log file session closed.
не подскажите в чём проблема ?
и за одно сразу же второй вопрос вот допустим как отправить запрос на добавление изменение ясно а вот как получить данные от запроса SELECT и если допустим их будет несколько выбранных строк то расфосовать по массиву ?