Re: DLookup('field', 'table', ['condition'])

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: sqllist <pgsql-sql(at)postgresql(dot)org>
Subject: Re: DLookup('field', 'table', ['condition'])
Date: 2001-02-27 16:40:21
Message-ID: 3A9BD875.AA1290BD@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Blaise Carrupt 2001-02-27 16:43:25 Help creating rules/triggers/functions
Previous Message Richard Huxton 2001-02-27 13:32:32 Re: underscore problem