r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[MySQL]

Coccinelle
12-Jan-2006
[544]
Yes perhaps, it fails also with read
Pekr
12-Jan-2006
[545]
I am of course for fixing all possible bugs, but just now simply 
everything seems to work, we are able to connect to new dbs, that 
was main point ...
Coccinelle
12-Jan-2006
[546x3]
Here is the correction of the init function :
;------ Public interface ------

    init: func [port [port!] spec /local scheme args][

;    	either args: find spec #"?" [                              
                   ; removed

;    		spec: sys-copy/part spec args                             
 ; removed

;    		fast-query: dehex sys-copy next args                   ; removed

;    	][                                                         
                                       ; removed

;    		fast-query: none                                          
              ; removed

;    	]                                                          
                                        ; removed
        if url? spec [net-utils/url-parser/parse-url port spec] 
        scheme: port/scheme 
        port/url: spec 
        if none? port/host [

            net-error reform ["No network server for" scheme "is specified"]
        ] 
        if none? port/port-id [

            net-error reform ["No port address for" scheme "is specified"]
        ]

     either all [port/target args: find port/target #"?"] [           
                   ; added

      port/target: sys-copy/part port/target args                      
       ; added

      fast-query: dehex sys-copy next args                             
       ; added

     ][                                                               
                                                 ; added

      fast-query: none                                                 
                       ; added

     ]                                                                
                                                 ; added
        if none? port/target [

      net-error reform ["No database name for" scheme "is specified"]
        ]
        if none? port/user [port/user: make string! 0]
        if none? port/pass [port/pass: make string! 0]
        if port/pass = "?" [port/pass: ask/hide "Password: "]
    ]
For the lonlong conversion, the conversion model is initialized to 
none. It should be initialized to integer like this :
	conv-model: [
		decimal			[to decimal!]
		tiny			[to integer!]
		short			[to integer!]
		long			[to integer!]
		float			[to decimal!]
		double			none
		null			none
		timestamp		none
;		longlong		none		; Removed
		longlong		[to integer!]	; Added
		int24			[to integer!]
		date			[to date!]
		time			[to time!]
		datetime		[to date!]
		year			[to integer!]
		newdate			none
		enum			none
		set				none
		tiny-blob		none
		medium-blob		none
		long-blob		none
		blob			none
		var-string		none
		string			none
	]
And the last bug is that the "byte" word is not initialized to none 
and this cause a problem but I don't remember the effect :
;------ Data reading ------


;	b0: b1: b2: b3: int: int24: long: string: field: len: none	; Removed

 b0: b1: b2: b3: int: int24: long: byte: string: field: len: none	; 
 Added
Pekr
12-Jan-2006
[549x3]
nice - so, let's wait what Doc thinks about it ....
the truth is, that I met with no problem so far using current scheme 
....
but as I said - I am not sure, if ?query-here should work for other 
than 'read attempt .... 'open should imo only be provided with url 
plus target db, not query itself ...
Coccinelle
12-Jan-2006
[552x2]
I sent the bug and the correction to Doc some (many) month ago.
Here is the exact bug caused by the initi function (the bug was already 
found in november 2003)
>> db: open mysql://narg:?@host/bicycle
** Access Error: Cannot connect to narg
** Where: open-proto
** Near: db: open mysql://narg:?@host/bicycle
Dockimbel
12-Jan-2006
[554x5]
Fix #1 : Byte word added to local context.
Longlong conversion: I don't agree with you. The server returns a 
64-bits integer that you're casting to 32-bits integer, so your losing 
half of the data. Btw, even casting it to decimal! which is 64-bits 
wide won't be accurate because of the integer to floating point conversion 
issues. That's why I've left it to none (means keep it in raw string! 
format) and let each user decide how to process it. (The driver provides 
the 'change-type-handler global function to change that easily)
Fix #2 : port init now correctly handle '?' marker. I've used your 
patch as is. Works well with all my tests. Thanks for providing the 
fix for this long standing bug.
If anyone has some other patches, let publish it here. I'll wait 
a few more days before closing the beta state and declaring this 
version the new stable one.
New version 1.0.1 including these fixes available (http://softinnov.org/tmp/mysql-protocol.r).
Pekr
13-Jan-2006
[559]
Doc, what would be needed for the driver to work like Command driver? 
I mean the ability to db-conn: first db, and have multiple connections/channels 
to have available?
Dockimbel
13-Jan-2006
[560]
You already can have several connections opened at the same time 
with the current driver. I don't see the benefits of the /Command 
way. If you really need to have exactly the same behaviour, I guess 
that you have to overload the 'first function in my code and return 
a new port! using  the connection port  as 'sub-port.
Maarten
13-Jan-2006
[561]
Actually, I used to install Docs driver in Command anyway because 
it was much faster :-)
Gabriele
14-Jan-2006
[562]
yep, our detective portals use Doc's driver even though we run on 
command.
Dockimbel
14-Jan-2006
[563x2]
Guys, I keep been amazed how libmysql using C poorly performs against 
a direct TCP approach using REBOL.
I have plans for a version 2 of this driver including a full code 
rewritting for much cleaner design, speed improvements, optional 
async API, support more protocol features (like LOAD DATA), implement 
the v5 protocol, improved user API (e.g.: select column in a record 
by field name), etc...
Robert
14-Jan-2006
[565]
Exists a "standalone" mysql version? Or a standalone database that 
is mysql compatible?
Dockimbel
14-Jan-2006
[566]
What do you mean by standalone ?
Robert
14-Jan-2006
[567]
So, no big installation. Like a DLL or  just an EXE that's started.
Gabriele
14-Jan-2006
[568x2]
there is an embeddable version of mysql as a dll
but it is gpl afaik
Volker
14-Jan-2006
[570]
There is this apache + x which Terry likes. IIRC mysql is included 
too?
Robert
14-Jan-2006
[571]
well using a DLL won't make the rest GPL.
Gabriele
14-Jan-2006
[572]
so you need to contact mysql ab for use in non-gpl apps
Robert
14-Jan-2006
[573]
What's appache + x?
Volker
14-Jan-2006
[574]
some bundle for lamp on windows.
Gabriele
14-Jan-2006
[575]
it does, if yor programs depends on the dll (doesn't work without) 
though this is debatable (not proven in court i guess)
Robert
14-Jan-2006
[576]
So I wouldn't care.
Volker
14-Jan-2006
[577]
http://www.apachefriends.org/en/xampp.html, from framewerks-group
Gabriele
14-Jan-2006
[578]
but if you just need an sql engine... why not sqlite?
Robert
14-Jan-2006
[579]
I need one that's integrated into Rebol. Didn't took a look at it. 
Just thought it makes sense to have a protocol like DocKimbel's and 
re-use it with different databases (R-ODBC)
Volker
14-Jan-2006
[580]
sqlite is specially to run as DLL afaik.
Pekr
14-Jan-2006
[581x4]
Robert - you might be better looking somewhere else. Mysql embedded 
does not have tcp/ip api, just some library aproach ...
what about sqlite or rebdb? RebDB should be ok for most your projects 
imo ... (although 'join is badly missing)
Robert - french community did some work for sqlite iirc ... look 
at rebol.org ....
Doc - you once told me that your postgress driver is some xy percent 
faster, because of continuous parsing or so, maybe you could rewrite 
mysql to use similar principles?
Dockimbel
14-Jan-2006
[585]
Pekr: I'll use that method for the v2 of the driver. It also helps 
keep the code more elegant.
Pekr
14-Jan-2006
[586x2]
but mysql protocol is not your priority, is it? It simply works now 
:-)
Uniserve 1.0, or R# would be nice though :-)
Dockimbel
16-Jan-2006
[588x3]
My current priorities are project generating incomes. Unfortunately, 
I have very little time for other projects.
Uniserve is one of our base framework  (both for internal use and 
for our customers), so we're working on it actively.
I'll release it as soon as I find some time to update the docs and 
package it.
Ammon
17-Jan-2006
[591]
Doc,  I'm not sure if you've got this yet or not,  but we found a 
bug where the 'read-packet function's buffer was not getting expanded 
properly which was causing it to truncate some of our data.  To fix 
this problem then we added a local variable and added these lines:

tmp: pl/cache
pl/cache: make binary! pl/buf-size
system/words/insert tail pl/cache tmp

after this line:

pl/buffer: make binary! pl/buf-size: packet-len
Dockimbel
18-Jan-2006
[592x2]
Hi Ammon, it is possible that there's some issue maintainin the 2 
buffers size in sync. I've added your patch (with small modifications) 
to the current code.
v1.0.2 including Ammon patch uploaded.