SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 23/06/2018, 02:45 PM   #101
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 328
Reputation: 37
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by JR_Junior View Post
sorry:
PHP Code:
error 035argument type mismatch (argument 6
EDITD-FIX: new handle = SQL::OpenEx(SQL::MREAD, "Accounts", "", "", "", "", -1, 10, -1, "Money");
I don't see
Max_Andolini is offline   Reply With Quote
Old 23/06/2018, 02:56 PM   #102
JR_Junior
Huge Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 226
Reputation: 54
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Thank you very much for this update!
It's working perfectly now.

Keep improving this wonderful include.
JR_Junior is offline   Reply With Quote
Old 17/09/2018, 04:34 AM   #103
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 87
Reputation: 15
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

PHP Code:
SQL::DeleteRowEx2
SQL
::GetStringEntryEx2
SQL
::t_GetStringEntryEx2
SQL
::GetIntEntryEx2
SQL
::GetFloatEntryEx2
SQL
::SetIntEntryEx2
SQL
::SetStringEntry2
SQL
::SetStringEntryEx2
SQL
::SetFloatEntryEx2
SQL
::RowExistsEx2
SQL
::DeleteRow3 
All these functions use the "%e" specifier using the normal format instead of mysql_format, so they won't work. I noticed this when I tried using RowExistsEx2.
CantBeJohn is online now   Reply With Quote
Old 17/09/2018, 04:34 PM   #104
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 328
Reputation: 37
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by CantBeJohn View Post
PHP Code:
SQL::DeleteRowEx2
SQL
::GetStringEntryEx2
SQL
::t_GetStringEntryEx2
SQL
::GetIntEntryEx2
SQL
::GetFloatEntryEx2
SQL
::SetIntEntryEx2
SQL
::SetStringEntry2
SQL
::SetStringEntryEx2
SQL
::SetFloatEntryEx2
SQL
::RowExistsEx2
SQL
::DeleteRow3 
All these functions use the "%e" specifier using the normal format instead of mysql_format, so they won't work. I noticed this when I tried using RowExistsEx2.
Send me your code.
Max_Andolini is offline   Reply With Quote
Old 18/09/2018, 01:52 AM   #105
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 87
Reputation: 15
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by Max_Andolini View Post
Send me your code.
It has nothing to do with my code, I'm simply pointing out that as it is, there's multiple sections throughout the include that uses %e with "format" instead of "mysql_format" for directly escaping strings; but only mysql_format supports %e. Once I edited the include (in my case specifically; RowExistsEx2), my code worked perfectly.
CantBeJohn is online now   Reply With Quote
Old 21/09/2018, 04:23 PM   #106
Amagida
Little Clucker
 
Join Date: Oct 2017
Posts: 24
Reputation: 14
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

PHP Code:
LoadPlayerBankCards(playerid)
{
    new 
p_name_inside_f[MAX_PLAYER_NAME], Query[164], DBResult:GetPlayerBankCardsDialog_String[226];
    
    
GetPlayerName(playeridp_name_inside_fsizeof(p_name_inside_f));

    
format(Querysizeof(Query), "SELECT * FROM `bank-cards` WHERE `username` = '%s'"DB_Escape(p_name_inside_f));

    
format(Dialog_Stringsizeof(Dialog_String), "\tBaratis Saxeli\tTanxa\n");

    
GetPlayerBankCards db_query(UsersQuery);

    if(
db_num_rows(GetPlayerBankCards))
    {

        for(new 
ii<db_num_rows(GetPlayerBankCards); i++)
        {
            new 
card_name[64], card_cashcard_idcards_info[64];

            
db_get_field_assoc(GetPlayerBankCards"cardname"card_namesizeof(card_name));
            
card_cash db_get_field_assoc_int(GetPlayerBankCards"cash");
            
card_id db_get_field_assoc_int(GetPlayerBankCards"id");

            
p_bank_card[playerid][p_bank_card_loaded[playerid]][cash] = card_cash;
            
p_bank_card[playerid][p_bank_card_loaded[playerid]][b_c_id] = card_id;
            
strcat(p_bank_card[playerid][p_bank_card_loaded[playerid]][name], card_name);
            
p_bank_card_loaded[playerid]++;

            
format(cards_infosizeof(cards_info), "\t%s\t%d\n"card_namecard_cash);
            
strcat(Dialog_Stringcards_info);
            
            
db_next_row(GetPlayerBankCards);
        }
    }
    else
    {
        
SendClientMessage(playerid, -1"Tqven Ar Gaqvt Sabanko Baratebi!");
    }
    
db_free_result(GetPlayerBankCards);

    
ShowPlayerDialog(playerid81DIALOG_STYLE_TABLIST_HEADERS"Sabanko Baratebi"Dialog_String"Sworia""Bugia");

    return 
1;    

How can i make this using Easy MySQL?
Amagida is offline   Reply With Quote
Old 21/09/2018, 05:25 PM   #107
willbedie
Gangsta
 
willbedie's Avatar
 
Join Date: Feb 2016
Location: Albania
Posts: 522
Reputation: 40
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

I have to say, it's best you stick to original MySQL. I've tried making a gamemode before with this include and not to be rude, it was pretty shit. I had to rewrite a 7k line code on MySQL then, and I've decided to never use this again.
__________________


willbedie is offline   Reply With Quote
Old 29/09/2018, 12:10 PM   #108
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 328
Reputation: 37
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by Amagida View Post
PHP Code:
LoadPlayerBankCards(playerid)
{
    new 
p_name_inside_f[MAX_PLAYER_NAME], Query[164], DBResult:GetPlayerBankCardsDialog_String[226];
    
    
GetPlayerName(playeridp_name_inside_fsizeof(p_name_inside_f));

    
format(Querysizeof(Query), "SELECT * FROM `bank-cards` WHERE `username` = '%s'"DB_Escape(p_name_inside_f));

    
format(Dialog_Stringsizeof(Dialog_String), "\tBaratis Saxeli\tTanxa\n");

    
GetPlayerBankCards db_query(UsersQuery);

    if(
db_num_rows(GetPlayerBankCards))
    {

        for(new 
ii<db_num_rows(GetPlayerBankCards); i++)
        {
            new 
card_name[64], card_cashcard_idcards_info[64];

            
db_get_field_assoc(GetPlayerBankCards"cardname"card_namesizeof(card_name));
            
card_cash db_get_field_assoc_int(GetPlayerBankCards"cash");
            
card_id db_get_field_assoc_int(GetPlayerBankCards"id");

            
p_bank_card[playerid][p_bank_card_loaded[playerid]][cash] = card_cash;
            
p_bank_card[playerid][p_bank_card_loaded[playerid]][b_c_id] = card_id;
            
strcat(p_bank_card[playerid][p_bank_card_loaded[playerid]][name], card_name);
            
p_bank_card_loaded[playerid]++;

            
format(cards_infosizeof(cards_info), "\t%s\t%d\n"card_namecard_cash);
            
strcat(Dialog_Stringcards_info);
            
            
db_next_row(GetPlayerBankCards);
        }
    }
    else
    {
        
SendClientMessage(playerid, -1"Tqven Ar Gaqvt Sabanko Baratebi!");
    }
    
db_free_result(GetPlayerBankCards);

    
ShowPlayerDialog(playerid81DIALOG_STYLE_TABLIST_HEADERS"Sabanko Baratebi"Dialog_String"Sworia""Bugia");

    return 
1;    

How can i make this using Easy MySQL?
PHP Code:
LoadPlayerBankCards(playerid)
{
    new 
p_name_inside_f[MAX_PLAYER_NAME], Dialog_String[226];
    
GetPlayerName(playeridp_name_inside_fsizeof(p_name_inside_f));
    
format(Dialog_Stringsizeof(Dialog_String), "\tBaratis Saxeli\tTanxa\n");

    if(
SQL::RowExistsEx("bank-cards""username"p_name_inside_f)) 
    {    
        new 
handle SQL::OpenEx(SQL::MREAD"bank-cards""username"p_name_inside_f); 
        
SQL::ReadRetrievedRows(handlei)
        {
            
SQL::ReadString(handle"cardname"p_bank_card[playerid][p_bank_card_loaded[playerid]][name], 64i);
            
SQL::ReadInt(handle"cash"p_bank_card[playerid][p_bank_card_loaded[playerid]][cash], i);
            
SQL::ReadInt(handle"id"p_bank_card[playerid][p_bank_card_loaded[playerid]][b_c_id], i);    

            
format(cards_infosizeof(cards_info), "\t%s\t%d\n"p_bank_card[playerid][p_bank_card_loaded[playerid]][name], p_bank_card[playerid][p_bank_card_loaded[playerid]][cash]);
            
strcat(Dialog_Stringcards_info);            
        }
        
SQL::Close(handle);
    }
    else
    {
        
SendClientMessage(playerid, -1"Tqven Ar Gaqvt Sabanko Baratebi!");
    }

    
ShowPlayerDialog(playerid81DIALOG_STYLE_TABLIST_HEADERS"Sabanko Baratebi"Dialog_String"Sworia""Bugia");
    return 
1;    

Max_Andolini is offline   Reply With Quote
Old 12/10/2018, 07:55 AM   #109
GameOvr
Big Clucker
 
Join Date: Jun 2018
Posts: 101
Reputation: 0
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

what about easy-sqlite arn't you developing that
GameOvr 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 SQLite: Simplyfing the usage of SQLite queries! ThePhenix Includes 7 14/07/2018 10:12 AM
[Include] Easy MySQL 1.0 - Simplifying the usage of MySQL queries! ThePhenix Includes 93 08/01/2017 04:04 AM
[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 07:14 AM.


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