protected function public__insert($table_name, array $data_to_insert)
    {
        $pdo = $this->getPDOInstance();
        \ksort($data_to_insert);
        $fieldNames = \implode('`, `', \array_keys($data_to_insert));
        $fieldValues = ':' . \implode(', :', \array_keys($data_to_insert));
        $sqlQuery = "INSERT INTO " . $this->quoteTableName($this->getPrefixedTableName($table_name)) . " (`$fieldNames`) VALUES ($fieldValues)";
        $sth = $pdo->prepare($sqlQuery);
        foreach ($data_to_insert as $key => $value)
        {
            $sth->bindValue(":$key", $value, $this->getPdoType(\gettype($value)));
        }
        $sth->execute();
        return $this->setLastInsertId($pdo->lastInsertId())->getLastInsertId();
    }
protected function public__insert($table_name, array $data_to_insert)
    {
        $pdo = $this->getPDOInstance();
        \ksort($data_to_insert);
        $fieldNames = \implode('`, `', \array_keys($data_to_insert));
        $fieldValues = ':' . \implode(', :', \array_keys($data_to_insert));
        $sqlQuery = "INSERT INTO " . $this->quoteTableName($this->getPrefixedTableName($table_name)) . " (`$fieldNames`) VALUES ($fieldValues)";
        $sth = $pdo->prepare($sqlQuery);
        foreach ($data_to_insert as $key => $value)
        {
            $sth->bindValue(":$key", $value, $this->getPdoType(\gettype($value)));
        }
        $sth->execute();
        return $this->setLastInsertId($pdo->lastInsertId())->getLastInsertId();
    }
protected function public__insert ( $ table_name , array $ data_to_insert ) { $ pdo = $ this -> getPDOInstance ( ) ; \ ksort ( $ data_to_insert ) ; $ fieldNames = \ implode ( '`, `' , \ array_keys ( $ data_to_insert ) ) ; $ fieldValues = ':' . \ implode ( ', :' , \ array_keys ( $ data_to_insert ) ) ; $ sqlQuery = "INSERT INTO " . $ this -> quoteTableName ( $ this -> getPrefixedTableName ( $ table_name ) ) . " (`$fieldNames`) VALUES ($fieldValues)" ; $ sth = $ pdo -> prepare ( $ sqlQuery ) ; foreach ( $ data_to_insert as $ key => $ value ) { $ sth -> bindValue ( ":$key" , $ value , $ this -> getPdoType ( \ gettype ( $ value ) ) ) ; } $ sth -> execute ( ) ; return $ this -> setLastInsertId ( $ pdo -> lastInsertId ( ) ) -> getLastInsertId ( ) ; }
insert one record into a table

@param string $table_name A name of table to insert into
@param array $data_to_insert An associative array:
[
'tableColumnName1' => 'value',
'tableColumnName2' => 'value',
'tableColumnNameN' => 'value',
]
@return integer Returns the id of the inserted row
insert one record into a table