NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Ability to run complex mysql commands in DB Client


Joined: 26 Nov 2018
Posts: 19
Reply with quote
I have these mysql lines in DB Client SQL:

set @a := 0;
select (@a := @a+1) as NrCrt, data, timp, id_em, id_ep from orar;

Why I cannot run them together?
View user's profileFind all posts by piotrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7955
Reply with quote
DB client just passes the statements to server then server decides what to do with them.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 26 Nov 2018
Posts: 19
Reply with quote
dmitri wrote:
DB client just passes the statements to server then server decides what to do with them.

The same does heidisql, mysql workbench... In fact, DB CLient from Netbeans and so on. But they pass well and the result is a good one.
That means that DB CLient from PhpED is an unfinished product.

Can you do it work? Smile
View user's profileFind all posts by piotrSend private message


Joined: 26 Nov 2018
Posts: 19
Reply with quote
Something like that:

View user's profileFind all posts by piotrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7955
Reply with quote
some servers like Sybase or MSSQL can support batches. In this case you have write them as one statement, like below

declare @ent_type_bit tinyint
select @ent_type_bit = 32
select ent, pack_type = case when length > 0 and length != full_length then 2 else 0 end, 0
from split
where sat = @sat AND sat_key = @sat_key AND split_id = @chunk and (ent_type & 32) = @ent_type_bit
at isolation 0

if @@rowcount = 0 and @ent_type_bit != 0
select ent, pack_type = case when length > 0 AND length != full_length then 2 else 0 end, 0
from split
where sat = @sat and sat_key = @sat_key and split_id = @chunk and (ent_type & 32) = 0

and this all works as a batch returning multiple rowsets. Note that neither of the statements have any delimiters like semicolon.

Other servers do not support batches. They won't accept your multiple statements and can't return multiple rowsets, so there is a help from the IDE required.
If you write multiple statements delimited with semicolon, like in your case, PhpED will send them one by one expecting no rowsets in return. This way you can run for example mysql dumps.
I don't see the point why you'd need to run inserts and selects at the same time. Why don't you run inserts then selects?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 26 Nov 2018
Posts: 19
Reply with quote
OK! I'll use other software for mysql.
View user's profileFind all posts by piotrSend private message
Ability to run complex mysql commands in DB Client
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic