🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #793

Re: Help with SQL and memory variables.

#793
From: Ken Chan
Date: Mon, 20 Jul 1998 00:00
30 lines
1558 bytes
Craig Cohernour wrote:
> don't know how to reference the memory variable in the sql statement or
> in the visual sql tools.

You have to convert the variables into parameters in the "parameterized" 
SELECT statement. Basic steps are:

1. Assign a SQL SELECT statement that contains parameter names preceded 
by colons to the sql property of the Query object. For example (here the 
field name and parameter name just happen to be the same; a common 
practice, but not required):

  select * from WHATEVER where STATUS > :status

2. That automatically creates elements in the Query object's params 
array. You might want to assign default values for these parameters, 
which you can do through the tool in the Inspector for the query's params 
property.

3. Use the query's canOpen event to copy the variables that already exist 
into the params array. Be sure to return true from the canOpen event 
handler. Something like:

  function query_canOpen
    this.params[ "status" ] = st_stat // Copy variable
    return true

-- 
//Ken@Inprise
<Please follow-up to newsgroup; do not reply to email>
Technical Details
Message-ID: <MPG.101d6e56e9540893989a2f@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35B1A9AF.8788721@access.mountain.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,d29952a1b56f8d15
X-Google-Attributes: gidff5a1,public
From: supportinfo@inprise.com (Ken Chan)
Subject: Re: Help with SQL and memory variables.
Date: 1998/07/20
Message-ID: <MPG.101d6e56e9540893989a2f@forums.borland.com>
X-Deja-AN: 373361141
References: <35B1A9AF.8788721@access.mountain.net>
Organization: Inprise
Newsgroups: borland.public.vdbase.data.sql