Raised This Month: $51 Target: $400
 12% 

SQL and Create KeyValue in databases.cfg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Predailien12
Senior Member
Join Date: Feb 2010
Location: Your as* hol*
Old 08-19-2011 , 21:39   SQL and Create KeyValue in databases.cfg
Reply With Quote #1

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?

Last edited by Predailien12; 08-19-2011 at 21:58.
Predailien12 is offline
tjdgns9246
Member
Join Date: Dec 2009
Old 08-20-2011 , 01:06   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #2

Quote:
Originally Posted by Predailien12 View Post
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

Last edited by tjdgns9246; 01-10-2013 at 11:34.
tjdgns9246 is offline
Predailien12
Senior Member
Join Date: Feb 2010
Location: Your as* hol*
Old 08-20-2011 , 04:05   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #3

Quote:
Originally Posted by tjdgns9246 View Post
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
Predailien12 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 08-20-2011 , 05:29   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #4

Quote:
Originally Posted by Predailien12 View Post
because i can't show database information.
There's your main problem. Fix it and reply back.
__________________
FaTony is offline
Predailien12
Senior Member
Join Date: Feb 2010
Location: Your as* hol*
Old 08-20-2011 , 11:11   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #5

Quote:
Originally Posted by FaTony View Post
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?

Last edited by Predailien12; 08-20-2011 at 12:12.
Predailien12 is offline
Predailien12
Senior Member
Join Date: Feb 2010
Location: Your as* hol*
Old 08-20-2011 , 11:45   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #6

Quote:
Originally Posted by FaTony View Post
There's your main problem. Fix it and reply back.
Does non-threaded from server A crash with threaded from server B?
Predailien12 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 08-20-2011 , 19:24   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #7

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.
__________________
FaTony is offline
Predailien12
Senior Member
Join Date: Feb 2010
Location: Your as* hol*
Old 08-21-2011 , 01:21   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #8

Quote:
Originally Posted by FaTony View Post
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
.
Predailien12 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 08-21-2011 , 13:57   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #9

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.
__________________
Peace-Maker is offline
Predailien12
Senior Member
Join Date: Feb 2010
Location: Your as* hol*
Old 08-22-2011 , 01:07   Re: SQL and Create KeyValue in databases.cfg
Reply With Quote #10

Quote:
Originally Posted by Peace-Maker View Post
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?
Predailien12 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:06.


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