Op 08-08-2023 om 01:49 schreef paste...@gmx.com:
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));
Are you still there :lol:
The last version is here (revision 3):
https://gist.github.com/rvk01/ac22d368b8d1f7d537cf0c67389bda20
It has a SendPacket where you feed it the buffer and it prefixes it with
the correct length and package number.
(you asked for that)
The example code at the bottom does the following:
1) connects to the server
2) does a ping (you could do this to make sure you are still connected)
3) does a 'show databases'
4) switches to mysql database
5) does a select on all users in the user table of the mysql database
The ExecuteCommand create a TBufDataset and populates it with the
corresponding SQL resultset.
In the example code you see that you can just do a while Dataset.EOF to
retrieve the records.
(For a table with millions of records this might become a problem but
this code is just for showing communications with mariadb)
PS. Currently the TEXT query/communication is used. For more complex and
longer resultsets you would need to switch to BINARY method.
Can you still follow everything? (or did I loose you halfway ;) )
Any more ideas to implement?
Grtz,
Rik
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public