World: r4wp
[Databases] group to discuss various database issues and drivers
older newer | first last |
GrahamC 18-Mar-2012 [75] | and put support engineers out of work?? |
BrianH 18-Mar-2012 [76] | Endo, that's an interesting topic; let's switch to Languages for that. |
Maxim 21-Mar-2012 [77x2] | using rebol's ODBC interface, is there a way to get the names of the columns in the last select query? sometimes, we do not provide the columns (select * from table) , so relying on assumptions to match return values and their columns is quite dangerous. |
another example is retrieving the db metadata. it would be nice to be able to know what columns do what from the returned data directly instead of assuming their order (which can change from one db version and provider to another) | |
BrianH 21-Mar-2012 [79x2] | With ChristianE's R3 ODBC, the initial insert dbport returns a header list translated to REBOL naming conventions, though it doesn't work right with unlabeled columns. Not sure with R2. |
If you want to get the column metadata about a table, use the 'columns command: - For R2: http://www.rebol.com/docs/database.html#section-27 - For R3: http://www.diefettenjahresindvorbei.de/odbc/odbc-docs.html#section-3.8 though there's an error in the docs, so use 'columns instead of 'tables | |
Maxim 21-Mar-2012 [81] | ok, so what do the columns returned by the [columns] query mean? (without docs, remember I'm not assuming the docs are up to date or even apply to Firebirds interface) I tried to list the RDB$FIELDS metadata table, but it clearly doesn't match the columns output. |
BrianH 21-Mar-2012 [82] | The docs for what the 'columns command returns are at the link for the R2 docs above. |
Maxim 21-Mar-2012 [83] | except that SQL actualy does return the column headers, its a pity R2's ODBC interface doesn't seem to keep/read it. |
BrianH 21-Mar-2012 [84x2] | The ODBC docs are up to date. Remember, the main problem with R2's ODBC support is that it hasn't changed at all in 11-12 years, though ODBC itself has. That does mean that the docs there are up to date. |
ChristianE's R3 interface returns the column headers, though that does need some work. | |
Endo 21-Mar-2012 [86] | I used 'columns and 'tables with R2 on SQL Server, it does work well. |
BrianH 21-Mar-2012 [87] | Back in 2001 I created an intranet site for a local celebrity by making the database tables, then having R2 use the 'columns command to generate column lists that were used to autogenerate the server-side pages for the intranet. All it took was one function call per table to generate the whole site. Restyling the site just meant editing the HTML template in the function (this was before CSS was practical). |
ChristianE 22-Mar-2012 [88] | I may find some time to tweak the R3 ODBC-API a bit if you could supply a prioritized list of things that need work. Regarding problems with certain SQL types one easy workaround could be to just allow all types without direct support by rebol to read them as strings, you then could do anything you like withthem. Regarding "R3's documentation for its port model is a bit lacking" - I surely won't have any time to find out why the port model I used feels alien to R3 without the better R3 beeing documented anywhere. |
BrianH 22-Mar-2012 [89x4] | We weren't requesting an update of the port model to you, Christian. That can wait until we have a better idea of what it should be. |
Here is the code I use to load your ODBC extension, which patches it after load: ; Load and patch the ODBC extension odbc: import/no-user %odbc.dll unless 'case = pick body-of :system/schemes/odbc/actor/open 10 [ system/schemes/odbc/actor/open: func [port [port!] /local result] bind [ port/state: context [access: 'write commit: 'auto] result: open-connection port/locals: make database-prototype [] case [ string? select port/spec 'host [ajoin ["dsn=" port/spec/host]] string? select port/spec 'target [port/spec/target] 'else [cause-error 'access 'invalid-spec port/spec] ] all [block? result lit-word? first result apply :cause-error result] port ] odbc ] | |
There was a bug in open with certain kinds of odbc port specs. The above code fixes that. | |
You can't do an R2-style hot-patch of a function in R3, but you can replace the entire function with a new, fixed one. | |
Sujoy 18-Apr-2012 [93x13] | I'm interested in creating a rebol associative db. Terry, I know, was talking about one such back in May last year (i think he called it rocketdb) - but apart from the altme logs and something on a redis google group, i cannot find anything. Does anyone know whether he released something or how i could contact him? |
So far, i have this: | |
ieflat: ["Steeve" "isa" "person" "Steeve" "age" "42" "Tweety" "isa" "Canary" "Tweety" "age" "75" "Chirp" "isa" "Canary"] | |
i1: make hash! 10 ;index subjects | |
i2: make hash! 10; index predicates | |
i3: make hash! 10; index objects | |
for i 1 length? ieflat 3 [either select i1 ieflat/:i [f: select i1 ieflat/:i append f :i][append i1 ieflat/:i repend i1 reduce [to-block :i]]] ;am sure there is a better way of doing this... | |
for i 2 length? ieflat 3 [either select i2 ieflat/:i [f: select i2 ieflat/:i append f (:i - 1)][append i2 ieflat/:i repend i2 reduce [to-block (:i - 1)]]] | |
for i 3 length? ieflat 3 [either select i3 ieflat/:i [f: select i3 ieflat/:i append f (:i - 2)][append i3 ieflat/:i repend i3 reduce [to-block (:i - 2)]]] | |
rocket: func [s p o it][ st: now/precise while[it > 0][ s: i1/(:s) p: i2/(:p) o: i3/(:o) res1: intersect s p o it: it - 1 ] prin join " -> " difference now/precise st ] | |
...this needs correction of course, to handle s p o combinations, but the basic idea is exactly as Terry had worked out | |
what would be useful is to build something like a SPARQL dialect on top of this | |
anyone interested? | |
Sunanda 19-Apr-2012 [106] | An associative database would be fun to have in REBOL. The 'map data structure in R3 replaces 'hash, and is supposed to be better. There have been some linkups between REBOL and the relavance associative database, but nothing much has come of it. http://www.rebol.org/aga-display-posts.r?offset=0&post=r3wp500x1919 http://www.rebol.net/cgi-bin/r3blog.r?view=0161 http://www.relavance.com/ |
Sujoy 19-Apr-2012 [107x2] | Thanks Sunanda - have seen those... have not been able to find the video of Ron Everett's talk though. Would be good to see it - would you happen to have a link? |
I think this would be the start of something superb. If we can build a SPARQL like query interface on top of an associative db in rebol, we could simply point it to any of the open data initiatives and then go on the ride of a lifetime! | |
Rebolek 19-Apr-2012 [109] | I wouldn't bet on MAP! very much (yet?). While it's very nice concept, lot of functionality is missing and what's implemented is buggy. OTOH it's nice and pretty fast. |
Sujoy 19-Apr-2012 [110x2] | i'm pretty happy with hash! so far...will try map! |
am still on R2 ? map tells me: map! datatype! hash! map? action! Returns TRUE for hash values. is map! only truly availale on R3? | |
Endo 19-Apr-2012 [112] | in R2 map! is there just for compability. map! = hash! in R2. x: make map! [a 1 b 2] series? x ; == true (for R2) series? x ; == false (for R3) |
Sujoy 19-Apr-2012 [113] | ah! ok...thanks endo |
Sunanda 19-Apr-2012 [114] | Sujoy.....Link to Devcon 2007 videos. Link is below, but you'll need a logon to the website. Someone else here will be able to advise you on that: https://www.prolific.com/quilt.fcgi#files?project=619&folder=2558 |
Gregg 19-Apr-2012 [115] | http://www.rebol.org/ml-display-message.r?m=rmlZLDJ Couldn't find an official script for it in rebol.org though. |
Sujoy 21-Apr-2012 [116] | thanks for the link Gregg |
Arnold 26-Apr-2012 [117] | I want to change some data in a mysql database from a REBOL (2) program using DocKimbel's mysql-portocol.r When I use a .r script from my website I can connect to the database. I figured that when I ran a script from a console I would be able to quickly test my script but somehow I am stopped because the script cannot connect. This is the error: ** Access Error: Cannot connect to mysql-01.yourname.nl ** Where: open-proto ** Near: Any ideas? |
james_nak 26-Apr-2012 [118] | Arnold, make sure you GRANT privileges to the mysql user before I could see it remotely. Make sure you use the '%' parameter or you won't see past the localhost. See mysql reference manual for help. Also make sure you open the port (3306) |
Endo 26-Apr-2012 [119] | You mysql server maybe configured to accept connections only from 127.0.0.1? |
james_nak 26-Apr-2012 [120] | I = you |
Endo 26-Apr-2012 [121] | and, try to connect from a remote PC using mysql command-line tool. |
james_nak 26-Apr-2012 [122x2] | If you are using Cpanel, there is a section to Grant, otherwise you may have to do it manually. |
Or in phpMyAdmin, if you have that. | |
Arnold 26-Apr-2012 [124] | I have the database on my host/provider's site, maybe that is only accepting requests by scripts on it's own local address. Could be. The % parameter? I have http://softinnov.org/rebol/mysql-usage.html#sect12. for my documentation. |
older newer | first last |