Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Strange mysql scheme port errors

 [1/6] from: kracik::mbox::dkm::cz at: 17-Feb-2001 14:00


Hi, First, congratulations to DocKimbel for the mysql:// scheme. However, I got these errors when I try a simple select from a movie database:
>> db: open mysql://rebol:[reb--192--168--22--4]/rebtest
connecting to: 192.168.22.4
>> insert db "show tables"
== none
>> first db
== [["tFilm"]]
>> insert db "select * from tFilm"
== none
>> first db
Now REBOL/Core 2.3.0.3.1 prints: ** User Error: Error: inconsistent packet length !. ** Where: first db while REBOL/View 0.10.38.3.1 and REBOL/core (Experimental) 2.4.40.3.1 print: ** User Error: Error: end of stream not found. ** Where: first db Also, a shorter sequence works in /Core 2.3.0.3.1, but cannot close the port in /View 0.10.38.3.1 and experimental /Core 2.4.40.3.1:
>> db: open mysql://rebol:[reb--192--168--22--4]/rebtest
connecting to: 192.168.22.4
>> insert db "select * from tFilm"
== none
>> first db
== [[1 "Higher Learning" 1994 127 "John Singleton" {Jennifer Connelly, Ice Cube, Omar Epps, Michael Rapaport}]]
>> close db
** Access Error: Network timeout ** Near: close db I use MySQL 3.22.32 on FreeBSD 4.0, REBOL on Windows NT and mysql-protocol version 0.8.4. I can access the table with MySQL ODBC driver from Microsoft Access and REBOL/Command beta. -- Michal Kracik

 [2/6] from: dockimbel:free at: 18-Feb-2001 13:03


Hi Michal, Michal Kracik wrote:
[...]
> ** User Error: Error: inconsistent packet length !. > ** Where: first db > > while REBOL/View 0.10.38.3.1 and REBOL/core (Experimental) 2.4.40.3.1 > print: > > ** User Error: Error: end of stream not found. > ** Where: first db >
[...] These kind of error should not happen. They show a low-level communication problem with the server. After doing some tests based on your examples, i think i've found what is causing these errors : You're using 'first to get records one by one but you're supposed to finish reading all the pending datas before sending another request to the server. If you leave unread data and send a new request, the driver get lost and gives you timeout or "end of stream not found" errors. When you use 'copy, you know that all data has been read when it returns you a 'none value. When you use 'first, the end is reached when an empty block is returned. It doesn't behave like in /Command where 'first returns an error if no more data is available. I found it handier when looping on 'first to test the end with 'empty? than 'error? 'try ... So, your example should work if you call 'first one more time :
>> db: open mysql://rebol:[reb--192--168--22--4]/rebtest
connecting to: 192.168.22.4
>> insert db "show tables"
== none
>> first db
== [["tFilm"]]
>> first db
== [] All datas have been read from the server and the driver remains in a clean state, so you can send new requests :
>> insert db "select * from tFilm"
== none
>> first db
== [[1 "Higher Learning" 1994 127 "John Singleton" {Jennifer Connelly, Ice Cube, Omar Epps, Michael Rapaport}]]
>> while [not empty? probe first db][] ; will read all records.
... ...
>> close db >>
Please, test this and tell me if i'm right or if you're still getting errors. In the next release, i'll make the driver a little smarter for testing the end of "the data stream", so you'll don't need anymore to call an extra 'first or 'copy function to make the driver happy. HTH, DocKimbel.

 [3/6] from: g:santilli:tiscalinet:it at: 18-Feb-2001 14:42


Hello Nenad! On 18-Feb-01, you wrote: NR> In the next release, i'll make the driver a little smarter NR> for testing the end of "the data stream", so you'll don't NR> need anymore to call an extra 'first or 'copy function to NR> make the driver happy. Also, I noticed that you have to read from the port after an update query too (otherwise errors are not reported and subsequent queries won't work). I'll see if I can fix this up myself, if you don't mind. Currently I use the following function: do-query: func [port [port!] query [string!]] [ insert port query pick port 1 ] for update queries. Anyway, good job Nenad! Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [4/6] from: dockimbel:free at: 18-Feb-2001 23:41


Hi Gabriele ! Gabriele Santilli wrote:
> Hello Nenad!
[...]
> Also, I noticed that you have to read from the port after an > update query too (otherwise errors are not reported and subsequent
<<quoted lines omitted: 5>>
> ] > for update queries.
You're totally right. I missed that one. The correction i'm planning to do for the next release should also work in that case. Anyway, if you got ideas on how this thing should be fixed or more generally how the driver could be improved, i would be very happy to hear them ! BTW, i'm surprise that nobody asked me why i used pair! datatype in the encryption functions ? ;-)
> Anyway, good job Nenad!
Thanks Gabriele. I looked at the postgresql protocol and i'm thinking that it really won't be very tough to implement, except maybe for the encryption algos...I won't have time to work on this one, but i'm thinking about setting up a website that would allow a collaborative work on that kind of project. (We should also make a tool like that for /Express, if RT isn't already working on...) 2001 will be, for sure, a great step in the "rebolution" process ! Regards, DocKimbel.

 [5/6] from: g:santilli:tiscalinet:it at: 19-Feb-2001 10:37


Nenad Rakocevic wrote:
> Anyway, if you got ideas on how this thing should be fixed or more generally > how the driver could be improved, i would be very happy to hear them !
Yup, I will surely in the near future. :-) (I'd like to have rows returned as objects, for eg., and I already wrote a function that does that; I wonder if it is the case to add that to the protocol or to leave that outside.)
> BTW, i'm surprise that nobody asked me why i used pair! datatype in the > encryption functions ? ;-)
I didn't have the time to look at the code, yet. :-)
> Thanks Gabriele. I looked at the postgresql protocol and i'm thinking that it > really won't be very tough to implement, except maybe for the encryption > algos...I won't have time to work on this one, but i'm thinking about setting > up a website that would allow a collaborative work on that kind of project.
Good idea.
> (We should also make a tool like that for /Express, if RT isn't already > working on...)
I think /Serve is based on /Command, but anyway something like phpMyAdmin (but /View based instead of Web based) would be a killer app for /Express too.
> 2001 will be, for sure, a great step in the "rebolution" process !
I hope so! Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [6/6] from: kracik:mbox:dkm:cz at: 20-Feb-2001 12:10


Hi Nenad, REBOL/core (Experimental) 2.4.40.3.1 and REBOL/View 0.10.38.3.1 run your example OK. REBOL/Core 2.3.0.3.1 prints "inconsistent packet length !" early in the loop (the table has about 1000 records). Here is the output:
>> do %mysql-protocol.r
Script: "mySQL Protocol" (12-Feb-2001) mySQL protocol loaded
>> db: open mysql://rebol:[reb--192--168--22--4]/rebtest
connecting to: 192.168.22.4
>> insert db "show tables"
== none
>> first db
== [["tFilm"]]
>> first db
== []
>> insert db "select * from tFilm"
== none
>> first db
== [[1 "Higher Learning" 1994 127 "John Singleton" {Jennifer Connelly, Ice Cube, Omar Epps, Michael Rapaport}]]
>> while [not empty? probe first db][]
[[2 "The Next Karate Kid" 1994 103 "Christopher Cain" {Hilary Swank, Noriyuki "Pat" Morita}]] [[3 "The Good Son" 1993 88 "Joseph Ruben" {Macaulay Culkin, Elijah Wood, Wendy Crewson, David Morse, Jacqueline Brookes}]] [[4 "The Fly" 1986 96 "David Cronenberg" "Jeff Goldblum, Geena Davis, John Getz"]] [[5 "Body Bags" 1993 95 "John Carpenter, Tobe Hooper" {Robert Carradine, David Naughton, Stacy Keach, Deborah Harry}]] [[6 "Roses Are Dead" 1993 90 "Sam Irvin" "C. Thomas Howell, Linda Fiorentino, Nancy Allen"]] [[7 "Blue Thunder" 1982 101 "John Badham" {Roy Scheider, Warren Oates, Candy Clark, Daniel Stern, Malcolm McDowell}]] [[8 "Ring Of The Musketeers" 1993 83 "John Paragon" {David Hasselhoff, Cheech Marin, John Rhys Davies, Alison Doody, Thomas Gottschalk}]] [[9 "Quicksilver" 1985 102 "Kevin Reynolds" {Kevin Bacon, George Dzundza, Jason Patric, Steven Bauer}]] [[10 "Mrs. Doubtfire" 1993 125 "Chris Columbus" {Robin Williams, Sally Field, Pierce Brosnan, Harvey Fierstein, Robert Prosky}]] [[11 "Spyder" 1989 76 "J.M. Avellana" {Blake Banner, Ronald William Lawrence, Gary Rooney, Roxanne Baird, Michael Vlastas}]] [[12 "Crazy Hong Kong" 1994 91 "Wellson Chin" {N!Xau, Carina Lau, Cecilia Yip, Lau Ching Wan, Conrad Janis}]] [[13 "Sex And Zen" 1992 99 "Michael Mak" "Amy Yip, Isabella Chow, Lawrence Ng, Kent Cheng"]] [[14 "The Slugger’s Wife" 1985 100 "Hal Ashby" {Michael O’Keefe, Rebecca De Mornay, Martin Ritt, Randy Quaid, Cleavant Derricks}]] [[15 "Young Guns II" 1990 105 "Geoff Murphy" {Emilio Estevez, Kiefer Sutherland, Lou Diamond Phillips, Christian Slater, William Petersen}]] [[16 "Frozen Assets" 1992 96 "George Miller" "Shelley Long, Corbin Bernsen, Larry Miller"]] [[17 "The Vagrant" 1992 86 "Chris Walas" "Bill Paxton, Michael Ironside, Marshall Bell"]] [[18 "Kiss Of Death" 1994 101 "Barbet Schroeder" {Nicolas Cage, Samuel L. Jackson, David Caruso - Jade}]] [[19 "Space: Above And Beyond" 1995 117 {Charles Martin Smith "Ray Butts"} "Morgan Weisser, Kristen Cloke, James Morrison"]] [[20 "A Streetcar Named Desire" 1995 150 "Glenn Jordan" {Jessica Lange, Alec Baldwin, John Goodman, Diane Lane}]] [[21 "Too Good To Be True" 1988 96 "Christian I. Nyby, II" "Patrick Duffy, Loni Anderson"]] [[22 "Far From Home - The Adventures of Yellow Dog" 1995 81 "Phillip Borsos" "Mimi Rogers, Bruce Davison"]] [[23 "Desperado" 1995 101 "Robert Rodriguez" "Antonio Banderas, Salma Hayek, Steve Buscemi"]] [[24 "Legends Of The Fall" 1994 128 "Edward Zwick" "Brad Pitt, Anthony Hopkins, Aidan Quinn"]] [[25 "First Knight" 1995 133 "Jerry Zucker" "Sean Connery, Julia Ormond, Richard Gere"]] [[26 "The Quick And The Dead" 1995 103 "Sam Raimi" "Sharon Stone, Gene Hackman, Leonardo DiCaprio"]] [[27 "Streetfighter" 1989 101 "Steven E. de Souza" "Jean Claude Van Damme, Raul Julia"]] [[28 "Car 54 Where Are You ?" 1994 85 "Bill Fishman" "David Johansen, John McGinley"]] [[29 "Unborn" 1991 81 "Rodman Flender" "Brooke Adams, Jane Cameron, James Karen"]] [[30 "Nickel And Dime" 1991 92 "Ben Moses" "C. Thomas Howell, Wallace Shawn"]] [[31 "Old Gringo" 1989 116 "Luis Puenzo" "Jane Fonda, Gregory Peck, Jimmy Smits"]] [[32 "Double Trouble" 1991 84 "John Paragon" "Peter Paul, David Paul"]] [[33 "Soldier Boyz" 1995 85 "Luis Morneau" "Michael Dudikoff, Cedrick Terrell"]] [[34 "Braveheart" 1995 177 "Mel Gibson" "Mel Gibson, Sophie Marceau"]] [[35 "Warning Sign" 1985 95 "Hal Barwood" "Sam Waterston, Kathleen Quinlan"]] [[36 "PCU" 1994 80 "Hart Bochner" "Jeremy Piven, Chris Young"]] [[37 "Claudia Schiffer: Perfectly Fit" 1995 59 "Greg Gold" "Claudia Schiffer, Ktahy Kaehler"]] ** User Error: Error: inconsistent packet length !. ** Where: not empty? probe first db It almost seems that Claudia Schiffer confuses mySQL scheme or older REBOL port implementation :-) I can make this particular database available on the internet if you want to test it. I can also check the exact client-server conversation with a packet analyzer. I'd welcome yours and Gabrielle's improvements in new version of mySQL scheme. It would also be nice to be able to 'close the database even when all records have not been read - at least it's common with other database interfaces. Regards, -- Michal Kracik Nenad Rakocevic wrote:

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted