automatic database query

Jan Schenkel janschenkel at yahoo.com
Wed Sep 24 02:33:00 EDT 2003


--- Alex Rice <alex at mindlube.com> wrote:
> I've been playing around with the Database Query
> Builder and the 
> Database properties of fields and buttons. OK! It's
> easy to understand, 
> nice UI, runs fast. I'm connecting to a remote MySQL
> server via SSL.
> 
> One thing that I can't figure out though:
> 
> Can the SQL query (as specified in the Database
> Query Builder) be 
> parameterized? I understand the primary key is
> parameterized as you can 
> connect buttons up to navigate between records. But
> what about 
> parameterizing by non-primary key columns? For
> example: things like 
> putting a search term into a LIKE query, or putting
> a foreign key into 
> a JOIN query.
> 
> Macromedia Dreamweaver has the ability to fill in
> variables into a SQL 
> query. So you can use URL variables, POST variables,
> or environment 
> variable and evaluate them into the SQL query before
> the query is 
> executed.
> 
> If the Database Query Builder doesn't support this,
> how can I safely 
> modify the query via my own script at runtime?
> 
> 

Hi Alex,

Though there is currently no 'automated' way of
parameterising a query, you can create another query
with the builder and change its SQL-statement at
runtime with the (undocumented) command
'revSetSQLOfQuery' with syntax :
  revSetSQLOfQuery <name of existing query>,
                   <sql query statement>

On a positive note, it also automatically refreshes
all the fields linked to it.

If you want to learn more about the internal workings
and undocumented features of the QueryBuilder and
linked controls, have a look at the frontScript aptly
named 'revDatabase'

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the use-livecode mailing list