db/SqlExecutor.php
/**
     * A special function, for get postgresql sequence
     * @param string $sequenceName
     * @return integer
     */
A special function, for get postgresql sequence
@param string $sequenceName
@return integer
A special function for get postgresql sequence @param string $sequenceName @return integer
public function nextSequenceValue($sequenceName) {
        return $this->wrapExecuteSql(
            function () use($sequenceName) {
                $sql = "SELECT nextval('$sequenceName')";
                $stmt = $this->prepareSql($sql);
                try {
                    if (! $stmt->execute()) {
                        throw new \Exception('Execute SQL fail with no message');
                    }
                } catch (\Exception $e) {
                    if ($this->_sql_logger) {
                        call_user_func($this->_sql_logger, $e->getMessage(), $this->_sql_log_trid);
                    }
                    throw $e;
                }
                $id = $stmt->fetchColumn();
                if ($id) {
                    return $id;
                }
                throw new \UnexpectedValueException('Get invalid sequence ID.');
            });
    }
public function nextSequenceValue ( $ sequenceName ) { return $ this -> wrapExecuteSql ( function ( ) use ( $ sequenceName ) { $ sql = " SELECT nextval(' $ sequenceName ') " ; $ stmt = $ this -> prepareSql ( $ sql ) ; try { if ( ! $ stmt -> execute ( ) ) { throw new \ Exception ( 'Execute SQL fail with no message' ) ; } } catch ( \ Exception $ e ) { if ( $ this -> _sql_logger ) { call_user_func ( $ this -> _sql_logger , $ e -> getMessage ( ) , $ this -> _sql_log_trid ) ; } throw $ e ; } $ id = $ stmt -> fetchColumn ( ) ; if ( $ id ) { return $ id ; } throw new \ UnexpectedValueException ( 'Get invalid sequence ID.' ) ; } ) ; }
A special function, for get postgresql sequence
 @param string $sequenceName
 @return integer
A special function for get postgresql sequence @param string $sequenceName @return integer