paste...@gmx.com schreef op 8 augustus 2023 01:49:15 CEST:
>
>
>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));

I don't understand. You need to do this in a function.
I did that in the executecommand function.

That way you can use it for different commands like show databases, select * 
from table, etc.

The first 3 are the length of package. (Part of command+sql)

4th is the package number (starting at 0 with each command because a command 
could consist of multiple packages when sending large sql). Not included in 
length.

5th is the command. $03 stands for Query.

Followed by the SQL itself.

>// 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));

You need to do
Buffer := #3 + 'show databases';
And then the line with length buffer, without the #3.

Didn't I do it like that already in ExecuteCommand??

~~
I'll work on a version later on this morning where I read all records into a 
TBufDatabase for local processing.
(I'll also change the way length is encoded so the first 3 are taken together 
so you don't need to add the #0#0#0.)

Grtz,
Rik



-- 
Verstuurd vanaf mijn Android apparaat met K-9 Mail. Excuseer mijn beknoptheid.


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

Reply via email to