Board index » delphi » idVCard - Saving to Stream/Blob

idVCard - Saving to Stream/Blob


2004-01-07 10:59:16 PM
delphi87
Is it possible to save an idVCard component to a stream or blob? I want to
save the entire vcard to a blob field in a table.
Thanks,
David
 
 

Re:idVCard - Saving to Stream/Blob

"David Kroll" <david dot kroll at desktop-assistance dot com>wrote in
message news:3ffc1ec4$XXXX@XXXXX.COM...
Quote
Is it possible to save an idVCard component to a stream or blob?
Not directly, no.
Quote
I want to save the entire vcard to a blob field in a table.
Have a look at the RawForm property and the ReadFromTStrings() method. You
could store the VCard data into a TStrings first, and then copy the TStrings
content into your stream/blob afterwards. Then later read the stream/blob
into a TStrings and load the VCard with it.
Gambit
 

Re:idVCard - Saving to Stream/Blob

"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>writes
Quote

Have a look at the RawForm property and the ReadFromTStrings() method.
You
could store the VCard data into a TStrings first, and then copy the
TStrings
content into your stream/blob afterwards. Then later read the stream/blob
into a TStrings and load the VCard with it.


Gambit


I don't see how to save the VCard data into a TStrings. Suggestions?
 

Re:idVCard - Saving to Stream/Blob

"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>writes
Quote

"David Kroll" <david dot kroll at desktop-assistance dot com>wrote in
message news:3ffc71a2$XXXX@XXXXX.COM...

>I don't see how to save the VCard data into a TStrings.

Please re-read my previous message. I told you exactly what to look at -
the TIdVCard's RawForm property. It is already a TStrings that contains
the
content of the VCard.


Gambit

RawForm gets populated after you do ReadFromTStrings, so if I start with a
new blank vcard, add some info, then want to save it, RawForm is empty.
 

Re:idVCard - Saving to Stream/Blob

"David Kroll" <david dot kroll at desktop-assistance dot com>wrote in
message news:3ffc71a2$XXXX@XXXXX.COM...
Quote
I don't see how to save the VCard data into a TStrings.
Please re-read my previous message. I told you exactly what to look at -
the TIdVCard's RawForm property. It is already a TStrings that contains the
content of the VCard.
Gambit
 

Re:idVCard - Saving to Stream/Blob

"David Kroll" <david dot kroll at desktop-assistance dot com>wrote in
message news:3ffc7fc6$XXXX@XXXXX.COM...
Quote
RawForm gets populated after you do ReadFromTStrings,
so if I start with a new blank vcard, add some info, then
want to save it, RawForm is empty.
Then the only other option that TIdVCard supports is to use the VCL's native
DFM streaming system. Since TIdVCard is a TComponent descendant, and all of
its properties are published, you can try using TStream's WriteComponent()
and ReadComponent() methods.
Gambit
 

Re:idVCard - Saving to Stream/Blob

"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>writes
Quote

"David Kroll" <david dot kroll at desktop-assistance dot com>wrote in
message news:3ffc7fc6$XXXX@XXXXX.COM...

>RawForm gets populated after you do ReadFromTStrings,
>so if I start with a new blank vcard, add some info, then
>want to save it, RawForm is empty.

Then the only other option that TIdVCard supports is to use the VCL's
native
DFM streaming system. Since TIdVCard is a TComponent descendant, and all
of
its properties are published, you can try using TStream's WriteComponent()
and ReadComponent() methods.


Gambit

I'm using ReadComponent/WriteComponent, but some properties don't seem to
make it through. For instance, BusinessInfo.title, when I do
WriteComponent, save that to my blob field, then read it back and do
ReadComponent, all of the BusinessInfo fields are blank. Fields like
FullName and Birthday work fine though. Any suggestions?
 

Re:idVCard - Saving to Stream/Blob

"David Kroll" <david dot kroll at desktop-assistance dot com>wrote in
message news:3ffd6c06$XXXX@XXXXX.COM...
Quote
I'm using ReadComponent/WriteComponent, but some properties
don't seem to make it through. For instance, BusinessInfo.title
It should. The Title is a read/write published string property, and
TIdVCardBusinessInfo is a TPersistent descendant, so there is no reason for
it not to stream correctly. I wonder if it has to do with BusinessInfo
being a read-only property itself, although I think the VCL does support
that when the property is a pointer. If not, then setter methods will
probably have to be added to some of the TPersistent-based properties.
Quote
when I do WriteComponent, save that to my blob field, then read
it back and do ReadComponent, all of the BusinessInfo fields are blank.
Please show your actual code.
Gambit
 

Re:idVCard - Saving to Stream/Blob

"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>writes
Quote

"David Kroll" <david dot kroll at desktop-assistance dot com>wrote in
message news:3ffd6c06$XXXX@XXXXX.COM...

>I'm using ReadComponent/WriteComponent, but some properties
>don't seem to make it through. For instance, BusinessInfo.title

It should. The Title is a read/write published string property, and
TIdVCardBusinessInfo is a TPersistent descendant, so there is no reason
for
it not to stream correctly. I wonder if it has to do with BusinessInfo
being a read-only property itself, although I think the VCL does support
that when the property is a pointer. If not, then setter methods will
probably have to be added to some of the TPersistent-based properties.

>when I do WriteComponent, save that to my blob field, then read
>it back and do ReadComponent, all of the BusinessInfo fields are blank.

Please show your actual code.


Gambit
I had to add setters for several properties. It works fine now.