using your first version and placing these lines above the   'break line'   i 
got    show databases    working  with both these

sd :=  chr($0f) + chr($00) + chr($00) + chr($00) + chr($03) + 'SHOW DATABASES'; 
// good   <--    is there beter coding method then this without having th use 
chr( for each hex to 'harcode' show databases ?  - hexstr didn't do it
sock.sendstring(sd);
writeln(sock.recvpacket(2000));

// for general command query use
buffer := 'SHOW DATABASES';
buffer := chr(1 + length(buffer)) + #0#0#0 + #3 + buffer; // good   <--  had to 
add  the   1 + length(buffer       to your example    and  the #3
sock.sendstring(buffer);
writeln(sock.recvpacket(2000));





On Mon, 7 Aug 2023 19:19:19 +0200
Rik van Kekem <r...@graficalc.nl> wrote:

> Op 07-08-2023 om 18:32 schreef paste...@gmx.com:
> > Buffer := 'show databases;';
> > writeln(Buffer);
> > buffer := Buf2Hex(buffer);
> > Buffer := #03 + Buffer + #0; // #03 com_query header    #0 <eof>
> > writeln(Buffer);
> > sock.sendstring(buffer);
> BTW you missed the length here.
> I have:
>
> Buffer := Command + SQL;
> Buffer := chr(length(buffer)) + #0#0 { len 3 bytes } + #0 { packnum } +
> Buffer;
>
> Although the first 3 bytes should be the length but here I have max 255
> because I only use the first byte;
> That should be different if you get larger SQL's.
>
> Grtz,
> Rik


_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to