From: Josh Berkus <josh@agliodbs.com>
To: sqllist <pgsql-sql@postgresql.org>
Subject: Re: DLookup('field', 'table', ['condition'])
Date: Tue, 27 Feb 2001 08:40:21 -0800
Message-ID: <3A9BD875.AA1290BD@agliodbs.com> (raw)
References: <Pine.BSF.4.21.0102262021570.34291-100000@megazone23.bigpanda.com>
Mr. Ambos,
> Is this supposed to give effectively the same result as the subquery
> (select student.id where name='Bill Gates' limit 1)? I don't think
> that subquery is supported in 7.0, but will be in 7.1 along with
> EXECUTE for plpgsql which should let you build a query out of the
> parts you give it. I think you'd possibly be able to do this in 7.0
> using pltcl but I don't know tcl so I can't help there.
Based on an earlier discussion regarding dynamic queries and EXECUTE,
what you want will be hard to do with an SQL or PL/pgSQL function
(although possible) even in 7.1. According to one developer, with
PL/Tcl it's easier to build dynamic queries; one could also use C or
Perl.
However, you may want to re-think why you're using a dynamic "DLookup"
function rather than a more specific function, saved query, or view.
Dynamic queries are always going to run slower, regardless of language,
than saved DB structures. This is especially true of Dlookup in MS
Access, let alone DSum or DCount.
If the program role you're trying to serve is frequent (student look-up,
for example) in your application, you would probably be better off in
several regards constructing a specific function to fill that purpose
(lf_lookup_student_id(VARCHAR)). Personally, I'm a function "junkie" an
I've never had need to replicate the VBA Dlookup functionality.
-Josh Berkus
--
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com
Subject: Re: DLookup('field', 'table', ['condition'])
In-Reply-To: <3A9BD875.AA1290BD@agliodbs.com>
References: <Pine.BSF.4.21.0102262021570.34291-100000@megazone23.bigpanda.com> <3A9BD875.AA1290BD@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox