[patch_done] How Update SQLite Blob's vom V6.6.6 >> 7.

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
mmvisual
Senior Boarder
Senior Boarder
Posts: 51
Joined: 13.10.2010, 14:55

[patch_done] How Update SQLite Blob's vom V6.6.6 >> 7.

Post by mmvisual »

I have store in a Blob Field photos as PNG and JPG format and they are showing in my EXE, it works fine.
(Lazarus, Zeos 6.6.6, Win & Linux)

Now, I want update the Component to Zeos V7.0 and this data are stored now in a other format, this make the Zeos component.

How can I use the old Data?
Or
What must I program for a conversion routine?

See this Thread:
http://zeos.firmos.at/viewtopic.php?p=12423#12423

Q.Properties.Append('OldBlobEncoding=true');
have just no effect.

Thank for Help!
Best regards, Markus.

PS: There is no problem on MySQL, only SQLite.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

OldBlobEncoding
I can't find a reference to this option in the current zeoslib code. So I'm afraid someone has to write it. An alternative is writing an unload prog using zeos 6.6.6 and an upload prog using zeos 7.x.

I'm willing to merge a reasonable patch into the zeos 7 code. But I'm not going to write it myself.

Mark
Image
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Mark, this "OldBlobEncoding " seems like a improvement which somebody told him before. I think it was used while switching from the old slow encoding-algorythm to the new much fater once. The both algorythms are still present in the ZSQLiteUtils.pas but they are unused. I'll patch this the next day's...

EgonHugeist
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Patch aviable in testing-egonhugeist Revision 1135.

Use 'OldBlobEncoding=True' in the TZConnection.Properties.

best regards
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
mmvisual
Senior Boarder
Senior Boarder
Posts: 51
Joined: 13.10.2010, 14:55

Post by mmvisual »

Hello Egon,

I have look into the databytes and analyse the difference betreen the versions 6.6.6 and 7.
In 6.6.6 was a $00 a '%0' and a '%' a '%%'. It is looking simple.

With this routine can I correct my table and do an update:

q.SQL.Text := 'SELECT * FROM foto'; // TZQuery
q.Open;
st := TMemoryStream.Create;
st2 := TMemoryStream.Create;
bOK := True;
While Not q.EOF Do // Bild-Daten konvertieren
Begin
st.Clear;
qBild.SaveToStream(st);
If st.Size > 0 Then
Begin
st.Position := 0;
st2.Clear;
b2 := 0;
While st.Position < st.Size Do // Alle Bild-Bytes
Begin
b := st.ReadByte;
If (b <> Ord('%')) Or (b2 = 1) Then
Begin
If b2 = 1 Then
If b = Ord('0') Then
b := 0
Else If b <> Ord('%') Then
Begin
bOK := False;
Break;
end;
b2 := 0;
st2.WriteByte(b);
end Else b2 := 1;
end;
If bOK Then // Konvertierung OK, Speichern
Begin
st2.Position := 0;
q.Edit;
qBild.LoadFromStream(st2);
q.Post;
End Else Break; // Kein Datensatz mehr behandeln
end;
q.Next;
end;
q.Close;
Locked