Cool solution.

On Sun, Apr 26, 2009 at 6:39 AM, Jim Wilcoxson <pri...@gmail.com> wrote:
> You could do a binary search to find the highest accessible rowid:
>
>    select rowid where rowid = 2147483647 (fails)
>    select rowid where rowid = 1073741824 (fails)
>    ...
>    select rowid where rowid = 65536 (fails)
>    select rowid where rowid = 32768 (works!)
>    select rowid where rowid = 49152 (works!)
>
> Within 32 selects, you will find the highest accessible rowid.  Then
> do an insert from select * where rowid <= XXX.
>
> Jim
>
> On 4/25/09, Gene <g...@bystorm.com> wrote:
>> You are exactly right John...that is indeed what the code looks
>> like...except we have over 25 columns (it's a flat table).
>>
>> We've already fixed the bad code, but there are some customers who have old
>> versions...it didn't break very often with the old code, but it does still
>> did.
>>
>> I haven't tried a select Min or max on the row id but a select count(*)
>> returns an error...that's how I know I need to do the row by row recovery
>> method.  Select * from mytable also returns an error.
>>
>> The tables usually have tens of thousands of rows, sometimes over a couple
>> hundred thousand but that's rare.
>>
>> What seems to work is that I do a select * from myTable where rowId = 'X'
>> incing X until I get an error.  After I get the error, every row higher then
>> X also returns an error. So as soon as I get an error, I stop trying to
>> recover more rows.
>
> --
> Software first.  Software lasts!
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Jim Dodgen
j...@dodgen.us
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to