Subject Re: When do I commit
Author Adam
--- In firebird-support@yahoogroups.com, Grant Brown <grant@s...>
wrote:
> Hi Adam,
>
> >> do you really want ALL of the inserts to be rolled back?
>
> Yes - What I need is an all or nothing. The for loop should process
18
> times and I need all 18 loops to be without error or they all need
to be
> rolled back.

In that case your statement is correct, you want all the inserts to
happen inside the single transaction.

>
> Question :- doest "ParamByName" (and FieldByname for that matter)
cause
> the query to search its parameters list each time its called and
then
> returns the index value. Params[0] prevents the search and hence
speeds
> up the query ?

I doubt it is noticable. They tend to be very small lists and are
kept in memory, so each search is at worst n complexity. Certainly,
the first time someone adds a new parameter to your query and you
have to figure out why your program stops working you will appreciate
having the FieldByName. Certainly, having the prepare inside the for
loop well and truly stuffs up any performance gain you had there.

>
> >> Also, unless I am going nuts, you probably want to stop at
> High(PerArray)-1
>
> PerArray is a zero based array so High(MyArray) will return
> Length(MyArray) - 1
>

Yep I'm nuts :(

Adam