Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 5 of 5 total |
table.open |
Sat, May 13 2006 10:17 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | I'm pretty sure this one has been answered before but I can't figure out the correct search to get the answer.
If I write if not table.Active then table.Open; is the "if not table.Active then" a duplication of DBISAM's code? Roy Lambert |
Sat, May 13 2006 8:05 PM | Permanent Link |
"Clive" | Yes a Duplication, TDBISAMTable derives originally from TDataset..
By Calling Open.. In TDataset this just sets Active = TRUE which triggers this code in TDataSet The key part being.. if Active <> Value then So calling OPEN on a dataset thats already open does nothing... Cheers Clive. procedure TDataSet.SetActive(Value: Boolean); begin if (csReading in ComponentState) then begin FStreamedActive := Value; end else if Active <> Value then begin if Value then begin DoBeforeOpen; try OpenCursor; finally if State <> dsOpening then OpenCursorComplete; end; end else begin if not (csDestroying in ComponentState) then DoBeforeClose; SetState(dsInactive); CloseCursor; if not (csDestroying in ComponentState) then DoAfterClose; end; end; end; "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message news:C8C7007E-131F-4F1C-949B-9D3C4DE878ED@news.elevatesoft.com... > I'm pretty sure this one has been answered before but I can't figure out > the correct search to get the answer. > > If I write > > if not table.Active then table.Open; > > is the "if not table.Active then" a duplication of DBISAM's code? > > > Roy Lambert |
Sat, May 13 2006 8:53 PM | Permanent Link |
Michael Baytalsky | IMO, you should instead do Table.Active := True which does the same as your code below and not just for DBISAM, but for any other database as well. Calling Open on an active dataset may cause exception in some implementations. Regards, Michael Roy Lambert wrote: > I'm pretty sure this one has been answered before but I can't figure out the correct search to get the answer. > > If I write > > if not table.Active then table.Open; > > is the "if not table.Active then" a duplication of DBISAM's code? > > > Roy Lambert |
Sun, May 14 2006 1:04 AM | Permanent Link |
Jeff Cook | Michael Baytalsky <mike@contextsoft.com> wrote on Sat, 13 May 2006 20:58:27 -0400
> > >IMO, you should instead do Table.Active := True which does the same >as your code below and not just for DBISAM, but for any other >database as well. Calling Open on an active dataset may cause >exception in some implementations. > >Regards, And if I read the Help correctly, after an Open, the cursor is positioned to the first record - but I have never really known if Open on an Active dataset did the same thing , so I have always taken the bel and braces approach and done a First as well - is that necessary??????? Cheers Jeff -- Jeff Cook Aspect Systems Ltd Phone: +64-9-424 5388 Skype: jeffcooknz www.aspect.co.nz |
Sun, May 14 2006 1:41 AM | Permanent Link |
Michael Baytalsky | The answer we can found in db.pas source code, available you know where: procedure TDataSet.Open; begin Active := True; end; procedure TDataSet.SetActive(Value: Boolean); begin ... if Active <> Value then begin if Value then begin DoBeforeOpen; try OpenCursor; ... end; OpenCursor -> DoInternalOpen; procedure TDataSet.DoInternalOpen; begin FDefaultFields := FieldCount = 0; InternalOpen; FInternalOpenComplete := True; UpdateBufferCount; FBOF := True; --- this line means that the cursor will be set (or at least expected to by Borland) to the beginning on the data set. end; Other then that, assigning Active or calling Open has same effect, i.e.: 1. Does nothing if the dataset is already open 2. Opens the dataset at first record if it is not Regards, Michael Jeff Cook wrote: > Michael Baytalsky <mike@contextsoft.com> wrote on Sat, 13 May 2006 20:58:27 -0400 > >> >> IMO, you should instead do Table.Active := True which does the same >> as your code below and not just for DBISAM, but for any other >> database as well. Calling Open on an active dataset may cause >> exception in some implementations. >> >> Regards, > > And if I read the Help correctly, after an Open, the cursor is positioned to the first record - but I have never really known if Open on an Active dataset did the same thing , so I have always taken the bel and braces approach and done a First as well - is that necessary??????? > > > > Cheers > > Jeff > > -- > Jeff Cook > Aspect Systems Ltd > Phone: +64-9-424 5388 > Skype: jeffcooknz > www.aspect.co.nz > > > > |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |