public function insert($ignore = false)
    {
        $this->validate();

        // Optional ignore string
        if ($ignore) {
            $insertString = "INSERT IGNORE INTO `%s` (%s) VALUES %s";
        } else {
            $insertString = "INSERT INTO `%s` (%s) VALUES %s";
        }

        $query = sprintf(
            $insertString,
            $this->table,
            $this->rowsString,
            $this->bindString
        );

        try {
            $this->db->execute($query, $this->valuesFlattened);
            return $this->db->affectedRows() > 0;
        } catch (PDOException $ex) {
            Di::getDefault()->get(Services::LOGGER)->error(
                'Could not perform bulk insert ' . $ex->getMessage() . '    TRACE: ' . $ex->getTraceAsString()
            );
            throw new BatchInsertException($ex->getMessage());
        }
    }
public function insert($ignore = false)
    {
        $this->validate();

        // Optional ignore string
        if ($ignore) {
            $insertString = "INSERT IGNORE INTO `%s` (%s) VALUES %s";
        } else {
            $insertString = "INSERT INTO `%s` (%s) VALUES %s";
        }

        $query = sprintf(
            $insertString,
            $this->table,
            $this->rowsString,
            $this->bindString
        );

        try {
            $this->db->execute($query, $this->valuesFlattened);
            return $this->db->affectedRows() > 0;
        } catch (PDOException $ex) {
            Di::getDefault()->get(Services::LOGGER)->error(
                'Could not perform bulk insert ' . $ex->getMessage() . '    TRACE: ' . $ex->getTraceAsString()
            );
            throw new BatchInsertException($ex->getMessage());
        }
    }
public function insert ( $ ignore = false ) { $ this -> validate ( ) ; // Optional ignore string if ( $ ignore ) { $ insertString = "INSERT IGNORE INTO `%s` (%s) VALUES %s" ; } else { $ insertString = "INSERT INTO `%s` (%s) VALUES %s" ; } $ query = sprintf ( $ insertString , $ this -> table , $ this -> rowsString , $ this -> bindString ) ; try { $ this -> db -> execute ( $ query , $ this -> valuesFlattened ) ; return $ this -> db -> affectedRows ( ) > 0 ; } catch ( PDOException $ ex ) { Di :: getDefault ( ) -> get ( Services :: LOGGER ) -> error ( 'Could not perform bulk insert ' . $ ex -> getMessage ( ) . '    TRACE: ' . $ ex -> getTraceAsString ( ) ) ; throw new BatchInsertException ( $ ex -> getMessage ( ) ) ; } }
Insert into the Database

@param boolean $ignore Use an INSERT IGNORE (Default: false)
@return bool|int
@throws BatchInsertException
Insert into the Database