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

World: r3wp

[MySQL]

Dockimbel
24-Jun-2006
[769x2]
If your server goes down, your remaining client connections will 
timeout and generate an error value.
When 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.
Henrik
24-Jun-2006
[771]
ok
Dockimbel
24-Jun-2006
[772x2]
If the server is up again at the time of the reconnection, it should 
be ok.
I never tested such case deeply, so they might be some bugs/issue 
that I didn't saw.
Henrik
24-Jun-2006
[774]
maybe I'll do some tests when I get time :-)
Dockimbel
24-Jun-2006
[775]
Thanks, that would help me know if this feature works as expected.
Joe
22-Aug-2006
[776x2]
I 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 confirm
does anybody have an example using db-cached-query ? thanks
Gabriele
22-Aug-2006
[778x2]
if 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)
i 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... :(
Joe
22-Aug-2006
[780]
Yes, 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 row
Gabriele
22-Aug-2006
[781]
it's not very readable indeed. but i was going for speed ;)
Will
31-Aug-2006
[782]
Mysql Performance Tuning Best Practices:

http://video.google.com/videoplay?docid=2524524540025172110&q=google+engedu
Joe
12-Sep-2006
[783x3]
I have some sql that works fine using mysql db < file but fails with 
syntax error when using insert db reduce [query var1 var2]
the query file below. Any ideas ?
LOCK 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;
Gabriele
12-Sep-2006
[786x2]
you need multiple inserts, one for each query.
the mysql program does this automatically when you give it a file 
(using ; as separator)
Dockimbel
12-Sep-2006
[788]
You can do script it easily: foreach line parse file ";" [insert 
db line]
Gabriele
12-Sep-2006
[789]
he has to adjust for the variables he's using though.
Joe
12-Sep-2006
[790x2]
yes, this works :  i change first ? for "?1" and second for "?2" 
and have some replace before the insert
BTW, parse has to be parse/all . Also I get some  ERROR 1065: Query 
was empty .- maybe empty line at the end
Will
12-Sep-2006
[792x2]
I need to work with tree, category, subcategory, etc.. does anybody 
have something ready willing to share?) thx!
from 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?
MikeL
13-Sep-2006
[794]
I was just on the mySQL site and did a search for REBOL and was surprised 
to find 0 hits.
Pekr
13-Sep-2006
[795]
yes, 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 ...
Joe
14-Sep-2006
[796]
will, that is a great article. It explains why the adjacency list 
model is not good enough b/c it's not normalized
Will
14-Sep-2006
[797]
wops, 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 ;-)
Maarten
15-Sep-2006
[798]
I haven't, but Will, you could be that REBOL fellow ;-)
Dockimbel
16-Sep-2006
[799x7]
The 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.html
Of 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??).
Btw, 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)
It's event based, so the API is different from the current MySQL 
driver.
Here's a short example :
uniserve/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
The 'on-row and 'on-error events are currently missing.
Luca
28-Sep-2006
[806x4]
A query of mine loops and I can not understand the reason.
I gave a look to the protocol and found that :
* 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?
Oh... I'm using MySQL 4.1.9 and I have the same problem with both 
0.9.9 and 1.0.7 protocol versions.
Dockimbel
28-Sep-2006
[810x9]
I'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.
Options for testing what's wrong :
1) Try to reproduce the problem with the new async driver version 
(see the UniServe package in Uniserve! channel here).
2) 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.
3) Upgrade your MySQL server to latest 4.1.x version, or try with 
the latest 5.x version.
4) 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.
Just got an idea that should be your first thing to try :
Find the following line in the driver source :
buf-size: cache-size: 10000