World: r3wp
[MySQL]
older | first |
Andreas 20-Oct-2010 [1228x2] | In any case, I'd probably just do plain queries and construct the JSON from the resultset. |
http://www.json.org/json.rwill help you with the encoding. | |
amacleod 20-Oct-2010 [1230] | Might that be a burden on hte server for very large queries? |
Andreas 20-Oct-2010 [1231x3] | Makes no difference. |
Either you transfer a very large string which you build up within MySQL. Or you transfer a very large result set and build up the string in REBOL. | |
Also note that the above approach with CONCAT/GROUP_CONCAT does not help you with JSON-specific encoding. So changes to you'll in fact create wrong JSON are rather high. | |
amacleod 20-Oct-2010 [1234x2] | I used json.r. New to json.... I'm going to want an json object right? |
If a query gives me a rebol block of blocks and I send it through json.r I don't get a json object. Should I work on converting the query to a rebol object first? | |
Andreas 20-Oct-2010 [1236] | Precisely. |
amacleod 20-Oct-2010 [1237] | ok, so there is no easy way to do it...I justs need to loop through each rebol block and insert the field name before the data and then make objeet? |
Andreas 20-Oct-2010 [1238x2] | Yes. |
Which should be easy, if you have the right functions available :) | |
amacleod 20-Oct-2010 [1240] | Thanks, I thought there might be some Mysql command to insert column names with the data... THanks for your help. |
Andreas 20-Oct-2010 [1241] | There might well be. |
Dockimbel 20-Oct-2010 [1242] | amacleod: NAME-FIELDS function might help : http://softinnov.org/rebol/mysql-usage.html#sect11. (it works on a single record only, so you'll need to loop through the recordset anyway) |
Gregg 20-Oct-2010 [1243] | You should get back a top-level JSON object, but nested blocks will be arrays, not objects. e.g. >> rebol-to-json [a: 1 b: 2 c: [d: 4 e: 5] f: #[object! [g: 6 h: 7]]] == {["a", 1, "b", 2, "c", ["d", 4, "e", 5], "f", {"g": 6, "h": 7}]} |
GrahamC 22-Sep-2011 [1244] | mysql:// question at http://synapse-ehr.com/forums/showthread.php?454-mysql-problem-what-does-this-error-mean |
Dockimbel 22-Sep-2011 [1245] | The link is not working for me, I get a "Invalid Thread specified. If you followed a valid link, please notify the administrator". |
GrahamC 22-Sep-2011 [1246x2] | mysql problem what does this error mean? Hello, I am just looking at REBOL and trying to access mysql I got this error?? =================================== connecting to: 127.0.0.1 ** User Error: ERROR 1251 : Client does not support authentication pro tocol requested by server; consider upgrading MySQL client ** Near: db: open mysql://[rootass-:-127-:-0-:-0-:-1]:3306/mysql ============================================== This the code I am using from rebol document Rebol[ title: "Rebol Mini-Text Database with Visual GUI" author: "http://reboltutorial.com/blog/rebol-mini-text-database/" version: 1.0.0 ] do %mysql-protocol.r probe first system/schemes db: open mysql://[rootass-:-127-:-0-:-0-:-1]:3306/mysql insert db { DROP TABLE IF EXISTS products; CREATE TABLE products ( name VARCHAR(100), version DECIMAL(2, 2), released DATE ); INSERT INTO products VALUES ('cheyenne', '1.0', '2007-05-31'); INSERT INTO products VALUES ('mysql', '1.1', '2007-05-01'); } insert db read %setup.sql ;-- execute a big SQL file |
link above works for me | |
Gabriele 22-Sep-2011 [1248] | Maybe he's using an older version of the mysql driver? |
GrahamC 22-Sep-2011 [1249] | I'll ask ... |
Dockimbel 22-Sep-2011 [1250] | It looks like the MySQL driver he's using is too old for his MySQL server. He should try with the latest version for newer servers: http://softinnov.org/tmp/mysql-protocol-41.r I haven't made it official as it does not work for older servers IIRC, and I also never found the time to fully test it with more recent ones. But it should work correctly. |
GrahamC 22-Sep-2011 [1251] | Ok, posted |
Endo 22-Sep-2011 [1252x2] | The problem could be this as well: http://dev.mysql.com/doc/refman/5.5/en/old-client.html |
when you upgrade your mysql server from 4.x to 5.x the passwords in your "mysql" table for users stays old, which hashed a different algorithm.. so you cannot connect it using username/password anymore. | |
GrahamC 25-Sep-2011 [1254] | I think the link didn't work because I discovered it was a moderated thread. |
james_nak 21-Oct-2011 [1255] | Doc, what a lifesaver! I just spent the last 7 hours trying to figure out what was wrong with my remote rebol-based mysql app. It stopped working after I upgraded mysql. I spent most of my time messing around with mysql until I narrowed it down to the protocol. sql-protocol-41.r Addresses: User Error: ERROR 1251 : Client does not support authentication protocol requested by server; consider upgrading MySQL client (When using newer long hash passwords) and User Error: ERROR 1043 : Bad handshake (when using older short hash passwords) Thank you for posting this. I was getting to the point of panic. |
Dockimbel 21-Oct-2011 [1256:last] | Glad to hear that my driver helped you solve your issue. :-) |
older | first |