[Gambas-devel] Question gb.db.Request
ron
ronstk at ...124...
Fri Apr 21 07:04:04 CEST 2006
I try to make program :)
DIM Request as string
Request ="id=" & useid
IF usechar THEN Request = Request & " AND char=" $ usechar
Somehow by accident i got the Completion comes up.
As I understood for Request in the Completion it could be used
to create a SQL line for the Connection.Exec() and made the next code
DIM hConn as Connection
hConn = new Connection
... setting the values
DIM req AS Request
req.Select("field1,field2")
req.From("tblname")
req.Where("id=" & useid)
...
DIM hResult AS Result
hResult=hConn.Exec(req) ' forget the Argument and remaining
...
Browsing in the gb.db.form files while they are not documented yet.
in srcfile DataCombo.class I found
rData = DB.Exec(Request.Select([$sKey, sDisp]).From($sTable).Where($sFilter).Get())
Here the way Request is handled in different way the AutoCompletion suggest.
Now I understand also the the meaning of .Get() more.
However a Select is already meaning I want to Get the records.
Then the .Get() must mean something else and I asume it means to Get from
Request the complete SQL line in well formed fashion, I gues.
With a look at other pages in gb.db I found
--------
Connection.Edit (gb.db)
Syntax
FUNCTION Edit ( Table AS String [ , Request AS String, Arguments AS , ... ] ) AS Result
Request is a SQL WHERE clause used for filtering the table.
Request is here a string and looks to me the "id=123" case.
For the Arguments should it not be
FUNCTION Edit ( Table AS String [ , Request AS String [, Arguments AS , ... ] ] ) AS Result
--------
Connection.Exec (gb.db)
Syntax
FUNCTION Exec ( Request AS String, Arguments AS , ... ) AS Result
Request is a SQL WHERE clause used for filtering the table.
Request must be here something like a full SQL line.
Connection.Exec("id=123 and char=a") makes no sence to me.
For 'Arguments AS', the same as noted for FUNCTION Edit.
--------
Request is overall a very confusing word. (if the component gb.db.form is add)
The way it is used in the DataCombo.class as given above looks nice to me.
Note here also that 'Arguments AS' is not used so that must be optional.
Can it be confirmed that
rData = DB.Exec(Request.Select([$sKey, sDisp]).From($sTable).Where($sFilter).Get())
Is it the same as using a object Request, set the arguments/properties/methods
and use it for case where only the field needs to change.
DIM MyRequest AS Request
MyRequest.Select("field1")
MyRequest.From("table")
MyRequest.Where("id=123")
rData = DB(MyRequest.Get())
TIA from
Ron
More information about the Devel
mailing list