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

World: r3wp

[MySQL]

Will
3-Jul-2008
[973]
I 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'
..
james_nak
3-Jul-2008
[974]
Will, that would be sweet.
Graham
5-Jul-2008
[975]
Gabriele, I thought you only needed a license if you are releasing 
your software ....
Gabriele
6-Jul-2008
[976]
graham, i'm not entirely sure, in principle the GPL2 is as you say, 
however i'm not sure if MySQL has a different interpretation here. 
iirc the GPL3 states that being a server for users is the same as 
releasing the software.
BrianH
6-Jul-2008
[977x2]
No, that's the Affero GPL.
They took that clause out of the regular GPL3 during the review process, 
after many protested it.
Graham
7-Jul-2008
[979]
So, looks like you didn't need a license
Gabriele
7-Jul-2008
[980]
Qtask? no, it does, because you can also put qtask on your own server.
Graham
7-Jul-2008
[981]
Has that happened yet?
Gabriele
7-Jul-2008
[982]
i don't think you can buy it right now, and the focus has shifted 
to the SaaS model, but otherwise there are no major tech obstacles 
iirc. ask reichart for more details, i'm not really up to date on 
the marketing/sales stuff :)
Graham
7-Jul-2008
[983]
He's often mentioned that they are considering open sourcing qtask 
in which again the license was not needed!
Gabriele
7-Jul-2008
[984]
well, not all of qtask, but again i don't really know. i know they 
talked to mysql and all is fine. i'm not implying they paid or are 
paying money, since i don't know. my point is that Qtask has permission 
from MySQL to do what they do, while you may not if you were to use 
the same code. Is that more clear?
Graham
7-Jul-2008
[985]
Why didn't qtask use postgresql instead??
Maarten
7-Jul-2008
[986]
Why is the world flat?
Graham
7-Jul-2008
[987]
because of a limited viewpoint
Maarten
7-Jul-2008
[988]
I agree, your viewpoint wasn't economics....
Graham
7-Jul-2008
[989]
With two open source databases to choose from of approximately similar 
functionality and stability, it is hard to understand why one would 
choose the one that has the restrictive license ... I can only imagine 
it is a mind share thing.
Will
7-Jul-2008
[990]
James, thanks for your interest, I' ll upload it in a couple days 
8)
james_nak
7-Jul-2008
[991]
Thanks.
Gabriele
8-Jul-2008
[992]
Why wouldn't Qtask want to talk to Postgres too if they had chosen 
it?
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. 
:)