[solved] unknown picture format
[solved] unknown picture format
I am using zeosib 7.0.3 with Delphi 2010.
I have a sqlite3 database which contains a picture blob field. When I try to attach the DB to a table and then to a data set the dbaware picture vcl Picshow delphiarea.com reports back an error unknown picture format.
This does work with the sivak3 sqlite3 dbase vcl tools.
What could be the problem?
I have a sqlite3 database which contains a picture blob field. When I try to attach the DB to a table and then to a data set the dbaware picture vcl Picshow delphiarea.com reports back an error unknown picture format.
This does work with the sivak3 sqlite3 dbase vcl tools.
What could be the problem?
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Do you have an example of how I should import the pictures....I'm finding that if I create a loop such as below, the imported data gets all mixed up. Meaning the fields gets imported into the wrong fields. I know this has nothing to do with blob fields but I'm thinking that the way I'm importing the data is incorrect. This does work for mssql. What am I doing wrong?
MainDM.adoweather.edit;
For i = 1 to 10
begin
MainDM.adoweather.fieldbyname('current').asinteger = variable1
MainDM.adoweather.fieldbyname('mon').asinteger= variable2
MainDM.adoweather.fieldbyname('tue').asinteger=variable3
end;
MainDM.adoweather.post;
MainDM.adoweather.edit;
For i = 1 to 10
begin
MainDM.adoweather.fieldbyname('current').asinteger = variable1
MainDM.adoweather.fieldbyname('mon').asinteger= variable2
MainDM.adoweather.fieldbyname('tue').asinteger=variable3
end;
MainDM.adoweather.post;
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
kidjake28,
can you attach a create script? Or is it possible you did upgrade from 6.6 to 7.0.3? Here i know about differences accordingly reading/writing BLOB's.
Do you use cached updates? Some more informations would be helpful to support you.
can you attach a create script? Or is it possible you did upgrade from 6.6 to 7.0.3? Here i know about differences accordingly reading/writing BLOB's.
Do you use cached updates? Some more informations would be helpful to support you.
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/
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/
Here it is...forgive me if bad code...I'm a beginner.
Code: Select all
if (xmlLUD > MainDM.adoAgents.FieldByName('lastupdated').AsDateTime) and (result = true) then
begin
writeToLog(3, 'Update agents record');
MainDM.adoAgents.edit;
end
else if result = false then
MainDM.adoAgents.Insert;
if MainDM.adoAgents.State in [dsEdit, dsInsert] then
begin
MainDM.adoAgents.FieldByName('agentid').AsInteger := xmlID;
MainDM.adoAgents.FieldByName('name').AsString := httpdecode
(Anode.Items[i].Properties.ItemNamed['name'].Value);
MainDM.adoAgents.FieldByName('phone').AsString := httpdecode
(Anode.Items[i].Properties.ItemNamed['phone'].Value);
MainDM.adoAgents.FieldByName('email').AsString := httpdecode
(Anode.Items[i].Properties.ItemNamed['email'].Value);
MainDM.adoAgents.FieldByName('title').AsString := Anode.Items[i].Properties.ItemNamed['title'].Value;
MainDM.adoAgents.FieldByName('memberid').AsString := Anode.Items[i].Properties.ItemNamed['memberid']
.Value;
MainDM.adoAgents.FieldByName('lastupdated').AsString := Anode.Items[i].Properties.ItemNamed['lud'].Value;
if urlexists(Anode.Items[i].Properties.ItemNamed['pic'].Value) then
begin
myStream := Tmemorystream.Create;
httpClient.url := Anode.Items[i].Properties.ItemNamed['pic'].Value;
httpClient.RcvdStream := myStream;
httpClient.Get;
tblobfield(MainDM.adoAgents.FieldByName('picture')).LoadFromStream(myStream);
myStream.Free;
end
else
tblobfield(MainDM.adoAgents.FieldByName('picture')).LoadFromFile('agents\noagent.jpg');
MainDM.adoAgents.Post;
end;
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
kidjake28,
sure your load a binary stream from your URL? It might be possible you receive a Base64 encoded string. The Indy components have a component for convertation.
On the other hand: I can't see "wrong" code right now. The way you read the stream is right. Check if myStream.Position is 0. Did you ever check the Memory of the received string? Excample:
before going on, please check my suggestions. I can't remember equal issues latly.
sure your load a binary stream from your URL? It might be possible you receive a Base64 encoded string. The Indy components have a component for convertation.
On the other hand: I can't see "wrong" code right now. The way you read the stream is right. Check if myStream.Position is 0. Did you ever check the Memory of the received string? Excample:
Code: Select all
var s: AnsiString;
begin
MyStream.Position := 0;
SetLength(s, myStream.Size);
System.move(PansiChar(MyStream.Memory)^, PAnsiChar(s)^, MyStream.Size);
..
now you can debug the string and check Size and header.
end;
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/
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/
The url stream points to a jpeg image file.
I know this works because if I change the components to SIVAK sqlite3 it works fine to some extent. I believe I have another problem with concurrency but I'll look into that a bit more.
In the mean time if I use zeos, it doesn't seem to store the image properly.
As far as reading the blob, I use tdbpicshow component which is connected to the database (no code required).
As mentioned before it works with mssql as well as sivak, just not with zeos. What am I doing wrong?
I know this works because if I change the components to SIVAK sqlite3 it works fine to some extent. I believe I have another problem with concurrency but I'll look into that a bit more.
In the mean time if I use zeos, it doesn't seem to store the image properly.
As far as reading the blob, I use tdbpicshow component which is connected to the database (no code required).
As mentioned before it works with mssql as well as sivak, just not with zeos. What am I doing wrong?
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
kidjake28,
sure the field is declared a BLOB type?
sure the field is declared a BLOB type?
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/
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/
I think I know what the problem is....I used a program to convert a database from MSSQL to SQLITE. It seem to have converted properly.
When I used sqliteexpert to view the data it shows the pics but as I mentioned when I tried to view them using my delphi app, I would get an unknown picture format.
So I deleted the pics and re-downloaded them from the site. The pics seems to be working.
I think the problem is solved. However, I am having another show stopper and rather then continuing it in this thread I will create a new topic.
I'm really really trying to switch over to sqlite so if someone would be kind enough just lik Egon (or even Egon) to help me out I would greatly appreciate it.
When I used sqliteexpert to view the data it shows the pics but as I mentioned when I tried to view them using my delphi app, I would get an unknown picture format.
So I deleted the pics and re-downloaded them from the site. The pics seems to be working.
I think the problem is solved. However, I am having another show stopper and rather then continuing it in this thread I will create a new topic.
I'm really really trying to switch over to sqlite so if someone would be kind enough just lik Egon (or even Egon) to help me out I would greatly appreciate it.
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
kidjake28,
this is strange! We use exacly the algorythm descibed from Sqlite. Also do we use a GetLob api call to read the lobs. The results are exact. So i guess your second programm has it's own way to read and write the BLob's...
this is strange! We use exacly the algorythm descibed from Sqlite. Also do we use a GetLob api call to read the lobs. The results are exact. So i guess your second programm has it's own way to read and write the BLob's...
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/
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/