Database INSERT: use Flush

Arthur Clemens aclemens at xs4all.nl
Wed Nov 26 12:37:05 CST 2003


On 26-nov-03, at 9:26, Ruslan Zasukhin wrote:

> on 11/26/03 1:27 AM, Arthur Clemens at aclemens at xs4all.nl wrote:
>
>> Aarg!
>> Just spent more than one hour on the question why my database is
>> corrupt when viewing it in Valentina Carbon, after only inserting 2
>> records with SqlExecute(). Read somewhere in the archive that I need 
>> to
>> call mydatabase->Flush() after INSERT. Works ok now.
>
>> But I wonder why this is not written in the SQLReference...
>
> Hi Arthur,
>
> Well, yes, INSERT, as well as cursor->AddRecord() do not save record 
> on disk
> immediately.
>
> This allows you very fast add of e.g. 1000 records, and then only one 
> flush.
>
>
> But I wonder, if you in YOUR app add by INSERT 2 records,
> DO NOT do flush,
> But you should do CLOSE() yes?
>
> Then only you can go and open db in VAPP.
>
> Close() do flush self, so you should not see problems.
>
>
> If you open in VAPP db that is NOT closed by YOUR app then you can get
> problems. Although VAPP should refused that.

I do ValentinaShutDown(). Should I use Close()? I can only find a 
reference to this in VSDKReference, p. 39.

If I insert a Flush() just before ValentinaShutDown() it also works 
normal.

Arthur



More information about the Valentina mailing list