#68 ✓resolved
Joshua Paine

$sql undefined in MysqlDataSourceProvider::getStatementForBuilder

Reported by Joshua Paine | February 9th, 2009 @ 05:26 PM | in 0.11.1

This query triggers the problem:

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

Comments and changes to this ticket

  • Kris Jordan

    Kris Jordan February 16th, 2009 @ 03:20 PM

    • 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!

  • Joshua Paine

    Joshua Paine February 16th, 2009 @ 03:44 PM

    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.

  • Kris Jordan

    Kris Jordan February 17th, 2009 @ 04:46 AM

    • 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.

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Recess PHP Framework is an open source, full stack, RESTful PHP framework.

http://www.recessframework.org/

People watching this ticket

Tags

Pages