[Gambas-devel] Change to gb.db.odbc to use ODBC Connection Strings.

Benoît Minisini gambas at ...1...
Fri Oct 16 18:26:12 CEST 2015


Le 16/10/2015 15:39, ML a écrit :
> Benoĩt,
>
> It took some time, but I think I have the real reason why the Wizard
> does not work: It returned to the red rows with error after getting an
> appropriate record count.
>
> The problem seems to be that the SQL query is being add a
> non-SQL-standard clause, "LIMIT 256". This may have something to do with
> the row cache you mentioned.
> Unfortunately, the LIMIT clause is a MySQL clause (don't know if other
> servers support it), it does not exist on standard SQL.
> There are ways (read "hacks") to get a specific 'subrowset' from a given
> rowset, but they depend on SQL revisions; for example, MSSQL 2005 and
> 2008 are the hardest, and is easier in MSSQL 2012.
>
> There's actually no one-solution-fits-all way. I think the approach to
> retrieve a subset of rows from a query should be different, but I don't
> know how that would be feasible on gb.db.form.
>
> So, in short, now ODBC returns a Result.Count if the server supports
> scrollable cursors (most RDMS do), but that does not help the Connection
> Wizard.
>
> Regards,
> zxMarce.
>

LIMIT exists in MySQL, PostgreSQL, and SQLite. With, of course, some 
differences in the syntax.

There is no such thing like real "standard SQL clause", or "standard 
SQL" in the real word. There is as many differences between two SQL 
database servers than between the HTML implementation of two web browsers!

SQL sucks. :-)

But I think that feature must be present in all SQL database systems.

The gb.db component has a standard way for specifying that you want to 
limit your result set:

DB.Limit(256).Exec(...)

That way, it's possible to adapt that feature to gb.db.odbc. But we must 
find a way for the ODBC driver to know how to specify the result limit.

Do you think it's possible with ODBC to make the difference, following 
that: https://en.wikipedia.org/wiki/Select_%28SQL%29#Result_limits ?

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list