Subject | Re: [firebird-support] FB and Ad Hoc Query Assistance-Please |
---|---|
Author | Actnow Accounting P/L |
Post date | 2004-06-07T11:55:36Z |
Martin
With your app create a number of queries each attached to a datasource,
say Q1, Q2, Q3 etc.
Then with those do something like the following:
Select
WITH Q1 DO
BEGIN
CLOSE;
SQL.CLEAR;
SQL.ADD('SELECT * FROM TABLE1 WHERE FIELD1 = :MY_VALUE');
PARAMBYNAME('MY_VALUE').VALUE := 'Y'
EXECSQL;
END;
UPDATE
WITH Q1 DO
BEGIN
CLOSE;
SQL.CLEAR;
SQL.ADD('UPDATE TABLE1 SET FIELD1 = :MY_VALUE');
PARAMBYNAME('MY_VALUE').VALUE := 'Y'
EXECSQL;
END;
DELETE
WITH Q1 DO
BEGIN
CLOSE;
SQL.CLEAR;
SQL.ADD('DELETE FROM TABLE1 WHERE FIELD1 = :MY_VALUE');
PARAMBYNAME('MY_VALUE').VALUE := 'Y'
EXECSQL;
END;
This methodology stops you from having to do the following 'creates' in various procedures,
eg -
procedure do_some_thing
var
begin
try
my_query : Tquery;
begin
if not assigned(my_query) then my_query.create(self);
blah blah blah
finally
if assigned(my_query) then freeandnil(my_query);
end;
end
instead, you just use Q1 or Q2 etc
This just saves you having to recreate these things all the time.
A good idea in the temporary permanent queries is to to place
an sql.clear in the afterclose event, like this
my_query.sql.clear;
This way you never add sql code to previous sql code.
Gerry
With your app create a number of queries each attached to a datasource,
say Q1, Q2, Q3 etc.
Then with those do something like the following:
Select
WITH Q1 DO
BEGIN
CLOSE;
SQL.CLEAR;
SQL.ADD('SELECT * FROM TABLE1 WHERE FIELD1 = :MY_VALUE');
PARAMBYNAME('MY_VALUE').VALUE := 'Y'
EXECSQL;
END;
UPDATE
WITH Q1 DO
BEGIN
CLOSE;
SQL.CLEAR;
SQL.ADD('UPDATE TABLE1 SET FIELD1 = :MY_VALUE');
PARAMBYNAME('MY_VALUE').VALUE := 'Y'
EXECSQL;
END;
DELETE
WITH Q1 DO
BEGIN
CLOSE;
SQL.CLEAR;
SQL.ADD('DELETE FROM TABLE1 WHERE FIELD1 = :MY_VALUE');
PARAMBYNAME('MY_VALUE').VALUE := 'Y'
EXECSQL;
END;
This methodology stops you from having to do the following 'creates' in various procedures,
eg -
procedure do_some_thing
var
begin
try
my_query : Tquery;
begin
if not assigned(my_query) then my_query.create(self);
blah blah blah
finally
if assigned(my_query) then freeandnil(my_query);
end;
end
instead, you just use Q1 or Q2 etc
This just saves you having to recreate these things all the time.
A good idea in the temporary permanent queries is to to place
an sql.clear in the afterclose event, like this
my_query.sql.clear;
This way you never add sql code to previous sql code.
Gerry
----- Original Message -----
From: Martijn Tonies
To: firebird-support@yahoogroups.com
Sent: Monday, June 07, 2004 9:37 PM
Subject: Re: [firebird-support] FB and Ad Hoc Query Assistance-Please
Hi,
> New to FB and databases in general. I'm looking for a way to do Ad
> Hoc Querys. Is this function already present in FB or will I need a
> third party app? If so, any recommendations.
> If this is already available in FB, how do I access it?
You can use the command line tool "isql" to do this, or download
a (commercial) third party tool.
One of the available tools would be Database Workbench -
www.upscene.com
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
Yahoo! Groups Sponsor
ADVERTISEMENT
------------------------------------------------------------------------------
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]