SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/07/2019, 07:24 PM   #111
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 107
Reputation: 15
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

Quote:
Originally Posted by Max_Andolini View Post
Version 3.7 released.

PHP Code:
Bugs solved.
Added insert options. (EngineCharset etc.)
Added Charset function in SQL::Connect.
Added Null or not null option in AddTableColumn.

SQL::Connect(const host[], const user[], const password[], const database[], const charset[] = "latin5"debugging 0port 3306bool:autoreconnect truepool_size 2);

new 
handle SQL::Open(SQL::CREATE"database""engine default InnoDB", -1"charset default latin5");
SQL::AddTableColumn(handle, const field_name[], SQL::datatypestype SQL_TYPE_INTmaxlength 11bool:null falsebool:auto_increment falsebool:setprimary falsebool:setindex false)
SQL::Close(handle); 
Great. Can we talk about how these still use the "%e" specifier using normal format instead of mysql_format still though?

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 
Meanwhile, normal format doesn't support "%e"; as shown here (https://wiki.sa-mp.com/wiki/Format):



The only one it does support is "%q" but that's irrelevant in this case.

Now just look at RowExistsEx2 from the latest version of this library:

PHP Code:
stock SQL::RowExistsEx2(const table[], const column_where[] = "", const row_identifier[], const column_where2[] = "", const row_identifier2[] = ""row_identifier3 = -1MySQL:connectionHandle MYSQL_DEFAULT_HANDLE)
{
    new 
query[SQL_FORM_LENGTH], query2[SQL_FORM_LENGTH], Cache:resultrows;
    
format(querysizeof(query), "SELECT * FROM `%s` WHERE `%s`='%e'"tablecolumn_whererow_identifier); // HERE.
    
if(!isnull(column_where2) && !isnull(row_identifier2) && row_identifier3 == -1)
    {
        
format(query2sizeof(query2), " AND `%s`='%e'"column_where2row_identifier2); // HERE AS WELL.
        
strcat(queryquery2);
    }
    if(!
isnull(column_where2) && row_identifier3 != -&& isnull(row_identifier2))
    {
        
format(query2sizeof(query2), " AND `%s`='%d'"column_where2row_identifier3);
        
strcat(queryquery2);
    }
    
strcat(query" ");
    
result mysql_query(connectionHandlequery);
    if(
mysql_errno() != 0)
    {
        return 
SQL_Warning("Query could not be completed due to error: %s"query);
    }
    
cache_get_row_count(rows);
    
cache_delete(result);
    if(
rows 0)
    {
        return 
rows;
    }
    return 
0;

CantBeJohn is offline   Reply With Quote
Old 09/07/2019, 09:45 PM   #112
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,761
Reputation: 840
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

I like the efforts put in this library but there's a reason why i deleted my EasyDB library(it was built for SQLite with the same purpose as this, before easy_mysql was even released), year(s) ago, because you don't really achieve any advantage using such a syntax, over speed. The biggest reason being you are not using threaded queries and not to mention you limit results because we don't have dynamic memory in default pawn so reading data is limited.

So I won't recommend anyone use this unless you don't care about speed and/or learning SQL.
__________________

Follow me on Github: Follow me on Spotify: Donate on Paypal:

Gammix is offline   Reply With Quote
Old 17/07/2019, 03:35 AM   #113
Aerotactics
High-roller
 
Aerotactics's Avatar
 
Join Date: Jun 2013
Location: return 0;
Posts: 1,083
Reputation: 112
Default Re: Easy MySQL - Simplifying the usage of MySQL queries!

I'm getting errors when using this include. Please look at this thread.

https://forum.sa-mp.com/showthread.php?t=668001
Aerotactics 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 8 16/03/2019 03:22 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 05:01 PM.


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