Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

$sql undefined in MysqlDataSourceProvider::getStatementForBuilder

#68

This query triggers the problem:

Make::a('Retailer')->equal('phone','321-456-7890')->first();

Reported by Joshua Paine · February 9th, 2009 @ 05:26 PM

State: resolved
Milestone: 0.11.1
Assigned to: Kris Jordan Kris Jordan

Activity

  1. Kris Jordan
    Kris Jordan
    • State changed from new to hold

    Added a test case to /recess/test/lib/recess/database/orm/ModelTest.class.php

    This case was pushed to edge with commit 2131467.

    Test method is 'testTicket68FirstAfterEqual' on line 562. Could not seem to reproduce the troubles you're experiencing. Placing on hold for now. If you could reproduce the error in the test suite it would be great for regression test purposes. Thanks for the submission!

    February 16th, 2009 @ 03:20 PM

  2. Joshua Paine
    Joshua Paine

    You can't reproduce b/c you're using sqlite:memory for the data source--this only occurs under MySQL. If you look at line 400 of the current /recess/lib/recess/database/pdo/MysqlDataSourceProvider.class.php, you can see a reference to $sql, though $sql has never been defined in the function.

    Working from the SQLite provider (which doesn't have this problem), I fixed the issue in my local copy by adding:

    $sql = $builder->$action();
    
    

    before line 393. All the tests still pass, but apparently the DB tests don't exercise MySQL anyway, so that's not conclusive.

    February 16th, 2009 @ 03:44 PM

  3. Kris Jordan
    Kris Jordan
    • Milestone set to 0.11.1
    • State changed from hold to resolved

    Moved all tests from simpletest to PHPUnit this evening. Running the tests from PHPUnit now runs all tests on both MySQL and Sqlite. Much better testing facility!

    The process turned up a number of minor problems with MySQL support as you found -- and the fix you outline above does indeed solve the problem you encountered. There was other weirdness in MySQL's handling of joins. If you're using MySql I suggest getting the latest bits and (if you don't have it) PHPUnit from PEAR.

    February 17th, 2009 @ 04:46 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.