On Fri, Sep 27, 2013 at 08:09:16PM +0100, Martin J. Evans wrote:
> 
> However, a driver may not support SQL_ACCESS_MODE in which case it
> returns a SQL_SUCCESS_WITH_INFO and 01S02 - Option value changed,
> which is described as "the driver did not support the value
> specified in ValuePtr and substituted a similar value."
> 
> I don't see a way in DBI's pod to report this back i.e., there is no
> return value mentioned.
> 
> Should I just issue a warning if I get "option value changed - 01S02"?

> The reason this has come up is that I have the following test:
> 
>     $dbh->{ReadOnly} = 1;
>     is($dbh->{ReadOnly}, 1, 'ReadOnly set');
>     $dbh->{ReadOnly} = 0;
>     is($dbh->{ReadOnly}, 0, 'ReadOnly cleared');
> 
> and the SQLite ODBC driver is failing it because any setting of
> SQL_ACCESS_MODE returns SQL_SUCCESS_WITH_INFO, option value changed,
> 01S02 and when you go to retrieve it back it is not what you set.

By "issue a warning" do you mean set err to "0", errstr to "option value
changed..." and state to "01S02"? If so, yes, that seems like the right
thing to do.

The test can then be updated to check for that.

I'd be happy for you to patch the DBI docs along those lines.

Whether $dbh->{ReadOnly} should remain false after an attempt to set
it true has 'failed' seems more tricky. If it's false then other code
can't tell that the application declared itself to not want to make
changes. I'm inclined to let it stay true.

Tim.

Reply via email to