Subject Re: [IBO] IBO, Firebird and StoredProcedure as run and forget
Author russellbelding
For those who might be interested ...

My task is to take words from an MSWord document and insert them in a table so the document can be examined in several ways by examining the table rather than the document. Table examinantion is faster than document examination. As a test case I am using a 20 page document with 27,000 words. To make the process efficient, in my guess, I take the words and their positions in the document and push them into a temporary table T_TBD.(Process 1, P1) Then ensure the case sensitive words are in table T_Words (P2) Then ensure the words and their positions are registered in table T_DOC_WORDS (P3). This table has a primary key of a docID and a WordPosition and it is the table to examine.

MSWord documents allow access to its word collection and can give each word's position using VBA. I initially thought this P1 would be fast and P2+P3 would be slow. Using VBA for words and positions I found P1 took a hours and P2+P3 took seconds. Dropping the word's position and using its sequence in the document the time for P1 was reduced to 20 sec. P2+P3 takes a couple of seconds even though the work required here "seems" more. P2 is broken into segments depending on the word count of the document.

My initial intuition about where times savings would be needed was mistaken.
Thanks for earlier comments.
Russell



--- In IBObjects@yahoogroups.com, "russellbelding" <russell@...> wrote:
>
> Thanks for comments Helen. I am developing the code in the main thread of my program first, doing some timing tests and will then estimate how much could be gained by using a separate thread for processing a stored procedure parallel to the main thread. If I do this I'll think about posting an example here.
>
> The Embarcadero Samples section has a TTHREAD example using sorting. It shows one way to use TThread but is sparse in its use of TThread.
>
> Russell
>
> --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@> wrote:
> >
> > At 07:02 p.m. 22/04/2013, russellbelding wrote:
> >
> > >Not having used threads before and reading that "things" need to be "thread-safe" I am looking for comments. (why re-invent a wheel?)
> > >
> > >Will my new thread need its own TIB_CONNECTION and TIB_TRANSACTION?
> > >Are these IBO objects "thread-safe"?
> >
> > The thread must be in its own separate TIB_Session. Emphasis on MUST.
> >
> > >Are there samples anywhere?
> >
> > The Threads project in Samples should light the way.
> >
> > >Overall I am seeking to make put some Firebird server processing into a the backgound and give a main program an apparent boost in speed as results from stored procedures running in separate threads are not needed by other parts of the program. Only if there is a failure in the SP do I need to intervene.
> >
> > You can catch exceptions in the SP and use a handler to go past them and log them. That's not in IBO's bailiwick, though.
> >
> > Helen
> >
>