#1 2016-02-19 06:06:02

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Batch mode doesn't support BLOB data, right?

Hi,

It seems that batch mode doesn't support adding/updating BLOB data, right? If so, is there a way to do that? That'll be extremely useful. Thanks.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2016-02-19 07:02:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Batch mode doesn't support BLOB data, right?

Offline

#3 2016-02-19 07:39:43

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Batch mode doesn't support BLOB data, right?

Thanks ab. The first link is broken. I went through the second forum post.

In short, if I use TByteDynArray instead of TSQLRawBlob as the type for my binary fields, the binary data will be transferred by BatchAdd() and BatchUpdate(), is this correct? Thanks again!


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2016-02-19 07:59:54

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Batch mode doesn't support BLOB data, right?

No, use TSQLRawBlob, but specify the BLOB fields to the CustomField list of the BATCH Add method.

As clearly documented:

    /// create a new member in current BATCH sequence
    // - work in BATCH mode: nothing is sent to the server until BatchSend call
    // - returns the corresponding index in the current BATCH sequence, -1 on error
    // - if SendData is true, content of Value is sent to the server as JSON
    // - if ForceID is true, client sends the Value.ID field to use this ID for
    // adding the record (instead of a database-generated ID)
    // - if Value is TSQLRecordFTS3, Value.ID is stored to the virtual table
    // - Value class MUST match the TSQLRecordClass used at BatchStart,
    // or may be of any kind if no class was specified
    // - BLOB fields are NEVER transmitted here, even if ForceBlobTransfert=TRUE
    // - if CustomFields is left void, the simple fields will be used; otherwise,
    // you can specify your own set of fields to be transmitted when SendData=TRUE
    // (including BLOBs, even if they will be Base64-encoded within JSON content) -
    // CustomFields could be computed by TSQLRecordProperties.FieldBitsFromCSV()
    // or TSQLRecordProperties.FieldBitsFromRawUTF8(), or by setting ALL_FIELDS
    // - this method will always compute and send TCreateTime/TModTime fields
    function Add(Value: TSQLRecord; SendData: boolean; ForceID: boolean=false;
      const CustomFields: TSQLFieldBits=[]; DoNotAutoComputeFields: boolean=false): integer;

Offline

#5 2016-02-19 12:14:10

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Batch mode doesn't support BLOB data, right?

Great! I see now, thanks ab!


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB