[Gambas-user] SQLite PRAGMA don't seem works any more

Benoît Minisini gambas at ...1...
Tue Jan 6 17:43:38 CET 2015


Le 06/01/2015 17:29, Jorge Carrión a écrit :
> I find the old code that shows the slowly of database objects in loops.
> Just trying to get de length of all fields of all tables in a database:
>
>   For Each tbl In hc.Tables
>          Print tbl.Name
>          For Each fld In tbl.fields
>              awidths.Add(fld.Length)
>          Next
>    Next
>
> I try it with two databases:
>
>   A SQLite database with 16 tables and 127 fields.
>   A MySQL database with  6 tabñes amd 82 fields.
>
> The result is attahed in two images.
>
> With SQLite is not a bad result, but in MySQL is a disaster...
> It seems like gambas has to "travel thru the web" in order to get the
> information of each field of each table...
> I use, then, the "show columns for tablename" instruction in MySQL... and
> the PRAGMA fields_info in SQLite that does the work at once... but PRAGMA
> doesn't work any more.
> Looking this test is not a big issue: I can use different way to each
> database type, but PRAGMA is a must-work on SQLite, I think.
>
> Regards
>

Metadata information is not part of the SQL "standard", so each database 
behaves differently.

As for the use of PRAGMA, it never worked before. It's a more global 
change that you will get in the next revision.

Regards,

-- 
Benoît Minisini




More information about the User mailing list