Databases: problem stepping through records with BLOBs

Chris bohnert chris at altuit.com
Fri Apr 14 10:57:49 EDT 2006


Devin,

I think this may simply be a documentation error.  I tested your code 
with the altSqlite connector and was able to reproduce your findings 
when i used

 >     put revDatabaseColumnNamed(tRS,"item_code",tItemCode) -- always

but if I changed that line to:

put revDatabaseColumnNamed(tRS,"item_code","tItemCode") --add quotes

I was able to step through about 4k results correctly.

--
cb

Devin Asay wrote:
> My original thread was hijacked by another topic, so I thought I'd send 
> this again.
> 
> =================================================================================== 
> 
> Has anyone run into this?
> 
> I am sending a query to a database and then I want to step through the 
> records. I'm doing it like this (watch for line wrapping):
> 
>   put "26,54,110,111,250,259,272,314,149" into tTermListData -- preload 
> for testing
>   put "SELECT item_index,item_code FROM vocablist WHERE item_index IN (" 
> & tTermListData & ")" into tQuery
>   put revQueryDatabase(connID,tQuery) into tRS
>   put revNumberOfRecords(tRS) into curRecCount -- this returns the 
> correct number
>   repeat
>     put revCurrentRecord(tRS) into curRec -- this increments as expected
>     put revDatabaseColumnNamed(tRS,"item_index",tItemNum) -- always 
> shows the first record!
>     put revDatabaseColumnNamed(tRS,"item_code",tItemCode) -- always 
> shows the first record!
>     if revCurrentRecordIsLast(tRS) then exit repeat -- works as expected
>     revMoveToNextRecord tRS
>   end repeat
>   revCloseCursor tRS
> 
> Long story short, it doesn't work. But if you do this:
> 
>   put "26,54,110,111,250,259,272,314,149" into tTermListData -- preload 
> for testing
>   put "SELECT item_index,item_code FROM vocablist WHERE item_index IN (" 
> & tTermListData & ")" into tQuery
>   put revQueryDatabase(connID,tQuery) into tRS
>   put revNumberOfRecords(tRS) into curRecCount -- this returns the 
> correct number
>   repeat
>     put revCurrentRecord(tRS) into curRec -- this increments as expected
>     put revDatabaseColumnNamed(tRS,"item_index") into tItemNum -- always 
> shows the first record!
>     put revDatabaseColumnNamed(tRS,"item_code") into tItemCode -- always 
> shows the first record!
>     if revCurrentRecordIsLast(tRS) then exit repeat -- works as expected
>     revMoveToNextRecord tRS
>   end repeat
>   revCloseCursor tRS
> 
> It does work. Fine, I can work around it. (I've also bugzilla'd this, BZ 
> # 3525)
> 
> Here's where a problem arises: If the data I want to retrieve is binary, 
> and I use revQueryDatabaseBLOB() to retrieve the records, the only way I 
> can successfully retrieve the binary data is by using the first form of 
> the function: revDataBaseColumnNamed(tRS,"<binary data 
> field>",tImageData), which, as we've seen, only retrieves the first 
> record. If I use the second form, put 
> revDataBaseColumnNamed(tRS,"<binary data field>") into tImageData , I 
> only get the first few characters of the binary data.
> 
> Any advice on how to get out of this conundrum?
> 
> Devin
> 
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 
> 
> --No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.385 / Virus Database: 268.4.1/310 - Release Date: 4/12/2006
> 
> 




More information about the use-livecode mailing list