Article View: borland.public.vdbase.data.sql
Article #508Re: query using '?' in string parameter
From: Steve Koterski
Date: Thu, 03 Sep 1998 00:00
Date: Thu, 03 Sep 1998 00:00
52 lines
3613 bytes
3613 bytes
On Thu, 3 Sep 1998 09:54:14 -0400, "Karen Elmquist"
<kelmquis@wisdomwareNOSPAM.com> wrote:
>I'm using Delphi2, Titan Access (instead of ODBC), and MS Access as my
>database. The query works in Access alone. I think that it is a delphi
>thing.....ie
>
>when I write the query like this: 'update table set name = "hello?" where
>....' - the query works. The problem however is that when you don't use
>parameters, access blows up on colons and special characters.
>
>so instead I have to use: 'Update table set name = :val where...' - then
>I have to follow it up with a parameter statement:
>query1.parambyname('val').AsString := 'hello?'
>
>Using parameters like this allows the use of special characters, except the
>question mark. It is somehow associated with delphi as a special symbol and
>I need to know how to make it into just a character in a string.
It works in Delphi alone (Delphi 4, BDE 5). So I doubt this is a Delphi
problem or a problem in Delphi only.
Local SQL follows SQL-92 in that the question mark (?) is not defined as an
SQL symbol or operator. However, I believe Microsoft Access does use this
as a wildcard character (single-character replacement, with the asterisk as
multiple character replacement). This deviation from standard SQL causes a
number of compatibility problems and makes many SQL statements unusable
under any database system except Access.
When an SQL statement such as this is executed against anything except
local tables (Paradox, dBASE, FoxPro), the SQL should be pass-through. That
is, as far as the BDE is concerned the SQL statement is merely a string to
be passed from the front-end application to the database back-end system.
The BDE neither evaluates nor executes such pass-through SQL statements.
The database back-end is where the statement is parsed and then executed.
I suspect that the problem is a result of parsing confusion, either on the
part of the Titan engine or the Access engine itself. I would suggest
contacting Titan to see whether this is a known issue with them.
Alternately, use some sort of spy program to see the background SQL being
passed from the BDE to Titan. If you have the Client/server version of
Delphi, such an SQL spy program is provided (definitely in Delphi 3, and I
believe also in Delphi 2): SQL Monitor. Otherwise, get a third-party
utility that does this. Such a utility would allow you to visually verify
the efficacy of the SQL statement as it is received by Titan.
//////////////////////////////////////////////////////////////////////////
Steve Koterski "The knowledge of the world is only to
Technical Publications be acquired in the world, and not in a
INPRISE Corporation closet."
http://www.inprise.com/delphi -- Earl of Chesterfield (1694-1773)
Technical Details
Message-ID:
<35f0c7c5.4815045@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6sjidu$eq98@forums.borland.com> <6sjugt$fq718@forums.borland.com> <6sk55h$fq825@forums.borland.com> <35f9b1c0.20420930@forums.inprise.com> <6sm73k$ih56@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,87f82f8ff4ab83fc X-Google-Attributes: gidff5a1,public From: skoterski@NOSPAMinprise.com (Steve Koterski) Subject: Re: query using '?' in string parameter Date: 1998/09/03 Message-ID: <35f0c7c5.4815045@forums.inprise.com> X-Deja-AN: 387536790 Content-Transfer-Encoding: 7bit References: <6sjidu$eq98@forums.borland.com> <6sjugt$fq718@forums.borland.com> <6sk55h$fq825@forums.borland.com> <35f9b1c0.20420930@forums.inprise.com> <6sm73k$ih56@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: INPRISE Corporation, Technical Publications Mime-Version: 1.0 Reply-To: skoterski@NOSPAMinprise.com Newsgroups: borland.public.vdbase.data.sql