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

[REBOL] Re: Strange mysql scheme port errors

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.