[suggestion] Know if database exists - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [suggestion] Know if database exists (/showthread.php?tid=59960) |
[suggestion] Know if database exists - El Forum - 12-17-2013 [eluser]Ñuño Martínez[/eluser] I know, there's the method $this->dbutil->database_exists ('name');. The problem is when you need to know if the default database (the one defined at config/database.php) exists. For example, you're creating an installation script. I haven't find a nice way to know which database are configured at configuration file. Finally I've found this way: Code: # Comprueba si la base de datos está creada. But I think that "include" isn't a good solution. I think that add a way to access to the $db array items using a CI function (for example, from dbutil) is much better. For example, the previous code may looks like next one: Code: # Comprueba si la base de datos está creada. Also access to the $active_group variable would be great (i.e. $this->dbutil->active_group ()). Just as suggestion. [suggestion] Know if database exists - El Forum - 12-26-2013 [eluser]InsiteFX[/eluser] You can use the native MySQLi methods [suggestion] Know if database exists - El Forum - 12-27-2013 [eluser]Ñuño Martínez[/eluser] I know, but what if I want to support various MDBS? [suggestion] Know if database exists - El Forum - 12-27-2013 [eluser]InsiteFX[/eluser] Take a look at the PYRO CMS it has it's own installer |