FAQ
Hi,

Attached is a new test case for the 71mysql.t file that tests the
proper initialization of the sql_maker in the ::Storage::DBI class.

If the first query immediately after a connect is a find(), the code
path will call sql_maker() before calling _determine_driver(), and so,
any ::Storage::DBI subclass that updates sql_maker_class() will be
unable to use the specific SQLHacks class. This a side effect of the
code path that find() uses: it calls single() as a fast path, and that
path doesn't call _determine_driver().

The patch covers only the MySQL database because, of those that have a
SQLHacks subclass, thats the only one that I have access to.
Equivalent tests could/should be done on the Oracle and MSSQL cases.

A probable solution would be to add something like this
to ::Storage::DBI::select_single():

# redispatch to update method of storage we reblessed into, if
necessary
if (not $self->_driver_determined) {
$self->_determine_driver;
goto $self->can('select_single');
}

but for some obscure reason I cannot get it to work.

Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: premature_sql_maker_init.diff
Type: application/octet-stream
Size: 694 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091030/6dac059e/premature_sql_maker_init.obj
-------------- next part --------------

Search Discussions

  • Pedro Melo at Oct 30, 2009 at 8:54 pm
    Skipped content of type multipart/alternative-------------- next part --------------
    A non-text attachment was scrubbed...
    Name: select_single_init.diff
    Type: application/octet-stream
    Size: 702 bytes
    Desc: not available
    Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091030/fc5b74ad/select_single_init.obj
  • Peter Rabbitson at Nov 12, 2009 at 1:15 am

    Pedro Melo wrote:
    Hi again,


    On Fri, Oct 30, 2009 at 8:46 PM, Pedro Melo wrote:

    A probable solution would be to add something like this to
    ::Storage::DBI::select_single():

    # redispatch to update method of storage we reblessed into, if
    necessary
    if (not $self->_driver_determined) {
    $self->_determine_driver;
    goto $self->can('select_single');
    }

    but for some obscure reason I cannot get it to work.


    I got it to work. The attached patch fixes the problem for MySQL.
    Fixed in a more general way:
    http://dev.catalyst.perl.org/svnweb/bast/revision/?revx63

    Cheers

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbix-class @
categoriesperl, catalyst
postedOct 30, '09 at 8:46p
activeNov 12, '09 at 1:15a
posts3
users2
websitedbix-class.org
irc#dbix-class

2 users in discussion

Pedro Melo: 2 posts Peter Rabbitson: 1 post

People

Translate

site design / logo © 2021 Grokbase