World: r3wp
[MySQL]
older newer | first last |
Reichart 11-Jul-2008 [993] | Qtask might do this in the future... |
Graham 12-Jul-2008 [994x8] | Never used mysql before .. and just downloaded Nenad's driver. |
Getting this ... >> insert db "select * from patientrecord" == none >> result: copy db ** Script Error: Invalid argument: 0000-00-00 ** Where: convert-types ** Near: change at row 3 to >> | |
looks like some of the patient records have 0000-00-00 as the date of birth in them. | |
ok, this works round it insert db "select cast( birthdate as char) from patientrecord" | |
ummm.. how do you do a select on a field where the field name has a space in it? | |
Why would anyone put a space in a field name?? | |
docs say \_ is a space >> insert db "select middle\_name from patientrecord" ** User Error: ERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ve rsion for th... ** Near: insert db "select middle\_name from patientrecord" | |
ok, worked it out insert db "select `middle name` from patientrecord" | |
Dockimbel 13-Jul-2008 [1002] | MySQL driver v1.2.1 released. See more at http://softinnov.org |
Graham 13-Jul-2008 [1003] | Thanks for fixing the date zero error. |
Will 13-Jul-2008 [1004] | Thank you Dock! |
Dockimbel 14-Jul-2008 [1005x2] | For a long time, I was reluctant to change the date zero behaviour (error throwing), because this "feature" of MySQL look, to me, like very bad design. But recently, I hit the problem too when I inserted badly formed dates in a table and wasn't able to read the records anymore with my driver. |
Version 1.2.1 re-released. There was a small error in the 'name-fields function preventing it from working. Thanks to Will for reporting it. | |
Will 5-Aug-2008 [1007] | James: sorry for the delay, still not found time for docs but her it is "as is.." /debug is your friend, get started, load Dock driver , then load http://reboot.ch/rebol/mysql-wrapper.txtthen: ;set a list of connections: .db/databases: [ ;local mydb1.local mysql://user:[password-:-127-:-0-:-0-:-1]/mydb1 mydb2.local mysql://user:[password-:-127-:-0-:-0-:-1]/mydb2 ;online mydb1 mysql://user:[password-:-127-:-0-:-0-:-1]:3307/mydb1 mydb2 mysql://user:[password-:-127-:-0-:-0-:-1]:3307/mydb2 ] ;use a db (if not open will open it automatically): .db/use 'mydb1 |
james_nak 5-Aug-2008 [1008] | Thanks Will. |
Alan 14-Sep-2008 [1009] | . |
Dockimbel 11-Nov-2008 [1010x3] | I've just upload a new experimental 1.3 version of MySQL driver supporting mutiple queries, stored procedures and multiple result sets. Reading mutiple results is done by calling COPY for each result. Download at http://softinnov.org/tmp/mysql-protocol-41.r |
Keep in mind that if you're using SEND-SQL, it already does a implicit COPY. | |
It should be considered as a early beta, so test it well before using. | |
Pekr 11-Nov-2008 [1013] | good news! |
Dockimbel 11-Nov-2008 [1014] | Thank Gabriele for keep pushing me. ;-) |
Will 11-Nov-2008 [1015] | Thank you! 8-)) |
Gabriele 12-Nov-2008 [1016x4] | the above new version seems to work fine for simple tests, apart from the issues Nenad has already listed. |
this is going to be very useful :-) | |
BTW, Maarten told me that he knows for sure that you can get the number of result sets in advance, if he doesn't show up here (he can't be much in front of a computer these days), maybe you could email him to get more info. | |
(he can read the mail address listed here on altme from his ipod touch) | |
Maarten 12-Nov-2008 [1020] | I'm here. I think there is a C API call for the number of result sets. Primitive, but this is how to do it: http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html |
Dockimbel 12-Nov-2008 [1021] | Thanks for the link, that confirms that's possible to detect the last result set. I'm keep getting "more results"' status even for the last set, but now I think that it's caused by a bug in my code. I'll look at it this week end (too busy until there). |
Gabriele 13-Nov-2008 [1022] | Maarten, you're working too much :) Nenad: thanks! If I have some time, I'll have a look too, though I will just be making guesses. :) |
Dockimbel 15-Nov-2008 [1023x4] | New version 1.3 of new MySQL driver released as beta. (same URL). Changes: - Fixed the multiple result sets end-of-stream issue. Now an extra COPY will return NONE, marking the end of the data stream. - Fixed error message parsing for protocol 4.1. - Added SQL request delimiter property to port/locals/delimiter (default: #";") |
It now passes all my non-regression tests, but I've done several deep changes, so I'll consider it beta until the end of the year before declaring it the new official version. | |
Here's an example showing the new possibilities combined (multiple queries support, setting custom delimiter and multiple results support) : db: open mysql://[root-:-localhost]/mysql db/locals/delimiter: "*;*" insert db "show tables; show databases" copy db ; <= returns tables block! copy db ; <= returns databases block! copy db ; <= returns none! | |
Enjoy ! :-) | |
Oldes 26-Nov-2008 [1027] | It looks, that there is something wrong with MySQL procedures: using mysql.r mysql> CREATE PROCEDURE myproc() SELECT 'it works!'; mysql> call myproc(); +-----------+ | it works! | +-----------+ | it works! | +-----------+ 1 row(s) in set mysql> call myproc(); mysql> On the second run it returns nothing. using it in cheyenne gives error: Error Code : 800 Description : user error ! ERROR 1312 : PROCEDURE webcore.myproc can't return a result set in the given context Near : [do-sql 'webcore "call myproc();" txt 3195] Where : none |
Gabriele 27-Nov-2008 [1028] | the cheyenne error is probably because you need the new version of mysql:// that Doc posted a few days ago |
Dockimbel 27-Nov-2008 [1029x2] | Oldes: are you sure you're using the 1.3 beta mysql:// driver ? You can find it here : http://softinnov.org/tmp/mysql-protocol-41.r |
Calling stored procedures is not supported in driver versions < 1.3. | |
Oldes 27-Nov-2008 [1031x4] | I thought I'm, but the version was older.. now it's working fine:) |
But there must be a bug anyway .... the first one shows that.. next sql query after the procedure call returns none. | |
I've send more info into private in R3-alpha... anyway.. I wonder where it's possible to find some mysql protocol spec. Do you just do reverse engineering? | |
found it http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol | |
Dockimbel 27-Nov-2008 [1035] | I used to reverse-engineer, but since 5.0(?) MySQL AB documents the protocol with sometimes (intentional?) blocking errors. |
Dockimbel 28-Nov-2008 [1036x3] | After analyzing the report you sent to me about issue with sproc. MySQL has a odd behaviour, it seems to always return 2 result sets for a sproc even when you're expecting only one (the second will then be empty). So, after calling a sproc you have to call COPY twice (or once after a SEND-SQL) to flush the remaining data. I'm looking in the driver to see if I can automate this flushing process. |
Improved version of MySQL driver 1.3 beta released at http://softinnov.org/tmp/mysql-protocol-41.r Changes: - Improved automatic flushing of unread data. Now you can forgot the second COPY on sproc calls (should be robust, but needs testing). - Multiple SQL requests are now sent as one packet by default. No more need to change the db/locals/delimiter value for 4.1+ servers. | |
I might drop out the SQL requests splitting code (and also the delimiter option) from the driver as now everything is sent as-is to the server. It might still be useful for big SQL files, not sure what the best strategy should be in such case (send file as one big packet, or split it and send each request one by one) ? | |
Dockimbel 3-Dec-2008 [1039x2] | Bugfix revision for MySQL driver 1.3 beta at http://softinnov.org/tmp/mysql-protocol-41.r Changes: - Fixed a regression bug appearing when trying to open a connection without a database name. - Fixed "port not open" error after automatic reconnection. |
The change I did on [Fri 21:21] version on the way SQL requests with multiples statements are sent to the server, might not be a good idea for sending big SQL batch files to the server. The previous method (slicing SQL requests and sending them one by one to the server) wasn't that bad (could allow streaming the reading of a big SQL file from disk). Maybe it should be good to let the user choose how the driver should send multiple SQL queries. | |
Will 3-Dec-2008 [1041] | Thanks Dock! 8) |
Gabriele 3-Dec-2008 [1042] | http://softinnov.org/tmp/mysql-protocol-41.r |
older newer | first last |