REBOL3 - MySQL ([web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

#UserMessageDate
974james_nakWill, that would be sweet.Thu 23:43
973WillI have a mysql wrapper that I use in production but haven't released because it need cleaning and docs, but if there is interest I could release for testing as is. id does things like: print .db/get/all/sort/debug [mailing/m mailingLog/ml] [ml.dc m.email ml.url] [{ml._mailing=m.id}] [m.email asc ml.dc desc] SELECT `ml`.`dc`,`m`.`email`,`ml`.`url` FROM `mailing` `m`,`mailingLog` `ml` WHERE ml._mailing=m.id ORDER BY `m`.`email`,`ml`.`dc` DESC print .db/set/debug 'mailing 12 reduce['active false] UPDATE `mailing` SET `active`=0 WHERE id=12.0 print .db/get/all/flat/debug '_node_tree [_node _media] [{_tree=? AND _issue=?} 5443 22] SELECT `_node`,`_media` FROM `_node_tree` WHERE _tree='5443' AND _issue='22' ..Thu 10:09
972Gabrieleabout escaping, Nenad's driver has such functions already, so i don't see that as an advantage for the native driver. Qtask has a native driver too (for speed reason with large record sets), but remember that when you use the mysql c library either your app has to be GPL or you need a license from MySQL (Qtask has a license).Thu 9:39
971PekrIsn't REBOL fast enough for most operations in regards to MySQL? Wouldn't it be sufficient to write such escaping fun in REBOL?Thu 6:44
970PekrGuys, what do you think about Tim Johnson's ml remark? Could we help him somehow?

----------------------------------- I've been using mysql-protocol (Mysql Scheme) and cgi for many years now. I really like it, but I think that /command would bring some advantages, if it can directly access the "C" API for MySQL.

Example: Using the mysql scheme on a tcp/ip connection, I have to code the escaping of special characters for insert and updates and code the unescaping of special characters for retrieval.

Using the C API from other scripting languages, the mysql_real_escape_string() function handles the escaping _appropriate_ to the version, and queries are similarly unescaped.

Thu 6:43
969WillPlease 8PWed 14:18
968MaartenWill: I'll have to ask Reichart.Wed 9:11
967Willhere is a short and concise presentation about sphinx http://www.scribd.com/doc/2670976/Sphinx-High-Performance-Full-Text-Search-for-MySQL-PresentationWed 8:23
966Willbad question, but it would be cool to program stored procedures in rebolWed 2:22
965Willwould there be any advantage having rebol as an external language plugin compared to Dock sheme? http://forge.mysql.com/wiki/ProjectPage_External_Language_Stored_ProceduresTue 13:46
964WillMaarten: that is great news! Do you plan on releasing it for the rest of us?Tue 13:45
963Maarten(i.e. the search client protocol that can talk to Sphinx). You can also compile a client in mysql and then use sql for your queries.Sat 7:31
962MaartenWill, I have, and for Qtask I have even implemented the search protocol in REBOL. It's fast.Sat 7:30
961james_nakYou rock Doc. Thanks. That was an answer several years in the making!27-Jun 23:43
960DockimbelYes if the server is just restarted, no problem, the driver will reconnect.27-Jun 19:36
959Willok but your driver should reconnect automagically 8-)27-Jun 19:35
958Dockimbelyou can also use a simple : port: attempt [ open mysql://... ]27-Jun 19:34
957Dockimbelmysql-alive?: func [/host ip /port n /local p][ either attempt [ p: open/direct/no-wait join tcp:// [ either host [ip][127.0.0.1] #":" either port [n][3306] ] ][ close p yes ][ no ] ]27-Jun 19:31
956DockimbelHere's a handy function to test if a MySQL server is up :27-Jun 19:31
955WillDoes anyone experimented with the sphinx search engine? http://www.sphinxsearch.com/13-Jun 7:12
954BrianHRead the comments: The CEO of MySQL sets the story straight.18-Apr 3:03
953Willhttp://developers.slashdot.org/article.pl?sid=08/04/16/2337224 long life postgresql 8)18-Apr 3:02
952Willsome nice performance tips http://www.scribd.com/doc/393792/MySQL-performance-coding23-Mar 1:35
951james_nakDoc, first of all, thanks for the driver. It is amazing. Secondly, I've tried a few ways to be able to detect for an open port without the program erroring out. I've just settled on a "error? attempt [db/locals]" Do you have any recommendations?3-Oct 17:17
950DockimbelMySQL driver release v.1.2.0 - Download at : http://rebol.softinnov.org/mysql - Changed behaviour and syntax of the READ function. - Fix for parsing correctly quoted empty strings. (Fix by Oldes) - Fix for the driver loosing local flags, like 'flat, 'auto-ping?,... when reconnecting (thanks to Will Arp) - Fix a remanence issue on /flat and /raw flags in 'send-sql after automatic reconnection. (thanks to Will Arp) - Improved port recovery support after a failed request upon a shutdown server. - An init SQL string can now be specified for an opened port.3-Oct 10:30
949PaulCongrats Doc.3-Sep-07 2:32
948WillThank you Dock!2-Sep-07 23:53
947DockimbelThis new 'read implementation avoids the SQL encoding issues encountered in previous versions. The side effect it that it will break compatibility with previous sources using 'read.2-Sep-07 17:03
946DockimbelNew MySQL release 1.2.0 beta : http://softinnov.org/tmp/mysql-protocol.r

o Changed behaviour and syntax of the 'read command :

read mysql://root@localhost/ ==> return the list of databases

read mysql://root@localhost/db ==> return the list of tables in database "db"

read mysql://root@localhost/db/tbl ==> return the description of table "tbl" in database "db"

read/custom mysql://root@localhost/db ["...sql query..."] ==> execute the sql query on database "db" and return the resultset.

2-Sep-07 17:01
945Oldeshm... already found how to get the correct port number so now it's not important30-Aug-07 19:06
944OldesHow to connect to DB when I need to use sock ( for example: localhost:/home/hmm/mysql/mysql.sock )30-Aug-07 18:37
943DockimbelMySQL driver bugtracker : http://softinnov.org:8000/curecode/project.rsp?id=512-Aug-07 18:16
942DockimbelThis new beta fixes mostly auto-reconnection bugs or issues. Please test it and report any bugs in CureCode bugtracker and issues here.12-Aug-07 18:16
941DockimbelNew MySQL release 1.1.3 beta : http://softinnov.org/tmp/mysql-protocol.r

o Fix for parsing correctly quoted empty strings. (Fix by Oldes) o Fixed an issue in case of automatic reconnection, the driver looses local flags like 'flat, auto-ping?, etc...(thanks to Will Arp)

o Fix a remanence issue on /flat and /raw flags in 'send-sql after automatic reconnection. (thanks to Will Arp)

o Improved port recovery support after a failed request upon a shutdown server. Now the port will resume working once the server is up again.

o An init SQL string can now be specified for an opened port. That init string will be executed after automatic reconnections. (Useful to set, e.g., a specific charset value). Example :

db-port/locals/init: "SET NAMES 'latin2'"

12-Aug-07 18:15
940DockimbelThanks for the report, I'm adding your fix in the driver source.14-Jul-07 12:54
939Oldesthere should be: #"'" any ["\'" | "''" | not-squote] #"'" |{"} any [{\"} | {""} | not-dquote] {"}14-Jul-07 10:43
938Oldesthe problem is with the empty column in the query14-Jul-07 10:38
937Oldesand now I have a prove:

not-squote: complement charset "'" not-dquote: complement charset {"} ws: charset " ^-^M^/" data: {INSERT INTO hmm_kalendar_akce VALUES (NULL,9,'posledni-skotsky-kral',NULL,'(Last King of Scotland, The)','Poslední skotský král',NULL,NULL,'','http://www.kinoartbrno.cz/?stranka=film&film=posledni-skotsky-kral',0,NULL)}

;the parse part from insert-all-queries function: parse/all s: data [ any [ #"'" some ["\'" | "''" | not-squote] #"'" |{"} some [{\"} | {""} | not-dquote] {"} | #"`" thru #"`" | e: #";" ( probe "next query?" probe e ) any [ws] s: | skip ] ]

14-Jul-07 10:37
936OldesNow I'm sure there is something wrong in insert-all-queries function as it divides my query where is #";" (but inside data)14-Jul-07 10:32
935OldesVersion: 1.1.214-Jul-07 10:27
934Rebolekand are you sure you're using latest version? ;o)14-Jul-07 10:23
933OldesI have still some problems with semicolons:-(14-Jul-07 10:21
932Oldesit's safe13-Jul-07 17:58
931Dockimbel:-) so, does the driver need to be fixed for "&#039" sequences or is it safe let them passed untouched to the server ?13-Jul-07 14:20
930Oldesno... my mistake.. I'm just still using old version... the new one is fine:]13-Jul-07 13:31
929Oldeshmm.. so it's not so bad.. the problem is just with semicolon: insert db {insert into esctest values ("a;")} ;=== User Error: ERROR 106413-Jul-07 13:20
928Oldes(now = no, I'm = I've....etc.:-)13-Jul-07 13:09
927Oldesnow... it's an issue with the latest version as well!13-Jul-07 13:09
926Oldeshm... now I see there is some discussion above about injection issues.. maybe I'm older version of mysql and this issue is already fixed13-Jul-07 13:02
925Oldesinsert db "create table esctest (text TINYTEXT)" insert db "insert into esctest values ('a')" ;correct insert db "insert into esctest values ('a'')" ;=== User Error: ERROR 106413-Jul-07 12:58
924OldesI just found that there is a serious bug in sql-escape functions which is part of mysql-protocol... new versions of MySQL for example autoconvert "'" to ' which MUST be escaped or you will get error or your query may be injected! Current sql-escape function do not escape such a cases.13-Jul-07 12:53
923DockimbelMySQL driver bugtracker : http://softinnov.org:8000/curecode/project.rsp?id=55-Jul-07 13:33
922amacleodThat did not work either but I seem to have got it. I had previously copyed the database to a word like: data_info: copy db. But that gave me an error saying data_info is a set word. I changed it to data_info: send-sql/flat db "select * from jobs" THis seems to work. Thanks20-Jun-07 21:19
921Dockimbeldoes this line return a none! value too : send-sql db "SELECT * FROM jobs" ?20-Jun-07 9:09
920amacleodTrying to use the new [/flat] option for Doc's diver. If I use: "Insert db "SELECT * FROM jobs"I get the expected blocks withing block. But if I use the command: "SEND-SQL/FLAT db "SELECT * FROM jobs" I get "NONE"20-Jun-07 8:31
919DockimbelThanks, I didn't expected an almost x2 increase in speed! Cool ;-)16-Jun-07 18:52
918WillVERY NICE JOB Paul!16-Jun-07 18:38
917Will..1:37.92 minutes with latest version!16-Jun-07 18:38
916WillGREAT NEW, a basis benchmark with about 50'000 queries runs in 2:52.26 minutes and..16-Jun-07 18:37
915DockimbelMySQL driver release v.1.1.2 Download at : http://rebol.softinnov.org/mysql - Fix for an infinite loop issue when the server times out the connection (unix platforms). - TCP keepalive option activated by default (for longstanding idle connections). - Send-cmd function optimized to be a little bit faster and use less memory. - Added new-lines markers to resulting recorsets. - Added option to switch on/off new-lines marker through port/locals/newlines? flag. - Recycle call removed from read-rows function. Should speed up the results a little bit. - Minor source code cleanup.16-Jun-07 17:47
914Willneed help from mysql gurus ;-) have this where clause: WHERE MATCH (data) AGAINST ('"musŽe"' IN BOOLEAN MODE) now here they say that doublecuoting should make the match accent-sensitive, but noo 8-( http://forums.mysql.com/read.php?107,27969,29346#msg-29346 have set everything utf8 .. thanks!8-Jun-07 21:00
913DockimbelPublic release of MySQL Driver v.1.1.1 (bugfix release) : - Multi-statements queries parsing improved. Semi-colons included in quoted strings are now ignored. - Email!, url! and other any-string! values are now correctly escaped in prepared statements. - Empty block! values are now converted to "()" instead of "(NULL)".

http://rebol.softinnov.org/mysql

26-May-07 17:25
912WillThank you Dock!22-May-07 22:52
911DockimbelPlease let me know if there are still issues with multi-statements parsing.22-May-07 22:47
910DockimbelBeta release v1.1.1 with a fix for the semicolon issue in SQL strings : http://softinnov.org/tmp/mysql-protocol.r22-May-07 22:44
909Terrynevermind22-May-07 7:12
908TerryAm I missing something wihen querying multiple columns... seems I get the results as a single string.. ie: send-sql "select a, b from table";

returns something like "aresultbresult" ?

22-May-07 6:27
907DockimbelHi Joe, I should have time tomorrow to make that fix.20-May-07 20:06
906JoeHi Doc, When will you release the multi-statement fix ?19-May-07 14:33
905WillThank you Dock!13-May-07 14:53
904DockimbelInteresting case, you're right, it may confuse the multistatement processing, I'll make a fix for that asap.13-May-07 12:03
903Willit worked before the new multiple statements feature13-May-07 8:35
902Willthis doesn't: send-sql db "INSERT INTO `engine` (`id`,`style`) VALUES ('12','ciao;oo')" will send: {INSERT INTO `engine` (`id`,`style`) VALUES ('12','ciao}13-May-07 8:33
901Willthis works: send-sql db ["INSERT INTO `engine` (`id`,`style`) VALUES ('12',?)" "ciao;oo"] will send {INSERT INTO `engine` (`id`,`style`) VALUES ('12','ciao;oo')}13-May-07 8:33
900Willnot sure but with latest mysql-driver13-May-07 8:32
899Willcolumn names8-May-07 0:07
898Willquoted columns.. 8)8-May-07 0:06
897Will{SELECT `id`,`name`,`data` FROM `node` WHERE id='1' LIMIT 0,1}8-May-07 0:06
896Willwill send a query like:8-May-07 0:06
895Willdb-get 'node [id name data] [{id=?} 1]8-May-07 0:06
894Willand this:8-May-07 0:06
893Willnode: db-get 'node [] {id=1}8-May-07 0:05
892Willwhat about this?8-May-07 0:05
891Willnode: first send-sql/named db {select * from `node` where id=1 LIMIT 0,1}8-May-07 0:05
890Willnow you can:8-May-07 0:04
889Pekrnote that there are also community drivers mentioned ...7-May-07 11:17
888PekrDoc, I would try to apply to be listed here - http://www.mysql.com/products/connector/7-May-07 11:16
887DockimbelYou remind me that I should add a few lines about secure programming practices in the driver documentation.6-May-07 10:07
886MaartenAs always, smarter than I thought. And it is amazing what level of abstraction one can provide with so few lines of REBOL6-May-07 10:00
885Dockimbelif 'argument itself, contains quotes, they will be escaped.6-May-07 9:58
884Dockimbelargument: "SQL injection code" send-sql db [ "SELECT * FROM table WHERE field like ?" argument ]

will produce

" SELECT * FROM table WHERE field like 'SQL injection code' "

6-May-07 9:58
883Dockimbelfor example :6-May-07 9:57
882Dockimbelthe query (string!) will be properly quoted and escaped, so it should do no harm.6-May-07 9:55
881Maarteneven if 'argument is a SQL query in its own?6-May-07 9:53
880DockimbelI've hesitated between 'send-sql and 'do-sql. I've used 'do-sql for the Cheyenne/RSP database API, so the driver had 'send-sql.6-May-07 9:53
879DockimbelThe prepared statements mode should protect from SQL injection : send-sql db [ "...?..." argument ]6-May-07 9:49
878Maarten*send-sql6-May-07 9:45
877MaartenMe too. Should we add /prevent-sql-injection with send/sql?6-May-07 9:44
876TimWI really like the new preferred method. Thanks for adding that.4-May-07 19:10
875DockimbelMySQL Driver for REBOL version 1.1.0 released.

Changes : http://softinnov.org/rebol/mysql-usage.html#sect2.1. Download: http://rebol.softinnov.org/mysql/

1-May-07 20:35
874Willgreat! Thanks Doc 8)1-May-07 20:33
873Sunanda{switching to Library to answer that]1-May-07 14:54
872DockimbelCan I upload a ZIP archive or does it require to upload only a single REBOL script ?1-May-07 14:53
871Sunanda[maybe we should switch to Library -- we're off-topic for MySQL]1-May-07 14:53
870Maximwow glayout is in the top 10 :-) I'm proud :-)1-May-07 14:52
869SunandaThere's a top 250 most popular scripts -- available if you are logged on: http://www.rebol.org/cgi-bin/cgiwrap/rebol/script-popularity.r?top=250 The popularity rating is an imperfect attempt to factor out downloads by bots (and many other factors) and arrive at something meaningful.1-May-07 14:49
868DockimbelIs there a top 10 most downloaded scripts ? (could be usefull to newcomers)1-May-07 14:44
867DockimbelI see that rebol.org has improved a lot. Good work guys!1-May-07 14:42
866SunandaAs a script owner on REBOL.org you have access to up-to-the-minute access and download stats.1-May-07 14:41
865MaximI think many of us don't use rebol.org as much as we should.1-May-07 14:41
864DockimbelI didn't made it before because I wanted to keep track of the download stats (usefull info to estimate the size and activity of the community), but it's no more necessary, the community seems to be stable since several years now.1-May-07 14:40
863Maximcool ! :-)1-May-07 14:38
862SunandaI think that's a great idea, Doc! *** RT own the domain for rebol.org (and pay all the hosting charges). They have never vetoed any scripts .... the topic has never come up.

Publishing to REBOL.org leaves you with all your ownership rights (unlike some libraries that claim ownership on any contributions). All REBOL.org requires is the non-exclusive right to publish the script and its documentation: http://www.rebol.org/cgi-bin/cgiwrap/rebol/boiler.r?display=script-owner-faq

1-May-07 14:38
861DockimbelIf you think it's ok with RT, you can put a copy of the new driver in rebol.org once I release it (should be tonight).1-May-07 14:36
860Maximbut in general, it does seem like the concept of /pro will change or disapear.1-May-07 14:36
859Maximhenrik, maybe not... who says RT won't offer plugins for a fee?1-May-07 14:35
858Maximbut in any case, rebol.org is a community space. although the site H/W and domain is "owned" by RT , the actual service has no useage limits AFAIK.1-May-07 14:34
857HenrikAFAIK this problem will go away with R3 anyway1-May-07 14:34
856MaximI don't think so... people buy command for the ODBC IMHO.1-May-07 14:33
855Dockimbelsorry, concurrent => competitor1-May-07 14:33
854Dockimbeldon't you think it would be a problem for RT ?1-May-07 14:32
853Dockimbelrebol.org is RT's property. My driver is a free concurrent to RT's commercial one.1-May-07 14:31
852Maximdoc, would you allow rebol.org to host your msq libs? just in an attempt to increase awareness of the size and quality of the rebol code out there?1-May-07 14:26
851DockimbelThanks Gregg for your support !1-May-07 13:52
850GreggExcellent Doc! Thanks for continuing to improve it.1-May-07 13:48
849DockimbelI'm currently updating the documentation, I'll post in [Announce] when it will be ready for download.1-May-07 10:41
848Dockimbel- Support for multiple statements in queries has been added (separated by semicolons). Now, you can, for example :

send-sql db read %setup.sql

1-May-07 10:39
847Dockimbel- New "named fields" mode in the driver produce recordsets with named field. Example :

author: send-sql/named db "SELECT id, name, birthyear FROM authors WHERE id=1" print [author/name "is born in" author/birthyear]

1-May-07 10:38
846Dockimbel- There's now a new preferred way to query data, the SEND-SQL global function. The INSERT/COPY methods are still available for cases where finer-grained control or ressources optimization is required. Example:

send-sql [ /flat ] [ /named ] [ /raw ] db "SQL query or server command"

1-May-07 10:38
845DockimbelMySQL Driver 1.1.0 will be released today. The new features are :1-May-07 10:36
844Webb Stonehi27-Apr-07 16:59
843TimOOPS! didn't mean to hit ENTER. sorry. Anyway, there used to be a test site at http://powerofq.com - it is no longer available, I believe that the test module was 'mysqlprot. are those resources still available?8-Oct-06 0:08
842TimI'm preparing to switch my OS to a slack partition with MySQL 4.1 (I believe)8-Oct-06 0:04
841EdgarCal and I modified this line:

pl/buffer: make binary! pl/buf-size: packet-len

to this:

pl/buffer: make binary! pl/buf-size: packet-len + 10

and it works now. Your other suggestion must have fail because tmp may have been zero length.

2-Oct-06 5:47
840OldesBut I'm not storing such a big data29-Sep-06 6:57
839OldesI use the protocol with MySQL 4.1.5 and 5.0.22 and never noticed such a problem.29-Sep-06 6:54
838LucaNot solved using this last suggestion.28-Sep-06 22:06
837LucaThank to help solve it :-)28-Sep-06 21:57
836DockimbelGoing to sleep, will see the result tomorrow. Thanks for your help tracking this bug.28-Sep-06 21:56
835LucaSure :-)28-Sep-06 21:56
834Dockimbelthen try again.28-Sep-06 21:56
833Dockimbelrevert the initial buf-size to 10'00028-Sep-06 21:55
832LucaJust a moment...28-Sep-06 21:55
831Dockimbel(just one line changed)28-Sep-06 21:55
830Dockimbel;--- reading data --- if packet-len > pl/buf-size [ net-log reform ["Expanding buffer, old:" pl/buf-size "new:" packet-len] tmp: pl/cache pl/buffer: make binary! pl/buf-size: packet-len + length? tmp pl/cache: make binary! pl/cache-size: pl/buf-size sys-insert tail pl/cache tmp ]28-Sep-06 21:55
829Dockimbelby :28-Sep-06 21:54
828Dockimbel;--- reading data --- if packet-len > pl/buf-size [ net-log reform ["Expanding buffer, old:" pl/buf-size "new:" packet-len] tmp: pl/cache pl/buffer: make binary! pl/buf-size: packet-len pl/cache: make binary! pl/cache-size: pl/buf-size sys-insert tail pl/cache tmp ]28-Sep-06 21:54
827DockimbelLuca, let's try a more cleaner fix for this issue, replace the following code :28-Sep-06 21:54
826DockimbelTrue.28-Sep-06 21:53
825LucaThe read of the buffer size is done by the 'read-int24 rule, isn't it?28-Sep-06 21:51
824DockimbelSo, it looks like a bad read buffer size setting.28-Sep-06 21:46
823?Actually what I posted in Chat applies directly to MySQL, if anyone happens to know.28-Sep-06 21:45
822LucaGreat! Changing buf-size to 500000 solved the problem.28-Sep-06 21:45
821DockimbelRun your tests and tell me if this fix your problem (else try the others options).28-Sep-06 21:39
820Dockimbelbuf-size: cache-size: 500'00028-Sep-06 21:38
819Dockimbeland change it to :28-Sep-06 21:37
818Dockimbelbuf-size: cache-size: 1000028-Sep-06 21:37
817DockimbelFind the following line in the driver source :28-Sep-06 21:37
816DockimbelJust got an idea that should be your first thing to try :28-Sep-06 21:37
815Dockimbel4) If all options failed, turn trace/net on, run a test, log all exchanges with the server and send it to me by email for analysis.28-Sep-06 21:35
814Dockimbel3) Upgrade your MySQL server to latest 4.1.x version, or try with the latest 5.x version.28-Sep-06 21:33
813Dockimbel2) Get a packet analyser tool (Ethereal for example) and try to track the TCP exchange on port 3306 to see what the server is really sending to the client.28-Sep-06 21:32
812Dockimbel1) Try to reproduce the problem with the new async driver version (see the UniServe package in Uniserve! channel here).28-Sep-06 21:31
811DockimbelOptions for testing what's wrong :28-Sep-06 21:31
810DockimbelI'm aware of only one case where my protocol implementation may fail with a size difference of 1 byte between expected size and received size: that's the compression header case. This case can only happen when the client send a compression flag to the server. My driver never send such flag, so this case should never happen.28-Sep-06 21:30
809LucaOh... I'm using MySQL 4.1.9 and I have the same problem with both 0.9.9 and 1.0.7 protocol versions.28-Sep-06 14:02
808Luca* defrag-read port pl/buffer std-header-length

returns a 'packet-len of 108544 bytes

the next

* defrag-read port pl/buffer packet-len

loops because the 'read within 'defrag-read retrieves only 108543 bytes.

Any idea on how I can deal with this problem?

28-Sep-06 14:00
807LucaI gave a look to the protocol and found that :28-Sep-06 13:56
806LucaA query of mine loops and I can not understand the reason.28-Sep-06 13:53
805DockimbelThe 'on-row and 'on-error events are currently missing.16-Sep-06 16:23
804Dockimbeluniserve/boot/no-loop/with [protocols [MySQL]]

open-port mysql://root@localhost/test [ on-login-ok: func [db][ insert-port db "select * from test" ] on-field: func [db col][ print ["Field:" col/name] ] on-completed: func [db rows][ probe rows ] ] do-events

16-Sep-06 16:22
803DockimbelHere's a short example :16-Sep-06 16:22
802DockimbelIt's event based, so the API is different from the current MySQL driver.16-Sep-06 16:18
801DockimbelBtw, I've released an alpha version of a new MySQL driver implementation : complete rewrite from scratch to be fully async under UniServe, optimized decoding in speed (faster code, streaming decoding, etc...), supports only servers v5+. You'll find it in the latest UniServe archive (see UniServe group for link)16-Sep-06 16:16
800DockimbelOf course, I didn't use the protocol documentation on the web site (due to license restriction and also because, the documentation is deeply flawed (intentionnaly??).16-Sep-06 16:11
799DockimbelThe new MySQL web site is much less third-parties friendly. It looks like MySQL doesn't want to give much attention on alternatives drivers. They want ppl to use their own drivers and nothing other. The new MySQL protocol licence is more restrictive than before. They described a GPLed protocol concept (which a IMO, a very stupid concept...) See : http://dev.mysql.com/doc/internals/en/licensing-notice.html16-Sep-06 16:10
798MaartenI haven't, but Will, you could be that REBOL fellow ;-)15-Sep-06 7:11
797Willwops, I actually meant the" the nested set model" would be a good solution, had to write way too much code to retrive, cache, etc with the adjacency list model. Still wondering if some good rebol fellow has code ready, something like the article but with stored procedures? Anything better? mmm, and what if I'd like geolocalization, should I buy a book about PostGIS? please tell me there is a easier way! thx ;-)14-Sep-06 22:51
796Joewill, that is a great article. It explains why the adjacency list model is not good enough b/c it's not normalized14-Sep-06 22:21
795Pekryes, we have very good mysql driver, I wonder why it is not submitted there. IIRC I talked to Doc about it, and he told me, that some time ago it was there, but then mySQL IIRC redesigned site or something like that. He wated to wait for 1.0 release. It is now released, works with latest incarnations, so maybe we could ask Doc to submit it to mysql.com folks? Or just to get his approval to do so? It would be nice, if rebol would be listed there ...13-Sep-06 11:04
794MikeLI was just on the mySQL site and did a search for REBOL and was surprised to find 0 hits.13-Sep-06 10:43
793Willfrom here http://dev.mysql.com/tech-resources/articles/hierarchical-data.html I thing the adjacency list model would be a good solution, or is there something better withmysql 5 and stored procedures? or something in rebol?12-Sep-06 22:05
792WillI need to work with tree, category, subcategory, etc.. does anybody have something ready willing to share?) thx!12-Sep-06 22:01
791JoeBTW, parse has to be parse/all . Also I get some ERROR 1065: Query was empty .- maybe empty line at the end12-Sep-06 21:39
790Joeyes, this works : i change first ? for "?1" and second for "?2" and have some replace before the insert12-Sep-06 21:38
789Gabrielehe has to adjust for the variables he's using though.12-Sep-06 21:17
788DockimbelYou can do script it easily: foreach line parse file ";" [insert db line]12-Sep-06 19:02
787Gabrielethe mysql program does this automatically when you give it a file (using ; as separator)12-Sep-06 18:34
786Gabrieleyou need multiple inserts, one for each query.12-Sep-06 18:34
785JoeLOCK TABLE category WRITE; SELECT @myRight := rgt FROM category WHERE name =?; UPDATE category SET rgt = rgt + 2 WHERE rgt > @myRight; UPDATE category SET lft = lft + 2 WHERE lft > @myRight; INSERT INTO category(name, lft, rgt) VALUES(?, @myRight + 1, @myRight + 2); UNLOCK TABLES;12-Sep-06 17:59
784Joethe query file below. Any ideas ?12-Sep-06 17:58
783JoeI have some sql that works fine using mysql db < file but fails with syntax error when using insert db reduce [query var1 var2]12-Sep-06 17:58
782WillMysql Performance Tuning Best Practices: http://video.google.com/videoplay?docid=2524524540025172110&q=google+engedu31-Aug-06 18:30
781Gabrieleit's not very readable indeed. but i was going for speed ;)22-Aug-06 21:34
780JoeYes, gabriele , it's not a bug. I got confused by the three first , I think a clear way to code it would be "first first copy db" to indicate first value of the first row22-Aug-06 11:49
779Gabrielei used db-cached-query for vid LISTs, gives a huge speedup without using too much memory. (i had a custom list style though that was optimized for this). i don't have a simple example at hand... :(22-Aug-06 10:28
778Gabrieleif the behavior of the mysql-protocol has changed lately, then yes. when i wrote that, it needed that "first". (i used that function a lot so I know it worked)22-Aug-06 10:27
777Joedoes anybody have an example using db-cached-query ? thanks22-Aug-06 10:01
776JoeI am using mysql-wrapper.r . In function db-last-insert-id there should be one less "first" command to get the result. I think this is a bug, pls confirm22-Aug-06 8:33
775DockimbelThanks, that would help me know if this feature works as expected.24-Jun-06 18:19
774Henrikmaybe I'll do some tests when I get time :-)24-Jun-06 18:18
773DockimbelI never tested such case deeply, so they might be some bugs/issue that I didn't saw.24-Jun-06 18:17
772DockimbelIf the server is up again at the time of the reconnection, it should be ok.24-Jun-06 18:16
771Henrikok24-Jun-06 18:16
770DockimbelWhen a new request is sent through a timeout-ed connection, my driver will close the port and try to reconnect to the server. It tries 3 time and if it fails, generates an error.24-Jun-06 18:15
769DockimbelIf your server goes down, your remaining client connections will timeout and generate an error value.24-Jun-06 18:13
768Henrikah :-)24-Jun-06 18:11
767DockimbelI would be easier to understand if you replace the word "mysql", by either "client" or "server". ;-) But, anyway, I think I got the picture.24-Jun-06 18:10
766HenrikIf you restart mysql, there are no prior connections to handle for mysql, thus the test above works every time. If your connection times out, I wonder if mysql then does something different to create the connection again and then sometimes fails.24-Jun-06 17:49
765Henrikthat wasn't clear enough...24-Jun-06 17:47
764Henrikif you restart mysql, there are no prior connections to handle for mysql. if your connection times out, I wonder if mysql then does something different to create the connection again.24-Jun-06 17:47
763DockimbelI don't understand your question. Could you explain a little more ?24-Jun-06 17:44
762HenrikdocKimble, I just thought of something: what if, for MySQL, a time out is not the same as reconnecting to a restarted server?24-Jun-06 17:33
761DockimbelIf you've set up your MySQL server using a PHP tool like phpMyAdmin, your users are probably created with the OLD_PASSWORD mode, even if you're using v5+ servers (it's a PHP issue). My driver v1.0.7 should allow you to connect flawlessly to such configured server. Please try it and give me some feedback.24-Jun-06 16:45
760DockimbelIf some of you still have troubles connecting to a v4+ MySQL server with the last driver v1.0.6, please give a try to a new beta version (1.0.7) found here : http://softinnov.org/tmp/mysql-protocol.r24-Jun-06 16:40
759Rebolekto entertain community somehow so we do not complain to much? ;o)13-Jun-06 15:25
758Henrikwhat would be the point of R3 if it didn't contain threading?13-Jun-06 15:17
757Oldesor multitasking (I hope)13-Jun-06 15:06
756Pekrwhy do you presume R3 will contain async networking?13-Jun-06 14:47
755OldesA3 = R313-Jun-06 14:44
754Oldeswe will have to wait for A3:( but I still use the old alfa version of Rebol/Core with this script: http://oldes.multimedia.cz/rss/projects/a-pgsql/latest/a-pgsql.r13-Jun-06 14:44
753Graham"I like async internally, and anyway I remember I had problems with the non-asyns async - I think sometimes it was not able detect if the client closed connection or something like that, and i have my async version of postgres I'm using. I want new build of Core with async and rebocodes so much:("13-Jun-06 4:19
752Grahamposted by oldes 24 November13-Jun-06 4:19
751DockimbelIf anyone got useful patches to postgres driver, please publish them here.12-Jun-06 21:25
750Grahamwas it oldes who made some fixes for the postgres driver?12-Jun-06 21:00
749DockimbelPostgresql: Don't know, I may work on it this summer for a customer, so I may release new versions. I didn't had much feedback on this product, maybe too few users in the REBOL community...?12-Jun-06 20:53
748Henrikand intense bugfixing sessions 4 days before releasing 1.0 :-)12-Jun-06 20:52
747DockimbelIt takes, at least, 4 for years of beta-testing to become 1.0 ;-))12-Jun-06 20:51
746IngoGreat Doc! I didn't believe you'd ever call a version worthy of 1.0 ;-)12-Jun-06 18:07
745JaimeVargasDoc, any news on when will you go v1.0 with the postgress driver?12-Jun-06 14:56
744Dockimbeldo %mysql-protocol.r do %mysql-client.r mysql11-Jun-06 17:06
743DockimbelErratum: replace the step : do %mysql.r by :11-Jun-06 17:06
742Dockimbel1) Load the REBOL mysql console : do %mysql.r 2) Connect to the server 3) Command: show tables 4) result ok 5) Stop/Start the server 6) Command: show tables 7) result ok (the driver has reconnected transparently)11-Jun-06 9:25
741DockimbelDoing the following test works for me (v5 server) :11-Jun-06 9:24
740HenrikI can see that mysql console has no problem in reconnecting where rebol and mysql-admin fail11-Jun-06 8:00
739james_nakThank you. With the old protocol I would sometimes get an error (and exit from the program) when I inserted into a closed port. I will give these a shot.10-Jun-06 23:18
738DockimbelMy driver should reconnect automatically is the connection is closed by the server when you send a new request even after hours of sleeping. I need to test that with a v5 server to see if it behaves as expected.10-Jun-06 17:14
737Henrikthere are times when the connection to the database won't wake up after hours of sleep and the application locks. this also happens with mysql-admin, but I wonder if it really is server or a client side problem.10-Jun-06 17:02
736DockimbelIf it is at reading data : try [copy db-port] should work too.10-Jun-06 17:00
735DockimbelThis should work: either insert db-port [ping] [print "port opened"][print "port closed"]10-Jun-06 16:59
734james_nakBTW, an old question I continue to ask but how do you all handle checking whether a port is open or not?10-Jun-06 14:56
733james_nakThanks!10-Jun-06 14:55
732Willdownloading.., thank you!10-Jun-06 12:18
731Dockimbelhttp://softinnov.org/tmp/mysql-protocol.r10-Jun-06 12:17
730DockimbelI've just uploaded v1.06 which adds support for a few missing new datatypes.10-Jun-06 12:16
729HenrikI'm testing it over an ADSL connection now against a V5 server with multiple users. no trouble at all.10-Jun-06 12:13
728DockimbelI've just run a big stress test with 40'000+ requests generating around 2Gb of traffic without any trouble ! No bad handshakes anymore if you're using v5+ tables and new passwords.10-Jun-06 12:12
727HenrikI've found numerous bugs in mysql-admin. I think this tool is not particularly trustworthy10-Jun-06 12:11
726DockimbelI mean running a v5 server with v3.x tables.10-Jun-06 12:09
725DockimbelMySQL, even MySQL Admin tool get lost when acting like that.10-Jun-06 12:08
724Henrik"copying old 3.x files in v5 server works but results in a big mess and unstable behaviour" <--- is that because of MySQL or mysql-protocol.r?10-Jun-06 12:07
723DockimbelGood news : I've finally reached a very stable version of the mysql driver with v5+ servers ! The stability garanted only if using a database created with a v5+ server, copying old 3.x files in v5 server works but results in a big mess and unstable behaviour. Exporting/Importing v3.x data in v5 server using SQL flat files works very well (except for user with passwords, better recreate them in v5 directly).10-Jun-06 12:06
722Henrikcould be that <period> :-)6-Jun-06 20:36
721Henrikcould be that, it connects just fine now here at home6-Jun-06 20:36
720DockimbelThe server may try a reverse dns request on your IP when you connect and ends with a timeout after 60secs.6-Jun-06 20:33
719Henrikwhen the server is connected, everything runs at full speed6-Jun-06 20:25
718Pekror looking at mysql logs, if there is not something suspicious ...6-Jun-06 20:25
717Pekrnot sure what is causing the lag. You would need to look at low level communication - inspecting packets in something as ethereal ...6-Jun-06 20:24
716Henrikanother thing I experienced: The server was moved to a new location. For some reason, everything went FUBAR, because DNS had not been set up. This caused connecting to the server to take about 60 seconds to get through. When I looked in the list of connections, it just says "logging in" for that long time. I connect to the server with an IP address, not a host name, so what's going on?6-Jun-06 20:20
715Pekrok then ...6-Jun-06 20:18
714Pekrnot sure, not having enough experience, just stating what I remember about it ...6-Jun-06 20:18
713HenrikI didn't do that, so it must have been done with new passwords. I could immediately overwrite the old style password with the new style and it worked immediately6-Jun-06 20:18
712Pekrinstall from scratch6-Jun-06 20:17
711Henrikpekr, would it work the other way around as well? I thought it was only initial authentication that was different.6-Jun-06 20:17
710Pekrit is stated somewhere in docs iirc, you have to rebuild it .... the thing is, that length of old-password field is limited or something like that ...6-Jun-06 20:17
709Pekrimo it is like this - when you have db created with old scheme, db will not automatically rebuild it for you using new method ...6-Jun-06 20:16
708Henriksetting it up now (need to do it anyway)6-Jun-06 20:16
707DockimbelOk, I see...no problem, just post it here when you'll have the log.6-Jun-06 20:15
706Henrikthat'll take a short while, the PC that the mysql server is on has been taken down. :-)6-Jun-06 20:14
705DockimbelCould you activate : trace/net on before using mysql:// and show me here the server information retrieved by the driver.6-Jun-06 20:13
704Henrikthen I tried to turn them off again through the GUI and it didn't change.6-Jun-06 20:13
703HenrikI think the client is confused about that. The error log for it says that old passwords are not supported for 5.0. I initially tried to turn old passwords on, because I didn't think mysql-protocol.r supported newer ones.6-Jun-06 20:12
702Dockimbel16 chars are old passwords IIRC6-Jun-06 20:11
701Henrikwhen I created it from the console, I got a properly encrypted password like yours6-Jun-06 20:11
700Henrikso it's simply a different encryption scheme for some reason6-Jun-06 20:10
699Henrikok, mine are only about 16 chars long6-Jun-06 20:10
698Dockimbel"*63D85DCA15EAFFC58C908FD2FAE50CCBC60C4EA2"6-Jun-06 20:10
697Henrikif you look in your user table, what length is the encrypted password?6-Jun-06 20:09
696DockimbelTried creating a user using that tool under WinXP and OSX, then I tried connecting with mysql-protocol.r => no problem...6-Jun-06 20:08
695Henrikhttp://dev.mysql.com/downloads/administrator/1.1.html <--- that one6-Jun-06 20:05
694Henrikit's called "mysql-admin" under linux. looks like your name is correct.6-Jun-06 20:05
693DockimbelOk, so you mean MySQL Administrator (and not the mysqladmin.exe command line tool).6-Jun-06 20:04
692HenrikI'll see if I can find some docs on it. it's the client you can download from mysql.com6-Jun-06 20:03
691Henrikmysql-admin is a GUI client.6-Jun-06 20:00
690DockimbelHenrik: Can yo give me the mysqladmin command line you're using to create a new user ?6-Jun-06 19:58
689Tomcstating what you actually want to accomplish could help5-Jun-06 3:15
688Tomcvalid but not like useful , (or likely to finish soon)5-Jun-06 3:14
687Allenthat would be something like 70,000 * 70,000 results3-Jun-06 22:34
686Allennot a well constructed query. unless my mental parser isn't working. You are asking for each and every row where it doesn't match the current row... now I don't think that is your true intent ...3-Jun-06 22:31
685Willdumb question.. is this a valid query? select i1.id,i1.ip,i1.session from isa i1,isa i2 where i1.ip=i2.ip and i1.session<>i2.session order by i1.ip about 70'000 records in isa running this query seams to crash/block the mysql server..3-Jun-06 11:37
684Henrikexcellent3-Jun-06 11:04
683DockimbelI'll try to release an updated version this weekend that fix such case.3-Jun-06 11:00
682DockimbelSure it helps, thanks!3-Jun-06 10:59
681Henrikhope that helps a bit3-Jun-06 10:23
680Henrikworks when I set it with PASSWORD()3-Jun-06 10:23
679Henrikthat's the problem3-Jun-06 10:23
678Henriklooks like mysql-admin doesn't use PASSWORD() to create passwords3-Jun-06 10:21
677DockimbelThanks, I'll try with 5.0.21 + mysql-admin.3-Jun-06 10:16
676HenrikI used mysql-admin to create the user. I don't know which method it uses3-Jun-06 10:15
675Henrikserver 5.0.213-Jun-06 10:14

Return to Index Page