Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-11

Help reading SQLite field with more than 255 chars

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

mulcamd

I'm reading the SQLite database of Adobe Lightroom (SQLite).

I want to process the AdditionalMetadata table, see below, the XMP field, which may be 3000 chars long.

When retrieving the contents of this field I only get 255.

Question:

What should I do to get the full content of this field.

BTW, I cannot change the database, because it comes from Adobe.

This is the code I use:

============ Start code

  SQLite3Connection1.DatabaseName:='Test_v5.lrcat';
  SQLite3Connection1.Transaction:=SQLTransaction1;
  SQLTransaction1.Database:=SQLite3Connection1;
  SQLQuery1.Database:=SQLite3Connection1;
  SQLQuery1.Transaction:=SQLTransaction1;
  SQLQuery1.SQL.Text:='Select id_local, xmp  from Adobe_AdditionalMetadata';
  SQLQuery1.Open;
  SQLQuery1.Next;
  i := SQLQuery1.FieldByName('id_local').AsInteger;
  ShowMessage(IntToStr(i));
  myText := SQLQuery1.FieldByName('xmp'). as TBlobField;
//            Here I only get 255 chars
  ShowMessage(myText);

================ End code

CREATE TABLE Adobe_AdditionalMetadata (

id_local INTEGER PRIMARY KEY,

id_global UNIQUE NOT NULL,

additionalInfoSet INTEGER NOT NULL DEFAULT 0,

embeddedXmp INTEGER NOT NULL DEFAULT 0,

externalXmpIsDirty INTEGER NOT NULL DEFAULT 0,

image INTEGER,

incrementalWhiteBalance INTEGER NOT NULL DEFAULT 0,

internalXmpDigest,

isRawFile INTEGER NOT NULL DEFAULT 0,

lastSynchronizedHash,

lastSynchronizedTimestamp NOT NULL DEFAULT -63113817600,

metadataPresetID,

metadataVersion,

monochrome INTEGER NOT NULL DEFAULT 0,

xmp NOT NULL DEFAULT ''

)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131118/858d9d07/attachment.html>

Reply by email

Marcos Douglas
to mulcamd
mulcamd wrote 22 lines
I?m reading the SQLite database of Adobe Lightroom (SQLite). I want to process the AdditionalMetadata table, see below, the XMP field, which may be 3000 chars long. When retrieving the contents of this field I only get 255. [...] CREATE TABLE Adobe_AdditionalMetadata ( [...] monochrome INTEGER NOT NULL DEFAULT 0, xmp NOT NULL DEFAULT '' )

The "xmp" column should be TEXT type.

Marcos Douglas

Reply by email

Michael Van Canneyt
to mulcamd: I'm reading the SQLite database of Adobe Lightroom (SQLite). I want to process the…
mulcamd wrote 9 lines
I?m reading the SQLite database of Adobe Lightroom (SQLite). ? I want to process the AdditionalMetadata table, see below, the XMP field, which may be 3000 chars long. When retrieving the contents of this field I only get 255.

I cannot create the table with the SQL you posted. I get a
Error: duplicate column name:
from sqlite.

Meanwhile you can try the following:

First of all, make sure you are using an ansistring variable instead of a shortstring variable. If that is OK, and you still get only 255, try using a cast expression:

Select id_local, cast (xmp as text)? from Adobe_AdditionalMetadata

or

Select id_local, cast (xmp as BLOB)? from Adobe_AdditionalMetadata

Michael.

Reply by email