root

Changeset 730

Show
Ignore:
Timestamp:
11/13/09 09:08:21 (3 weeks ago)
Author:
wbond
Message:

Fixed ticket #346 - fORMOrdering was creating incorrect SQL statements for columns in unique constraints with three or more columns. Fixed a bug with detecting unique constraints in fSchema for SQL Server, and fixed a bug in loading fActiveRecord objects with only some of the columns in a multi-column primary key.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fActiveRecord.php

    r728 r730 Hide Line Numbers
    1616 * @link       http://flourishlib.com/fActiveRecord 
    1717 *  
    18  * @version    1.0.0b49 
     18 * @version    1.0.0b50 
     19 * @changes    1.0.0b50  Fixed a bug with trying to load by a multi-column primary key where one of the columns was not specified [wb, 2009-11-13] 
    1920 * @changes    1.0.0b49  Fixed a bug affecting where conditions with columns that are not null but have a default value [wb, 2009-11-03] 
    2021 * @changes    1.0.0b48  Updated code for the new fORMDatabase and fORMSchema APIs [wb, 2009-10-28] 
     
    10521053            } 
    10531054             
    1054             $wrong_keys = is_array($key) && array_diff(array_keys($key), $pk_columns); 
     1055            $wrong_keys = is_array($key) && (count($key) != count($pk_columns) || array_diff(array_keys($key), $pk_columns)); 
    10551056            $wrong_type = !is_array($key) && (sizeof($pk_columns) != 1 || !is_scalar($key)); 
    10561057             
  • fORMOrdering.php

    r728 r730 Hide Line Numbers
    1111 * @link       http://flourishlib.com/fORMOrdering 
    1212 *  
    13  * @version    1.0.0b14 
     13 * @version    1.0.0b15 
     14 * @changes    1.0.0b15  Fixed a bug with ordering columns that are part of a multi-column unique constraint [wb, 2009-11-13] 
    1415 * @changes    1.0.0b14  Fixed a bug affecting where conditions with columns that are not null but have a default value [wb, 2009-11-03] 
    1516 * @changes    1.0.0b13  Updated code for the new fORMDatabase and fORMSchema APIs [wb, 2009-10-28] 
     
    157158        } 
    158159         
    159         $params[0] .= join(', ', $conditions); 
     160        $params[0] .= join(' AND ', $conditions); 
    160161         
    161162        return $params; 
     
    192193        } 
    193194         
    194         $params[0] .= join(', ', $conditions); 
     195        $params[0] .= join(' AND ', $conditions); 
    195196         
    196197        return $params; 
  • fSchema.php

    r726 r730 Hide Line Numbers
    1010 * @link       http://flourishlib.com/fSchema 
    1111 *  
    12  * @version    1.0.0b27 
     12 * @version    1.0.0b28 
     13 * @changes    1.0.0b28  Fixed a bug with detecting some multi-column unique constraints in SQL Server databases [wb, 2009-11-13] 
    1314 * @changes    1.0.0b27  Added a parameter to ::enableCaching() to provide a key token that will allow cached values to be shared between multiple databases with the same schema [wb, 2009-10-28] 
    1415 * @changes    1.0.0b26  Added the placeholder element to the output of ::getColumnInfo(), added support for PostgreSQL, MSSQL and Oracle "schemas", added support for parsing quoted SQLite identifiers [wb, 2009-10-22] 
     
    563564         
    564565        if (isset($temp)) { 
    565             if ($last_type == 'foreign') { 
     566            if ($last_type == 'foreign' || $last_type == 'unique') { 
    566567                if (!isset($keys[$last_table][$last_type])) { 
    567568                    $keys[$last_table][$last_type] = array();