realbasic-nug
[Top] [All Lists]

Re: Prepare Statements in Realbasic

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Prepare Statements in Realbasic
From: Tom Benson <tombenson at mac dot com>
Date: Mon, 30 Jul 2007 16:29:55 +1000
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <F0496F7F-3B8A-40EA-A616-593D2B1EE01C at natgine dot org>
If you mean stored procedures, then yes.

I'm not sure that support for stored procedures in built into RB's  
database API, but it's easy enough to work around.

e.g.

dim db as mySQLdatabase

db.host= localhost
db.databseName = "test"
db.username= "root"
db.password = "password"

if db.connect then
        dim sql as string = db.SQLselect("SELECT storedQuery FROM queryLib  
WHERE queryKey = 'customerSearch'")
        dim r as recordset = db.SQLselect(sql)

        do until r.EOF
                ....
                r.moveNext
        loop
end

I rarely hardcode an SQL query into my apps these days, preferring to  
store them in the database itself. That means I am free to change the  
database structure as inline with the app development, I just have to  
update the stored queries.

- Tom

On 30/07/2007, at 4:10 PM, RB-n00b wrote:

> Hi,
>
> I searched a lot but couldn't find anything useful about prepared
> statements in Realbasic. You know, I mean stuff like"SELECT * FROM
> sometable WHERE id = ?" and then assigning a value to the ? before
> starting the query. I very used to using this approach as other
> languages I'm programming in have support for this. While browsing
> the SqLite homepage I learned that even SqLite supports prepare
> statements thus it should be useable in  Realsql-Database as well.
> Basically I don't like the use of this databinder-controls in the GUI
> because it violates the MVC-principle.
>
> Does somebody know more about prepared statements?
>
> Thanx in advance,
> RB-n00b
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>