SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Discussion

Reply
 
Thread Tools Display Modes
Old 10/12/2017, 08:05 PM   #1
Meller
Gangsta
 
Meller's Avatar
 
Join Date: Dec 2016
Posts: 638
Reputation: 132
Default How do you name MySQL threaded queries?

title.
Meller is offline   Reply With Quote
Old 10/12/2017, 09:11 PM   #2
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 2,543
Reputation: 552
Default Re: How do you name MySQL threaded queries?

I use inline callbacks exclusively and call all my inlines "Handler". If you use public functions, then make sure their role is clear - as they are callbacks, usually use the "On" prefix, then exactly describe what they are processing.
Misiur is offline   Reply With Quote
Old 10/12/2017, 10:25 PM   #3
Meller
Gangsta
 
Meller's Avatar
 
Join Date: Dec 2016
Posts: 638
Reputation: 132
Default Re: How do you name MySQL threaded queries?

Quote:
Originally Posted by Misiur View Post
I use inline callbacks exclusively and call all my inlines "Handler". If you use public functions, then make sure their role is clear - as they are callbacks, usually use the "On" prefix, then exactly describe what they are processing.
I just recently started using inline callbacks, can you confirm for me; I can name all the inlines: "ThatInline" and it will all work fine with no interceptions?
http://prntscr.com/hlqf74
Meller is offline   Reply With Quote
Old 10/12/2017, 10:33 PM   #4
PatrickGTR
Little Clucker
 
PatrickGTR's Avatar
 
Join Date: Sep 2010
Location: United Kingdom
Posts: 18
Reputation: 48
Default Re: How do you name MySQL threaded queries?

Quote:
Originally Posted by Meller View Post
I just recently started using inline callbacks, can you confirm for me; I can name all the inlines: "ThatInline" and it will all work fine with no interceptions?
http://prntscr.com/hlqf74
as long as there are no inline called ThatInline inside a callback/function then your answer would be yes, also.

You don't need player parameter in that case, you could simply use playerid. Though your inline function should have a PROPER name that is related to it, its just a good practice.


so for example

Code:
public OnPlayerConnect(playerid)
{

    inline ThatInline()
    {
        SendClientMessage(playerid, -1, "You have called ThatInline");
    }
    mysql_tquery_inline(
        sqlHandle, 
        "SELECT COUNT(id) FROM accounts WHERE username = 'PatrickGTR'", 
        using inline ThatInline
    );
    return 1;
}
__________________
PatrickGTR is offline   Reply With Quote
Old 11/12/2017, 12:15 AM   #5
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 219
Reputation: 348
Default Re: How do you name MySQL threaded queries?

@PatrickGTR isn't it safer to pass parameters also? I don't know, maybe I'm paranoid!
RIDE2DAY is offline   Reply With Quote
Old 11/12/2017, 02:36 PM   #6
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,552
Reputation: 3000
Default Re: How do you name MySQL threaded queries?

Quote:
Originally Posted by RIDE2DAY View Post
@PatrickGTR isn't it safer to pass parameters also? I don't know, maybe I'm paranoid!
How do you mean "safer"? Why would you want two copies of a variable?
Y_Less is offline   Reply With Quote
Old 11/12/2017, 02:43 PM   #7
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 219
Reputation: 348
Default Re: How do you name MySQL threaded queries?

Quote:
Originally Posted by Y_Less View Post
How do you mean "safer"? Why would you want two copies of a variable?
I'm just wondering if is there any case where the variable might change its value. Maybe after all it isn't needed at all due the closures thing.
RIDE2DAY is offline   Reply With Quote
Old 11/12/2017, 04:53 PM   #8
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,637
Reputation: 202
Default Re: How do you name MySQL threaded queries?

I don't use anymore mysql yinline since it makes crash my server.
Anyway, I put the prefix 'On' before the function's name.
__________________
actor_plus - v4.1.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is online now   Reply With Quote
Old 12/12/2017, 02:14 PM   #9
Meller
Gangsta
 
Meller's Avatar
 
Join Date: Dec 2016
Posts: 638
Reputation: 132
Default Re: How do you name MySQL threaded queries?

Quote:
Originally Posted by Y_Less View Post
How do you mean "safer"? Why would you want two copies of a variable?
He probably means in these scenarios:

Client A connects to the server
Client A sends a server query to the active database handle
Client B connects to the server
Client B sends a server query to the active database handle
Client B receives the query response of Client A
Client A receives the query response of Client A

Now I don't know how inline work and neither does he probably, hence this question as this is remarkably done with normal callbacks using threaded queries.
Meller is offline   Reply With Quote
Old 15/12/2017, 08:00 PM   #10
Meller
Gangsta
 
Meller's Avatar
 
Join Date: Dec 2016
Posts: 638
Reputation: 132
Default Re: How do you name MySQL threaded queries?

Quote:
Originally Posted by Meller View Post
He probably means in these scenarios:

Client A connects to the server
Client A sends a server query to the active database handle
Client B connects to the server
Client B sends a server query to the active database handle
Client B receives the query response of Client A
Client A receives the query response of Client A

Now I don't know how inline work and neither does he probably, hence this question as this is remarkably done with normal callbacks using threaded queries.
^ still a remaining question
Meller 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
[Tutorial] MySQL Threaded queries with y_inline Jay_ Tutorials 20 22/01/2017 07:03 PM
Mysql threaded queries. ScIrUsna Scripting Help 1 18/03/2016 08:22 AM
MySQL Help - Threaded Queries. Lynn Scripting Help 3 09/01/2015 08:44 PM
MySQL Threaded Queries CONTROLA Scripting Help 4 25/11/2012 04:02 PM


All times are GMT. The time now is 02:11 PM.


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