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

Solved Multiple Results in Query


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConorCC
Member
Join Date: Feb 2014
Old 07-12-2021 , 16:53   Multiple Results in Query
Reply With Quote #1

Hello there!

Using SQLx is it possible to create a query that contains multiple SELECTs? I have created one but I only can receive the first one. Maybe I can switch between them later?

For example if I call a procedure then a select the result won't be set. The plugin says "[MySQL] No result set in this query!".

Of course I can put the select in the procedure and the problem is gone but I don't think it's a nice solution.

Thank you!

Last edited by ConorCC; 07-13-2021 at 11:15.
ConorCC is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-12-2021 , 17:49   Re: Multiple Results in Query
Reply With Quote #2

I hope this answer your question
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-12-2021 , 18:11   Re: Multiple Results in Query
Reply With Quote #3

UNION will work, but why not just set the query conditionally?

Code:
if ( some condition is true )
   SELECT A, B, C
else
   SELECT D, E, F
"Of course I can put the select in the procedure and the problem is gone but I don't think it's a nice solution."

Then don't
PHP Code:
CallQuerybool:bSomeCondition )
{
    if ( 
bSomeCondition )
        
SELECT ABC
    
else
        
SELECT DEF
}

public 
client_connectid )
{
    if ( 
is_user_botid ) )
        
CallQuerytrue )
    else
        
CallQueryfalse );

    
//or
    
CallQueryis_user_botid ) );

__________________

Last edited by Bugsy; 07-12-2021 at 18:16.
Bugsy is offline
ConorCC
Member
Join Date: Feb 2014
Old 07-13-2021 , 01:05   Re: Multiple Results in Query
Reply With Quote #4

I think you missunderstood.

Here is my code.

PHP Code:
CALL `CX_TEST`('%i', @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14); 
SELECT @p1 AS `r_error_code`, @p2 AS `r_error`, @p3 AS `r_id`, @p4 AS `r_item_id`, @p5 AS `r_user_id`, @p6 AS `r_in_use`, @p7 AS `r_expiration`, @p8 AS `r_amount`, @p9 AS `r_new_id`, @p10 AS `r_new_item_id`, @p11 AS `r_new_user_id`, @p12 AS `r_new_in_use`, @p13 AS `r_new_expiration`, @p14 AS `r_new_amount`; 
Let me explain. I call the CX_TEST procedure that using output parameters from @p1 to @p14. So after it's executed the only thing I have to do to select the variable values.

In this case I must run both scripts in one query but since I call the CX_TEST first and then the select the sql result will be empty.

Last edited by ConorCC; 07-13-2021 at 07:12.
ConorCC is offline
ConorCC
Member
Join Date: Feb 2014
Old 07-13-2021 , 11:14   Re: Multiple Results in Query
Reply With Quote #5

Fixed! I put the whole script into an another procedure so when I call the new one the response is what I expected.
ConorCC is offline
Reply



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 08:15.


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