DbSql::Export PHP Method

Export() public method

public Export ( $table, $keyvalue, $type = 'mysql' )
    public function Export($table, $keyvalue, $type = 'mysql')
    {
        if ($type == 'mysql' && $this->_explort_db === null) {
            $this->_explort_db = new DbMySQL();
        }
        if ($type == 'mysqli' && $this->_explort_db === null) {
            $this->_explort_db = new DbMySQLi();
        }
        if ($type == 'pdo_mysql' && $this->_explort_db === null) {
            $this->_explort_db = new Dbpdo_MySQL();
        }
        if ($type == 'sqlite' && $this->_explort_db === null) {
            $this->_explort_db = new DbSQLite();
        }
        if ($type == 'sqlite3' && $this->_explort_db === null) {
            $this->_explort_db = new DbSQLite3();
        }
        if ($type == 'pdo_sqlite' && $this->_explort_db === null) {
            $this->_explort_db = new Dbpdo_SQLite();
        }
        if ($this->_explort_db === null) {
            $this->_explort_db = new DbMySQL();
        }
        $sql = "INSERT INTO {$table} ";
        $sql .= '(';
        $comma = '';
        foreach ($keyvalue as $k => $v) {
            if (is_null($v)) {
                continue;
            }
            $sql .= $comma . "{$k}";
            $comma = ',';
        }
        $sql .= ')VALUES(';
        $comma = '';
        foreach ($keyvalue as $k => $v) {
            if (is_null($v)) {
                continue;
            }
            $v = $this->_explort_db->EscapeString($v);
            $sql .= $comma . "'{$v}'";
            $comma = ',';
        }
        $sql .= ')';
        return $sql . ";\r\n";
    }