SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 21/06/2016, 05:30 AM   #11
pawnuser
Little Clucker
 
Join Date: Aug 2015
Posts: 9
Reputation: 0
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Russian characters are replaced with "??". How to fix?
pawnuser is offline   Reply With Quote
Old 21/06/2016, 10:21 AM   #12
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 320
Reputation: 34
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by pawnuser View Post
Russian characters are replaced with "??". How to fix?
Use MySQL Charset.
Max_Andolini is offline   Reply With Quote
Old 21/06/2016, 10:58 AM   #13
pawnuser
Little Clucker
 
Join Date: Aug 2015
Posts: 9
Reputation: 0
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

I will perform this function, it recognizes the name on the account number in the database. (encoding declared at the beginning of fashion after the database connection)

stock GetAccountName(account)
{
new name[MAX_PLAYER_NAME];
if(SQL::RowExists("accounts", "ID", account))
{
new handle = SQL::Open(SQL::READ, "accounts", "ID", account);
SQL::ReadString(handle, "Name", name, MAX_PLAYER_NAME);
SQL::Close(handle);
}
return name;
}

The result of "return" is recognized in the "??"
pawnuser is offline   Reply With Quote
Old 21/06/2016, 01:30 PM   #14
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 320
Reputation: 34
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by pawnuser View Post
I will perform this function, it recognizes the name on the account number in the database. (encoding declared at the beginning of fashion after the database connection)

stock GetAccountName(account)
{
new name[MAX_PLAYER_NAME];
if(SQL::RowExists("accounts", "ID", account))
{
new handle = SQL::Open(SQL::READ, "accounts", "ID", account);
SQL::ReadString(handle, "Name", name, MAX_PLAYER_NAME);
SQL::Close(handle);
}
return name;
}

The result of "return" is recognized in the "??"
Use This

Code:
stock GetAccountName(account)
{
    new name[MAX_PLAYER_NAME];
    if(SQL::RowExists("accounts", "ID", account))
    {
        SQL::GetStringEntry("accounts", "Name", "ID", account, name, MAX_PLAYER_NAME);
        return name;
    }
    return 0;
}
Max_Andolini is offline   Reply With Quote
Old 21/06/2016, 03:50 PM   #15
pawnuser
Little Clucker
 
Join Date: Aug 2015
Posts: 9
Reputation: 0
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

LOL what?

I have mysql encoding settings(last):
"mysql_tquery(mysqlConnection, "SET NAMES cp1251", "", "");"
"mysql_tquery(mysqlConnection, "SET CHARACTER SET cp1251", "", "");"
And now I have:
" mysql_tquery(mysqlConnection, "SET NAMES cp1251", "", "");
mysql_tquery(mysqlConnection, "SET CHARACTER SET cp1251", "", "");
mysql_query(mysqlConnection, "SET NAMES cp1251");
mysql_query(mysqlConnection, "SET CHARACTER SET cp1251"); "
And it works!
It turns out, we specify the encoding for different queries, functions?
For mysql_tquery and mysql_query separately!
Problem was solved, thanks for a simplified version of my function!

-----------------------------FIX-------------
I've used for all requests this "mysql_tquery" function and so I have the encoding for the use of this function. "mysql_tquery" The script uses this function to query "mysql_query" means and coding should be for this function
pawnuser is offline   Reply With Quote
Old 21/06/2016, 04:47 PM   #16
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 320
Reputation: 34
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by pawnuser View Post
LOL what?

I have mysql encoding settings(last):
"mysql_tquery(mysqlConnection, "SET NAMES cp1251", "", "");"
"mysql_tquery(mysqlConnection, "SET CHARACTER SET cp1251", "", "");"
And now I have:
" mysql_tquery(mysqlConnection, "SET NAMES cp1251", "", "");
mysql_tquery(mysqlConnection, "SET CHARACTER SET cp1251", "", "");
mysql_query(mysqlConnection, "SET NAMES cp1251");
mysql_query(mysqlConnection, "SET CHARACTER SET cp1251"); "
And it works!
It turns out, we specify the encoding for different queries, functions?
For mysql_tquery and mysql_query separately!
Problem was solved, thanks for a simplified version of my function!

-----------------------------FIX-------------
I've used for all requests this "mysql_tquery" function and so I have the encoding for the use of this function. "mysql_tquery" The script uses this function to query "mysql_query" means and coding should be for this function
mysql_set_charset("cp1251");

Put this after connect.
Max_Andolini is offline   Reply With Quote
Old 21/06/2016, 05:07 PM   #17
pawnuser
Little Clucker
 
Join Date: Aug 2015
Posts: 9
Reputation: 0
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Well, I have a different, and works well and good))
pawnuser is offline   Reply With Quote
Old 21/06/2016, 07:45 PM   #18
Stones
Huge Clucker
 
Stones's Avatar
 
Join Date: Jun 2013
Location: United Kingdom
Posts: 249
Reputation: 56
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Thank you very much for this!
__________________
Stones is offline   Reply With Quote
Old 05/09/2016, 09:23 PM   #19
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 320
Reputation: 34
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

New version released.

Changes:

MySQL R40 compatibility.
Max_Andolini is offline   Reply With Quote
Old 06/09/2016, 11:18 AM   #20
morris91
Big Clucker
 
morris91's Avatar
 
Join Date: Feb 2008
Location: London, England
Posts: 170
Reputation: 32
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Im trying to make it so on attachment edit, it adds the floats etc.. to the row that correctly corresponds to the Username & Slot.

Code:
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
      new handle = SQL::OpenEx(SQL::UPDATE2, ""ATTACHMENTS"", "Username", pNick(playerid), "Slot", index);
Getting a argument 6 so guessing im missing something out.
Anyone can help? il be greatfull
morris91 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Easy MySQL 1.0 - Simplifying the usage of MySQL queries! ThePhenix Includes 93 08/01/2017 04:04 AM
[Include] Easy SQLite: Simplyfing the usage of SQLite queries! ThePhenix Includes 6 24/10/2015 05:35 PM
[Tutorial] MySQL-queries iRaiDeN Tutorials 2 21/03/2014 03:20 PM
Help with MySQL queries LiamM Scripting Help 4 20/03/2013 10:37 AM


All times are GMT. The time now is 02:28 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.