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

Simple Question Regarding SQL Callbacks


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Chief149
Member
Join Date: Sep 2010
Old 09-28-2016 , 19:53   Simple Question Regarding SQL Callbacks
Reply With Quote #1

So we of course have queries being called in the following manner:

PHP Code:
public void doMySQL() {
    
Handle g_hDB Some Valid MySQL Handle//PART1
    
char sQuery[256] = "SELECT * FROM mytable WHERE myconditions=true;";
    
SQL_TQuery(g_hDBSQL_HandleQuerysQuery);
}

public 
void SQL_HandleQuery(Handle dbHandle resultschar[] sErrorany data) {
    if(
db != INVALID_HANDLE)
        
delete db//PART2

So at //PART1 I have g_hDB which is a handle to a valid database. If I use this handle, the query is going to work, and eventually a response (or error) will come along to the callback.
The callback has "Handle db" as a parameter. This handle is a handle to the same database as g_hDB.

My question is, is db a clone of g_hDB. If I do "delete db" at the line commented with //PART2, then would I also be closing g_hDB? Or is db just a reference to the same handle as g_hDB?

Lastly, is it necessary to delete db? Assuming db is a clone of g_hDB. I only ask this because I have gone over a year without my plugin, which performs MANY queries, being closed due to a memory leak.
Chief149 is offline
 



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 07:13.


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