AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SQL and Create KeyValue in databases.cfg (https://forums.alliedmods.net/showthread.php?t=165152)

Predailien12 08-19-2011 21:39

SQL and Create KeyValue in databases.cfg
 
HI people. I'm in really big trouble.
I searched day and night without sleeping.
now I am discouraged.
but at the last, I can ask you guys so I am writing this post.

nowadays I am making a .smx file that using SQL with 'SQL_ConnectCustom'. and SQL_TQuery
at first, nothing just happened. but recently I found a problem.

SQL_ConnectCustom is a non-threaded but
SQL_TQuery is a threaded one.
so they crash in server.

So I thought that I should make keyvalue in databases.cfg
and delete it after the connection. because i can't show database information.
and use SQL_TConnect instead SQL_ConnectCustom.
I searched here and there, but I wasted my time.
the keyvalue was made but not deleted and
the plugin didn't work
PHP Code:

new String:DataBase[64];
BuildPath(Path_SMDataBasesizeof(DataBase), "configs/databases.cfg")
kvstats CreateKeyValues("Databases");
FileToKeyValues(kvstatsDataBase);
if(
KvJumpToKey(kvstats""true))
{
KvSetString(kvstats"driver""");
KvSetString(kvstats"host""");
KvSetString(kvstats"port""");
KvSetString(kvstats"database""");
KvSetString(kvstats"user""");
KvSetString(kvstats"pass""");
KvRewind(kvstats);
KeyValuesToFile(kvstatsDataBase);
CloseHandle(kvstats);
SQL_TConnect(Gotdatabase"");
DeleteKeyValue()
}
 
DeleteKeyValue()
{
 new 
String:DataBase[64];
 
BuildPath(Path_SMDataBasesizeof(DataBase), "configs/databases.cfg")
 
kvstats CreateKeyValues("Databases");
 
FileToKeyValues(kvstatsDataBase);
 
KvDeleteKey(kvstats"");
 
KvRewind(kvstats);
 
KeyValuesToFile(kvstatsDataBase);
 
CloseHandle(kvstats);



so I am threading this post.
can anyone help me?

Is there any way to make keyvalue in databases.cfg
and delete it right after the connection?

tjdgns9246 08-20-2011 01:06

Re: SQL and Create KeyValue in databases.cfg
 
Quote:

Originally Posted by Predailien12 (Post 1536685)
HI people. I'm in really big trouble.
I searched day and night without sleeping.
now I am discouraged.
but at the last, I can ask you guys so I am writing this post.

nowadays I am making a .smx file that using SQL with 'SQL_ConnectCustom'. and SQL_TQuery
at first, nothing just happened. but recently I found a problem.

SQL_ConnectCustom is a non-threaded but
SQL_TQuery is a threaded one.
so they crash in server.

So I thought that I should make keyvalue in databases.cfg
and delete it after the connection. because i can't show database information.
and use SQL_TConnect instead SQL_ConnectCustom.
I searched here and there, but I wasted my time.
the keyvalue was made but not deleted and
the plugin didn't work
PHP Code:

new String:DataBase[64];
BuildPath(Path_SMDataBasesizeof(DataBase), "configs/databases.cfg")
kvstats CreateKeyValues("Databases");
FileToKeyValues(kvstatsDataBase);
if(
KvJumpToKey(kvstats""true))
{
KvSetString(kvstats"driver""");
KvSetString(kvstats"host""");
KvSetString(kvstats"port""");
KvSetString(kvstats"database""");
KvSetString(kvstats"user""");
KvSetString(kvstats"pass""");
KvRewind(kvstats);
KeyValuesToFile(kvstatsDataBase);
CloseHandle(kvstats);
SQL_TConnect(Gotdatabase"");
DeleteKeyValue()
}
 
DeleteKeyValue()
{
 new 
String:DataBase[64];
 
BuildPath(Path_SMDataBasesizeof(DataBase), "configs/databases.cfg")
 
kvstats CreateKeyValues("Databases");
 
FileToKeyValues(kvstatsDataBase);
 
KvDeleteKey(kvstats"");
 
KvRewind(kvstats);
 
KeyValuesToFile(kvstatsDataBase);
 
CloseHandle(kvstats);



so I am threading this post.
can anyone help me?

Is there any way to make keyvalue in databases.cfg
and delete it right after the connection?

i think there is your mistake at

PHP Code:

if(KvJumpToKey(kvstats""true))


it runs if there is keyname "", but i think there is no keyname which is ""

so i suggest that you make some keynames before setting keys

Predailien12 08-20-2011 04:05

Re: SQL and Create KeyValue in databases.cfg
 
Quote:

Originally Posted by tjdgns9246 (Post 1536754)
i think their is your mistake at

PHP Code:

if(KvJumpToKey(kvstats""true))


it runs if there is keyname "", but i think there is no keyname which is ""

so i suggest that you make some keynames before setting keys


no. In api, it is said that it makes subkey "" if i write true there.

and it's made but not working. and even not deleted

FaTony 08-20-2011 05:29

Re: SQL and Create KeyValue in databases.cfg
 
Quote:

Originally Posted by Predailien12 (Post 1536685)
because i can't show database information.

There's your main problem. Fix it and reply back.

Predailien12 08-20-2011 11:11

Re: SQL and Create KeyValue in databases.cfg
 
Quote:

Originally Posted by FaTony (Post 1536833)
There's your main problem. Fix it and reply back.

I can't show people my database informations like database, password so I used SQL_ConnectCustom to connect. but because it's non-threaded and I use SQL_TQuery for SQL_Query and FastQuery Occurs many lags, they crash in server.

the KeyValues are made very well. but when SQL_TConnect success to connect or not, it deletes the databases.cfg. and everytime it tried to connect to SQL, it creates KeyValues and delete it.

but though it falied to connect showing me such database conf is not exist

though SQL_ConnectCustom is used on OnPluginStart(), it crashes because many server use the same connection.

I mean SQL_ConnectCustom in B server can crash with SQL_TQuery in A server.

isn't it?

Predailien12 08-20-2011 11:45

Re: SQL and Create KeyValue in databases.cfg
 
Quote:

Originally Posted by FaTony (Post 1536833)
There's your main problem. Fix it and reply back.

Does non-threaded from server A crash with threaded from server B?

FaTony 08-20-2011 19:24

Re: SQL and Create KeyValue in databases.cfg
 
1. I don't think it's really hard to get sensitive data out of smx.
2. By distributing your plugin in compiled form only you violate GPL.

Predailien12 08-21-2011 01:21

Re: SQL and Create KeyValue in databases.cfg
 
Quote:

Originally Posted by FaTony (Post 1537327)
1. I don't think it's really hard to get sensitive data out of smx.
2. By distributing your plugin in compiled form only you violate GPL.

Yes. so I abandoned this plugin
.

Peace-Maker 08-21-2011 13:57

Re: SQL and Create KeyValue in databases.cfg
 
Also the databases.cfg is parsed and cached on map start, so modifying it right prior connection won't find your newly added connection section.

You should consider writing a php script which serves the information needed and have your plugin just call the file from your webhost. Maybe add some licence keys and request limitations to stop spammers.

Predailien12 08-22-2011 01:07

Re: SQL and Create KeyValue in databases.cfg
 
Quote:

Originally Posted by Peace-Maker (Post 1537816)
Also the databases.cfg is parsed and cached on map start, so modifying it right prior connection won't find your newly added connection section.

You should consider writing a php script which serves the information needed and have your plugin just call the file from your webhost. Maybe add some licence keys and request limitations to stop spammers.

oops. thank you for you answer.
Now I've gotta find something related php.
do you have any related website?


All times are GMT -4. The time now is 05:59.

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