Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Memo or Blob
Thu, Nov 25 2010 9:20 AMPermanent Link

Sean McDermott

D 2009 - DBISAM 4 Latest

I have an app that has a feature that is basically a daily diary except there is not one entry (record) per day but rather a continuous single record with embedded time and date entries. So, there will only ever be one ever-growing single record containing primarily text. Should I use a memo or a blob?

One additional consideration is that I would like to be able to search the memo or blob for key words and set the location within the record to these key words. Has anyone come across a technique or code to do this? And last but not least is that I have an RTF control populating this record. In the past I have come across control codes for colors and fonts appearing in a text copy of the record. Any thoughts or advice appreciated, Sean
Thu, Nov 25 2010 10:20 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Sean


My first reaction is YUCK. Having overcome that a couple of thoughts. Firstly I don't think the datatype will matter to much. In DBISAM I used memo for everything from text, embedded tables and graphics. I can't remember in DBSys wether you can edit a blob or not. If not and you want to be able to then use memo otherwise use blob to stop people doing just that.

Since there's only one record you'll only be searching in the app (ie not using full text indexing) you'll need to use pos, selstart and sellength to find and position the cursor. This sort of topic has been covered on the codegear ngs. If you look in embarcadero.public.delphi.language.delphi.general and search for "2 questions about trichedit" that will give you a starter. D2009 and unicode may give a bit of trouble - I don't know.

Other thoughts are:

1. have a look at WPTools - it is far better than TRichEdit
2. since its going to be a single record what about embedding Word in the app (or even just shell out to it)
3. I don't know how big this single record will grow to but it might be worth looking at a record a day approach which would allow you to use full text indexing.

Roy Lambert [Team Elevate]
Thu, Nov 25 2010 1:09 PMPermanent Link

Sean McDermott

Hi Roy, quite right. I will change to memo, thanks for this, Sean

Roy Lambert wrote:

Sean


My first reaction is YUCK. Having overcome that a couple of thoughts. Firstly I don't think the datatype will matter to much. In DBISAM I used memo for everything from text, embedded tables and graphics. I can't remember in DBSys wether you can edit a blob or not. If not and you want to be able to then use memo otherwise use blob to stop people doing just that.

Since there's only one record you'll only be searching in the app (ie not using full text indexing) you'll need to use pos, selstart and sellength to find and position the cursor. This sort of topic has been covered on the codegear ngs. If you look in embarcadero.public.delphi.language.delphi.general and search for "2 questions about trichedit" that will give you a starter. D2009 and unicode may give a bit of trouble - I don't know.

Other thoughts are:

1. have a look at WPTools - it is far better than TRichEdit
2. since its going to be a single record what about embedding Word in the app (or even just shell out to it)
3. I don't know how big this single record will grow to but it might be worth looking at a record a day approach which would allow you to use full text indexing.

Roy Lambert [Team Elevate]
Mon, Nov 29 2010 3:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Sean,

<< I have an app that has a feature that is basically a daily diary except
there is not one entry (record) per day but rather a continuous single
record with embedded time and date entries. >>

I would seriously consider changing that design, if at all possible.  You're
really handicapping DBISAM's ability to provide easy-to-use
searching/sorting for you, instead of having to roll your own.

<< So, there will only ever be one ever-growing single record containing
primarily text. Should I use a memo or a blob? >>

If the data is always in textual format, then use a memo field.

<< One additional consideration is that I would like to be able to search
the memo or blob for key words and set the location within the record to
these key words. Has anyone come across a technique or code to do this? And
last but not least is that I have an RTF control populating this record. In
the past I have come across control codes for colors and fonts appearing in
a text copy of the record. >>

What you want to do is add a special OnTextIndexFilter event handler to the
TDBISAMEngine component:

http://www.elevatesoft.com/manual?action=viewevent&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&event=OnTextIndexFilter

that will strip out any control codes or other non-text-indexable content,
and then just add the memo field as part of the text index for the table.
Then you can use the optimized text index searching:

http://www.elevatesoft.com/manual?action=viewtopic&id=dbisam4&product=d&version=7&topic=Functions

to determine if a keyword exists or not.  Then, you'll need to use this
function:

http://www.elevatesoft.com/manual?action=viewmethod&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&method=BuildWordList

to determine the positions of the keyword(s) in the memo.

--
Tim Young
Elevate Software
www.elevatesoft.com
Tue, Nov 30 2010 4:05 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


><< One additional consideration is that I would like to be able to search
>the memo or blob for key words and set the location within the record to
>these key words. Has anyone come across a technique or code to do this? And
>last but not least is that I have an RTF control populating this record. In
>the past I have come across control codes for colors and fonts appearing in
>a text copy of the record. >>
>
>What you want to do is add a special OnTextIndexFilter event handler to the
>TDBISAMEngine component:

If he re-designs the app to use a record a day or a record an entry that's what I'd suggest but how is it going to work with a single record system such as he has?

Roy Lambert [Team Elevate]
Wed, Dec 1 2010 12:57 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< If he re-designs the app to use a record a day or a record an entry
that's what I'd suggest but how is it going to work with a single record
system such as he has? >>

Not very well, is how it's going to work. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com
Fri, Dec 3 2010 1:38 PMPermanent Link

Sean McDermott

Hi Gents, all done with memos now and a record per day and search utilities/filtering working very well thank you, all the best, Sean

"Tim Young [Elevate Software]" wrote:

Roy,

<< If he re-designs the app to use a record a day or a record an entry
that's what I'd suggest but how is it going to work with a single record
system such as he has? >>

Not very well, is how it's going to work. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com
Tue, Dec 7 2010 2:16 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Sean,

<< Hi Gents, all done with memos now and a record per day and search
utilities/filtering working very well thank you, all the best, Sean >>

Fantastic, I'm glad that you were able to change the design.  I think you'll
be much happier with the new design.

--
Tim Young
Elevate Software
www.elevatesoft.com
Image