From: Logan Capaldo Date: 2006-07-29T00:40:39+09:00 Subject: Re: Mongoose 0.2.5 - The "Two Steps Forward, One Step Back" release On Jul 28, 2006, at 11:02 AM, Mike Harris wrote: > Jamey Cribbs wrote: > >> Mike Harris wrote: >> >>> That would be awesome. I didn't mean to be "demanding" anything, >>> you're obviously doing this for free. I appreciate your help, >>> and if I come up with anything today, I'll send off another e-mail. >>> >> >> Hey, no problem. I appreciate you taking the time to try out >> Mongoose and give me feedback. >> >> By the way, I did glance at the code and I think I might have >> found the problem. Each record is marshaled to disk as an array. >> When I read a record back from disk, I do a #flatten on it before >> creating the object. That's probably where the problem is, since >> #flatten is recursive, it's going to flatten both the record's >> array, and the array you stored in one of the fields. >> >> So, I will try changing this code to not use #flatten and see if >> what happens. >> >> Jamey >> >> Confidentiality Notice: This email message, including any >> attachments, is for the sole use of the intended recipient(s) and >> may contain confidential and/or privileged information. If you are >> not the intended recipient(s), you are hereby notified that any >> dissemination, unauthorized review, use, disclosure or >> distribution of this email and any materials contained in any >> attachments is prohibited. If you receive this message in error, >> or are not the intended recipient(s), please immediately notify >> the sender by email and destroy all copies of the original >> message, including attachments. >> >> > I noticed that, actually did a search for "flatten," but I don't > think that's it. I was able to do [1,2] successfully, but not > (1..9).to_a. I think it's when the array gets long enough to > neccesitate a carriage return in the marshal, and when it gets read > back there's a CR and an LF, instead of just a CR or LF (I forget > which), in addition to the missing \016 at the end. I've been > poking it, ran a little "test" with some output. This probably > won't help you but here it is. It's storing Marshal.dump > ((1..9).to_a) to the str column > > Orig Dump: \4 \8 [ \14 i \6 i \7 i \8 i \9 i \10 i \11 i \12 > i \n i \14 > From DB File 1: \4 \8 [ \14 i \6 i \7 i \8 i \9 i \10 i \11 i \12 i > \n i \14 > From DB: \4 \8 [ \14 i \6 i \7 i \8 i \9 i \n \10 i \11 i > \12 i \n i > > the \ characters are the decimal number for the unprintable > characeters > Orig Dump is Marshal.dump((1..9).to_a) > From DB File is a manual read from the database file, without using > Mongoose to read > From DB is find.first.str > I'm pretty sure this is a case of Jamey being lazy (no offense Jamey ). I just did a quick grep for open in the source, he doesn't tack on 'b' to his flags (when he almost certainly should when storing binary data like a Marshaled string.) Let me guess, you are on Windows, right? Hence the magical \r -> to \r\n transformation. > I've got to get back to my "job," but I'll whip up some test cases > later. >