![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Tue, Feb 28 2006 3:30 AM | Permanent Link |
"Robert Cram" | Hi Tim,
If you're using a script with multiple statements, the SQLStatementType of a DBISAMQuery returns the statementtype based on the first SQL statement. This poses a problem when you want to use the code below and you have a script consisting of a select and an update statement: if DBISAMQuery.SQLStatementType = stSelect then DBISAMQuery.Open else DBISAMQuery.ExecSQL Any change of having the SQLStatementType return the statement type of the LAST statement in a script? Regards, Robert. |
Tue, Feb 28 2006 3:44 AM | Permanent Link |
"Ralf Mimoun" | Robert Cram wrote:
> Hi Tim, > > If you're using a script with multiple statements, the > SQLStatementType of a DBISAMQuery returns the statementtype based on > the first SQL statement. > > This poses a problem when you want to use the code below and you have > a script consisting of a select and an update statement: > > if DBISAMQuery.SQLStatementType = stSelect > then DBISAMQuery.Open > else DBISAMQuery.ExecSQL Simply call ExecSQL all the time. It will open the resulting dataset if the last statement in the script is a SELECT. Ralf |
Tue, Feb 28 2006 3:58 AM | Permanent Link |
"Robert Cram" | Hi Ralf,
You're right. I know this from the DBSYS utility, but never thought of implementing it that way in code. But is there a way to tell from the resulting query if it is an empty dataset (in which case I want to return the dataset) or "the result" of an update statement (in which case I want to return nil)? Regards, Robert Ralf Mimoun wrote: > Robert Cram wrote: > > Hi Tim, > > > > If you're using a script with multiple statements, the > > SQLStatementType of a DBISAMQuery returns the statementtype based on > > the first SQL statement. > > > > This poses a problem when you want to use the code below and you > > have a script consisting of a select and an update statement: > > > > if DBISAMQuery.SQLStatementType = stSelect > > then DBISAMQuery.Open > > else DBISAMQuery.ExecSQL > > Simply call ExecSQL all the time. It will open the resulting dataset > if the last statement in the script is a SELECT. > > Ralf -- |
Tue, Feb 28 2006 4:02 AM | Permanent Link |
"Ralf Mimoun" | Robert Cram wrote:
> Hi Ralf, > > You're right. I know this from the DBSYS utility, but never thought of > implementing it that way in code. > > But is there a way to tell from the resulting query if it is an empty > dataset (in which case I want to return the dataset) or "the result" > of an update statement (in which case I want to return nil)? "if Query.Active = True..." should do the job. Ralf |
Tue, Feb 28 2006 4:13 AM | Permanent Link |
"Robert Cram" | Everything in life should be so simple
![]() Using ExecSQL instead of Open works like a charm. Thanks Ralf! Ralf Mimoun wrote: > > "if Query.Active = True..." should do the job. > > Ralf -- |
Tue, Feb 28 2006 8:56 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Robert,
<< Any change of having the SQLStatementType return the statement type of the LAST statement in a script? >> Got in here late, but you can use a TDBISAMQuery.BeforeExecute event handler to examine the SQLStatementType for the current SQL statement being executed or store it for later examination. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |