Topic: sqlitepass and Delphi 2009

I am trying to save data to a database but when I load the data back in the string fields are truncated.
I set the database filds up with sqliteadministator with there respective sizes.
I save the data using the following in table tpic

  tpic.Insert;
  tpic['FileName']:= edit7.Text;    // size 15
  tpic['Created']:= dtp3.Date;
  tpic['Modified']:= dtp4.Date;
  tpic['FileType']:= edit8.Text;
  tpic['Label']:= edit9.Text;
  tpic['Description']:= edit10.Text;
  tpic['KeyWords']:= edit11.Text;
  tpic['Rating']:= edit12.Text;
  tpic['Location']:= edit13.Text;   // size 100
  tpic.Post;

I save for example john 001.jpeg from edit7 and c:\delphi\photo from edit13

When I save the data it looks fine. Reopen the database and john 001.jpeg now is john 0 and c:\delphi\photo is now
c:\delph

This is such a simple process however I cannot see why the data is truncating.

Any suggestions.

Regards John.

Re: sqlitepass and Delphi 2009

Hi John,

I need one more clue to help you :

1 - Your table was created with sqliteadministator
2 - You edit your table with sqlitepass
3 - When you re-open the table and notice data is truncated, do you use sqliteadministrator or sqlitepass ?


if this occurs only when reading data back with sqlitepass, try to change the following code in SqlitePassDataset.inc

Function TSqlitePassDataset.GetFieldData(Field: TField; Buffer: Pointer): Boolean;
...

        ftString, ftFixedChar
                     : begin
                       StrValue := FRecordset.GetFieldAsAnsiString(ActiveRecIndex, FieldPos);
                       StrSize := Min(Length(StrValue)+1,Field.DataSize);
                       Move(PAnsiChar(StrValue)^, Buffer^, StrSize);
                       end;
  ...

with

        ftString, ftFixedChar
                     : begin
                       StrValue := FRecordset.GetFieldAsAnsiString(ActiveRecIndex, FieldPos);
                       StrCopy(Buffer, PAnsiChar(StrValue));
                       end;

if not, would you mind sending your complete code. I will check it out.
Unicode support in 0.45 version brought a lot of changes. I'm working on corrections for the next release.

Regards