Defining/Binding Blob Values
Ruslan Zasukhin
sunshine at public.kherson.ua
Fri Aug 15 14:26:10 CDT 2008
On 8/14/08 3:15 PM, "Thomas.DellAnno at swisstopo.ch"
<Thomas.DellAnno at swisstopo.ch> wrote:
>
> Many thanks in advance and kind regards -- Tom
>
> -- begin c++ - code --------------------------
>
> void test (void)
> {
> // ... valentina init ... .
>
> ArrayOfValues_Ptr pBinds = new ArrayOfValues();
>
> // Working DateTime param binding
>
> struct tm dt = { 0, 0, 12, 25, 11, 99 };
> I_Value_Ptr vdt = database->CreateValue (kTypeDateTime, fNone);
> I_ValueDateTime_Ptr pvdt = fbl_dynamic_cast<I_ValueDateTime>(vdt);
> pvdt->put_DateTime (dt.tm_year + 1900, dt.tm_mon, dt.tm_mday,
> dt.tm_hour,
> dt.tm_min,
> dt.tm_sec, 0);
> pBinds->AddItem (vdt);
>
>
> // Not working Blob value binding
>
> String blobData = "this is the blob data";
> I_Value_Ptr vBlob = database->CreateValue (kTypeBLOB, fNone);
> I_ValueBinary_Ptr pvbBlob = fbl_dynamic_cast<I_ValueBinary>(vBlob);
>
> // --> Makes pBlob a null pointer
> pvbBlob->put_Data ((uchar*)blobData.getBuffer(), blobData.length());
put_Data() -- intended to write blob values director into TABLE.
for binding we need prepare value in the RAM only.
> // --> Throws an exception because pBlob is null.
> pBinds->AddItem (vBlob);
>
> // ... query execution ... e.g. "insert into table (fldDayTime,
> fldBlob)
> // values (:1, :2)" ...
> }
> -- end c++ - code --------------------------
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list