[Gambas-user] prb:Connection.Exec() bypass sql code

Benoit Minisini benoit.minisini at ...2...
Sat Apr 29 23:41:29 CEST 2006


On Saturday 29 April 2006 23:34, ron wrote:
> I'm feeling realy stupid.
> ===========
> PRINT sTBLinProc
>   hRecordData = hConn.Create(sTBLinProc)
> i = hRecordData.Fields.Count
> i = hRecordData.Count
> i = hRecordData.Max
>
>   txtCount.Text = getRecordCount()
> ===========
> hRecordData is variable of Result
> sTBLinProc = table name and correct
> the first i is correct field count
> the second i is gives '1' and is wrong, the test table has 7 records
> the last i returns '0' and should be 6 ?
>
> The GetRecordCount() I made get it from the same table and is correct.
>
> The help says only
>   'This class represents the result of a SQL request.'
>   'Returns the number of records inside the result.'
>
> Than it is logic to me that 'hRecordData = hConn.Create(sTBLinProc)'
> should act as the SQL request and get the whole table as
> "SELECT * FROM table" and if there is a note in gb.db
> page not to use .Exec for correct working.

Not at all. Create() returns a special read/write Result with one record 
inside.

All record fields are set to NULL, that means, in the Create() case only, that 
the field will take its default value.

Are things clearer?

Note: If you want to see what 'gb.db' sends to the database backend, set 
DB.Debug to TRUE at the start of your program.

Regards,

-- 
Benoit Minisini





More information about the User mailing list