Skip to content

Undefined property: stdClass::$column_name when generating a model #20190

@metaodi

Description

@metaodi
  • Laravel Version: 5.1
  • PHP Version: 7.1
  • Database Driver & Version: mysqlnd 5.0.12-dev

Description:

The MySqlProcessor assumes that the result from MySQL contains a lowercase column called column_name.

On my installation, if I run the query from compileColumnListing of MySqlGrammar

select * from information_schema.tables where table_schema = ? and table_name = ?

The result contains the column COLUMN_NAME in uppercase.

I don't really know where this is changed. In the driver? Maybe it makes sense to change the query in MySqlGrammar to ensure the correct case of the result:

select column_name as "column_name" from information_schema.tables where table_schema = ? and table_name = ?

Steps To Reproduce:

If I try to create a new model using the builder-plugin for OctoberCMS, I get the following error:

"Undefined property: stdClass::$column_name" on line 18 of /var/www/public/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php

There is already an issue in that repo: rainlab/builder-plugin#161

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions