On Fri, Nov 13, 2009 at 4:18 AM, Ed Leafe <[email protected]> wrote:
> On Nov 12, 2009, at 6:20 PM, Miguel Lopes wrote:
>
>> Any clues on how I can save a pdf to a blob and then have a remote
>> Dabo desktop application open it?
>>
>> I'm not sure this is really a Dabo question, but I figure it must be
>> relatively common.
>> In my case the user could save something to a remote database and then
>> retrive it back at some later date.
>> Are there any facilities in Dabo related to this functionality?
>
>
>        Not explicitly, no. And I know that recently there has been some
> discussion on the dev list about some issues with saving binaries with
> some database backends.

Is perhaps any of these backends SQLite?

>        In general, though, I would imagine that you would read in the pdf
> using regular Python code, and then save it to a BLOB column:
>        pdfbin = file("document.pdf", "rb").read()
>        biz.setFieldVal("some_blob_column", pdfbin)
>        biz.save()
>
>
> -- Ed Leafe
>

With SQLite the following code is failing:

def newDoc(self, evt):
        pdffile = dabo.ui.getFile()
        pdfbin = file(pdffile, "rb").read()
        pdfname = pdffile[pdffile.rindex('/')+1:]
        self.new()
        biz = self.PrimaryBizobj
        biz.setFieldVal("attachment", pdfbin)
        biz.setFieldVal("document", pdfname)
        self.save()

After this code runs the current Record is holding the data, but the
save failed silently!
I've only tested this on SQLite.

Miguel
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to