V4RB: handling of SQL-Statements

Claudius Sailer Claudius at sailer-online.de
Mon Jun 9 21:13:17 CDT 2003


Hi Lloyd,

Am Montag, 09.06.03 um 19:30 Uhr schrieb Lloyd Butler:

> I don't use RB, but what I do is I have a table called 'scripts' in 
> each of
> my databases.
>
> In there I store the sql query's. If it requires parameters, then I use
> place holders of "<parm#>" where the # is replaced by a number.
>
> I have 4 functions in my Valentina library, sqlPull, sqlSelect, 
> sqlExecute
> and sqlClose. The sqlPull will allow me to pull a stored script, 
> replace the
> parm variables and execute it. It calls sqlSelect and returns the 
> data. The
> sqlExecute is using to handle any Execute calls, and sqlClose closes 
> the
> database. sqlSelect and sqlExecute automatically open the database, 
> but I
> have not added too much error handling in there yet.
>
> At the moment I have the library returning pipe delimited fields in 
> return
> delimited records that I can parse. This is because I am using 
> Applescript
> or Perl. In Perl I have used MacGlue to link to Valentina and it send
> AppleEvents to work with the database. It is a bit pokey getting the 
> glue
> inited, but them it zips along quite well for what I need, especially 
> with
> the speed of Valentina. It works on OS X and 9 as well.
>
> It is not am ideal solution, but it means that I can have multiple 
> scripts
> accessing the database and using the exact same query's if need be and 
> not
> have to put them directly into my code.
>
> The idea was to try and simulate stored procedures. I am still working 
> on
> added the ability to have a multi-line script stored and the results 
> of the
> first line feed into the second and second into third and so on. I 
> haven't
> had time basically and now with Ruslan's additions of the ability to 
> select
> in a select, I may not need to.
>
> I can also call sqlSelect or sqlExecute directly if need be, but I try 
> no to
> as it may mean fixing code later.
>
> That is how I try and reuse my queries so that I do not have to edit 
> them
> multple times if I change the database at all. I
>
> I can send you my libraries if you want to see them to get some ideas.

Thanks for your input. My problem is, that I don't send a database with 
my application. A database can be created by my application. This 
brings the point to me, that I can't save the SQLString in the database 
or I have to insert the possibility to fill the SQLStrings by creating 
the database in the database and I have to build an function which 
changes/updates the SQLStrings by upgrading a still running database.

*hmmm* It is an intersting idea from you. I have to think about :-))

Thanks for your ideas



Claudius

-- 
G4/733 QS / MacOS X 10.2.6de / RB 4.5.3de or 5.1de / Valentina 1.9.7



More information about the Valentina mailing list