getConnectionHandler() public method

This is currently required for extensions to access the database without connecting again.
コード例 #1
0
ファイル: Database.php プロジェクト: kimai/kimai
 /**
  * Kimai_Remote_Database constructor.
  * @param array $kga
  * @param Kimai_Database_Mysql $database
  */
 public function __construct($kga, $database)
 {
     $oldDatabase = $database;
     $this->tablePrefix = $database->getTablePrefix();
     $this->kga = $kga;
     $this->dbLayer = $oldDatabase;
     $this->conn = $this->dbLayer->getConnectionHandler();
 }
コード例 #2
0
ファイル: processor.php プロジェクト: lentschi/kimai
        write_config_file($database, $hostname, $username, $password, $db_layer, $db_type, $prefix, $lang, $salt, $timezone);
        break;
        /**
         * Create the database.
         */
    /**
     * Create the database.
     */
    case "make_database":
        $databaseName = $_REQUEST['database'];
        $hostname = $_REQUEST['hostname'];
        $username = $_REQUEST['username'];
        $password = $_REQUEST['password'];
        $server_type = $_REQUEST['db_type'];
        $db_layer = $_REQUEST['db_layer'];
        $db_error = false;
        $result = false;
        $database = new Kimai_Database_Mysql($result);
        $database->connect($hostname, null, $username, $password, true, $server_type);
        $conn = $database->getConnectionHandler();
        $query = "CREATE DATABASE `" . $databaseName . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci";
        $result = $conn->Query($query);
        if ($result !== false) {
            echo "1";
            // <-- hat geklappt
        } else {
            echo "0";
            // <-- schief gegangen
        }
        break;
}