| | 420 | /** create a database only if it seems to be needed |
| | 421 | * |
| | 422 | * Creates a database using the current database connection in case |
| | 423 | * it is not currently select-able. |
| | 424 | * |
| | 425 | * Used for install purposes. |
| | 426 | * |
| | 427 | * @since 2.8 |
| | 428 | * @access private |
| | 429 | * @see constructor of this class |
| | 430 | * |
| | 431 | * @param string $db MySQL database name |
| | 432 | * @return void |
| | 433 | */ |
| | 434 | function _fuzzy_createdb($db) { |
| | 435 | // ensure being connected. |
| | 436 | if ( !$this->dbh ) return; |
| | 437 | // proflems already? then nothing to touch. |
| | 438 | if ( mysql_errno($this->dbh) ) return ; |
| | 439 | |
| | 440 | // perform database creation as needed |
| | 441 | if (!@mysql_select_db($db, $this->dbh)) |
| | 442 | // create database only if it does not exists (Error Number 1049 / Unknown database 'XYZ'). |
| | 443 | if ( 1049 == mysql_errno($this->dbh) ) |
| | 444 | $this->query("CREATE DATABASE `$db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"); |
| | 445 | } |
| | 446 | |