Home >Backend Development >PHP Tutorial >thinkphp如何获得sequence的值?

thinkphp如何获得sequence的值?

WBOY
WBOYOriginal
2016-06-23 14:17:211089browse

用的oracle数据库,有个sequence名为aid,在插入数据的时候需要先获得aid.nextval,然后再拼接若干字母,作为字段值插入。本来在数据库中可以“select aid.nextval from dual”,那么用thinkphp的话,要如何获得?thinkphp这块比较菜,请具体点说,谢谢大仙们了 ~~


回复讨论(解决方案)

tp 无聊的绕了一个圈子,最后还是执行到了这里

    /**     +----------------------------------------------------------     * SQL查询     +----------------------------------------------------------     * @access public     +----------------------------------------------------------     * @param mixed $sql  SQL指令     * @param boolean $parse  是否需要解析SQL     +----------------------------------------------------------     * @return mixed     +----------------------------------------------------------     */    public function query($sql,$parse=false) {        $sql  =   $this->parseSql($sql,$parse);        return $this->db->query($sql);    }

tp 无聊的绕了一个圈子,最后还是执行到了这里

    /**     +----------------------------------------------------------     * SQL查询     +----------------------------------------------------------     * @access public     +----------------------------------------------------------     * @param mixed $sql  SQL指令     * @param boolean $parse  是否需要解析SQL     +----------------------------------------------------------     * @return mixed     +----------------------------------------------------------     */    public function query($sql,$parse=false) {        $sql  =   $this->parseSql($sql,$parse);        return $this->db->query($sql);    }


谢谢~

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn