Skip to content

Sqlsrv describe method fetches DB-columns case-sensitive #79

@ghost

Description

Created by Dominik, 8th Aug 2012. (originally Lighthouse ticket #39):


I had a problem when changing from datasource dbo_oracle to dbo_sqlsrv, the DB-structure and its data for both ORACLE and SQL-server is the same:
The describe() method in file dbo_sqlsrv.php at line 234 returns the name of the field in upper letters. Before I started using dbo_sqlsrv I used dbo_mssql and dbo_oracle, but these drivers return field names in lower case, and therefore because of case-sensitive array-keys the following code "echo $data['MyModel']['field1']" would not work in sqlsrv but in mssql.

I actually fixed the problem near line 230:

    $fields = false;
    foreach ($cols as $column) {
        $field = strtolower($column[0]['Field']);                      // not that beautiful
        $fields[$field] = array(
            'type' => $this->column($column[0]['Type']),

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions