public static function insert($sqlstatement, array $data = [])
    {
        static::verifyConnection();

        if (!preg_match(
            "/^insert\s+into\s+[\w\d_-`]+\s?(\(.+\))?\s+(values\s?(\(.+\),?)+|\s?set\s+(.+)+);?$/i",
            $sqlstatement
        )) {
            throw new DatabaseException(
                'Syntax Error on the Request',
                E_USER_ERROR
            );
        }

        if (empty($data)) {
            $pdoStement = static::$adapter->getConnection()->prepare($sqlstatement);

            $pdoStement->execute();

            return $pdoStement->rowCount();
        }

        $collector = [];
        
        $r = 0;

        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $r += static::executePrepareQuery($sqlstatement, $value);

                continue;
            }

            $collector[$key] = $value;
        }

        if (!empty($collector)) {
            return static::executePrepareQuery($sqlstatement, $collector);
        }

        return $r;
    }
public static function insert($sqlstatement, array $data = [])
    {
        static::verifyConnection();

        if (!preg_match(
            "/^insert\s+into\s+[\w\d_-`]+\s?(\(.+\))?\s+(values\s?(\(.+\),?)+|\s?set\s+(.+)+);?$/i",
            $sqlstatement
        )) {
            throw new DatabaseException(
                'Syntax Error on the Request',
                E_USER_ERROR
            );
        }

        if (empty($data)) {
            $pdoStement = static::$adapter->getConnection()->prepare($sqlstatement);

            $pdoStement->execute();

            return $pdoStement->rowCount();
        }

        $collector = [];
        
        $r = 0;

        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $r += static::executePrepareQuery($sqlstatement, $value);

                continue;
            }

            $collector[$key] = $value;
        }

        if (!empty($collector)) {
            return static::executePrepareQuery($sqlstatement, $collector);
        }

        return $r;
    }
public static function insert ( $ sqlstatement , array $ data = [ ] ) { static :: verifyConnection ( ) ; if ( ! preg_match ( "/^insert\s+into\s+[\w\d_-`]+\s?(\(.+\))?\s+(values\s?(\(.+\),?)+|\s?set\s+(.+)+);?$/i" , $ sqlstatement ) ) { throw new DatabaseException ( 'Syntax Error on the Request' , E_USER_ERROR ) ; } if ( empty ( $ data ) ) { $ pdoStement = static :: $ adapter -> getConnection ( ) -> prepare ( $ sqlstatement ) ; $ pdoStement -> execute ( ) ; return $ pdoStement -> rowCount ( ) ; } $ collector = [ ] ; $ r = 0 ; foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ r += static :: executePrepareQuery ( $ sqlstatement , $ value ) ; continue ; } $ collector [ $ key ] = $ value ; } if ( ! empty ( $ collector ) ) { return static :: executePrepareQuery ( $ sqlstatement , $ collector ) ; } return $ r ; }
Execute an insert query

@param  $sqlstatement
@param  array        $data
@return null
Execute an insert query