Welcome Guest, Not a member yet? Register   Sign In
Migration stopped working after v3.1.11
#1

Hi,

My project is using Migration library to create and update table structures.
Until version 3.1.10 everything worked fine. i use cli to execute the migration:

`php index.php migrate_controller up`

This works in version 3.1.9, 3.1.10 but not not 3.1.11.

After swapping the system folder the following error presented itself:

CLI returns following error:

Database error: A Database Error Occurred

Error Number: 42000/1102
Incorrect database name ''
SHOW TABLES FROM ``
Filename: libraries/Migration.php
Line Number: 167

At first glance the libraries look identical... yet it does not work in 3.1.11 when i replace the system folder with the 3.1.10 / 3.1.9 it's up and running again ...

I've been searching for where it's going wrong for over 3 hours now but can't seem to locate the issue ...

Am i overlooking something or is it a bug.

Thanks in advance,

Bart
Reply
#2

hello,
just to be sure you copy paste the system folder and the mime file right ? https://codeigniter.com/user_guide/insta..._3111.html
Reply
#3

(This post was last modified: 10-04-2019, 05:37 AM by bartMommens.)

(10-04-2019, 05:31 AM)mboufos Wrote: hello,
just to be sure you copy paste the system folder and the mime file right ? https://codeigniter.com/user_guide/insta..._3111.html

Hi mboufos,


Yes that's the first thing i triple checked  Tongue

"just downloaded latest version from the site, duplicated project, checked everything ... still happens. Something has changed in the core of the framework i guess...
Reply
#4

(10-04-2019, 05:34 AM)bartMommens Wrote:
(10-04-2019, 05:31 AM)mboufos Wrote: hello,
just to be sure you copy paste the system folder and the mime file right ? https://codeigniter.com/user_guide/insta..._3111.html

Hi mboufos,


Yes that's the first thing i triple checked  Tongue

"just downloaded latest version from the site, duplicated project, checked everything ... still happens. Something has changed in the core of the framework i guess...

Big Grin ok heheh tbh i havent use that library and i cant help you  Undecided  . Just wait the Super CI Team will check it Big Grin
Reply
#5

(10-04-2019, 05:50 AM)mboufos Wrote:
(10-04-2019, 05:34 AM)bartMommens Wrote:
(10-04-2019, 05:31 AM)mboufos Wrote: hello,
just to be sure you copy paste the system folder and the mime file right ? https://codeigniter.com/user_guide/insta..._3111.html

Hi mboufos,


Yes that's the first thing i triple checked  Tongue

"just downloaded latest version from the site, duplicated project, checked everything ... still happens. Something has changed in the core of the framework i guess...

Big Grin ok heheh tbh i havent use that library and i cant help you  Undecided  . Just wait the Super CI Team will check it Big Grin

No worries but i like the way you think, most of the time in the middle of a critical error you forget the little things. Hopefully it gets fixed soon or someone has a solution. But thank god that CI works again by just swapping one folder. If it was a Laravel project i would of well ... cried Smile
Reply
#6

Are you using the PDO driver perhaps?
This commit adds the whole FROM statement, that weren't there before.

I think you can switch to mysqli driver and it will still work in 3.1.11 until it's fixed.
Reply
#7

(10-04-2019, 12:35 PM)jreklund Wrote: Are you using the PDO driver perhaps?
This commit adds the whole FROM statement, that weren't there before.

I think you can switch to mysqli driver and it will still work in 3.1.11 until it's fixed.

I'm skeptical that it is due to that commit. The whole FROM statement has always been there. It's how the table name is escaped that changed.

Maybe the database config didn't supply a database name? Or, that property got whacked by some other code?
Reply
#8

(This post was last modified: 10-04-2019, 02:38 PM by jreklund.)

@davefriend: It haven't always been there, look at the commit. It just got added to system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php

And it won't be able to append $this->database as it's been (probably) left out in @bartMommens script.
Reply
#9

(This post was last modified: 10-04-2019, 08:11 PM by dave friend.)

(10-04-2019, 02:38 PM)jreklund Wrote: @davefriend: It haven't always been there, look at the commit. It just got added to system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php

And it won't be able to append $this->database as it's been (probably) left out in @bartMommens script.

You're partly correct - it hasn't always been there since CI v3.0.0

From CodeIgniter version 2.1.3 (the oldest I have handy) pdo_driver.php

PHP Code:
function _list_tables($prefix_limit FALSE)
 {
    $sql "SHOW TABLES FROM `".$this->database."`";

    if ($prefix_limit !== FALSE AND $this->dbprefix != '')
    {
    //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
      return FALSE// not currently supported
    }
    return $sql;
 } 

So, it was there and then it wasn't and now it is again.

For PDO the database name need not be included in the query, but it isn't wrong to provide it. (Though it does need to be a useful value.)

I cannot see that the database property would get set from a DSN string. It seems only to get a value from the /config/database.php file.

If PDO is being used (meaning the connection is via 'dsn') then the connection settings might have 'database' => '', and that might be why the "incorrect database name '' " error is happening.

We don't know if he's using PDO anyway though it seems likely.

It might be possible to stick with CI v3.1.11 by setting a database name in the config.
Reply
#10

(This post was last modified: 10-05-2019, 12:53 AM by bartMommens.)

(10-04-2019, 08:09 PM)dave friend Wrote:
(10-04-2019, 02:38 PM)jreklund Wrote: @davefriend: It haven't always been there, look at the commit. It just got added to system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php

And it won't be able to append $this->database as it's been (probably) left out in @bartMommens script.

You're partly correct - it hasn't always been there since CI v3.0.0

From CodeIgniter version 2.1.3 (the oldest I have handy) pdo_driver.php

PHP Code:
function _list_tables($prefix_limit FALSE)
 {
    $sql "SHOW TABLES FROM `".$this->database."`";

    if ($prefix_limit !== FALSE AND $this->dbprefix != '')
    {
    //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
      return FALSE// not currently supported
    }
    return $sql;
 } 

So, it was there and then it wasn't and now it is again.

For PDO the database name need not be included in the query, but it isn't wrong to provide it. (Though it does need to be a useful value.)

I cannot see that the database property would get set from a DSN string. It seems only to get a value from the /config/database.php file.

If PDO is being used (meaning the connection is via 'dsn') then the connection settings might have 'database' => '', and that might be why the "incorrect database name '' " error is happening.

We don't know if he's using PDO anyway though it seems likely.

It might be possible to stick with CI v3.1.11 by setting a database name in the config.


Hey Guys,

Thank you all for your replies, and you are correct i am using the PDO Driver so i use the DSN string in the cofing/database.php.
I'm going to change from PDO to MYSQLi and hopefully everything keeps working.

Thanks for the help!

i Can confirm that switching over to MYSQLi drivers works, so this means that several other users might be affected by this issue and be unaware of it.
Reported this issue on the github of CI.

Thank you guys for your insights, i'm now going to test the rest of my application to check that all the other things keep working after database driver switch Smile

Best regards,
Bart
Reply




Theme © iAndrew 2016 - Forum software by © MyBB