developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #1389: mssqlpdo.diff

File mssqlpdo.diff, 1.2 KB (added by vincenth, 9 years ago)
  • lib/jelix/db/jDbPDOConnection.class.php

    diff -r e053b61ed7a6 lib/jelix/db/jDbPDOConnection.class.php
    a b  
    33* @package    jelix
    44* @subpackage db
    55* @author     Laurent Jouanneau
    6 * @contributor Gwendal Jouannic, Thomas, Julien Issler
     6* @contributor Gwendal Jouannic, Thomas, Julien Issler, Vincent Herr
    77* @copyright  2005-2010 Laurent Jouanneau
    88* @copyright  2008 Gwendal Jouannic, 2009 Thomas
    99* @copyright  2009 Julien Issler
     10* @copyright  2011 Vincent Herr
    1011* @link      http://www.jelix.org
    1112* @licence  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
    1213*/
     
    281282        return $this->_tools;
    282283    }
    283284
     285    /**
     286     * Get the ID of the last inserted row
     287     * Mssql pdo driver does not support this feature.
     288     * so, we use a custom query
     289     * @return string
     290     */
     291    public function lastInsertId() {
     292        if ($this->dbms == 'mssql') {
     293            $res = $this->query('SELECT SCOPE_IDENTITY()');
     294            return (int) $res->fetchColumn();
     295        }
     296
     297        return parent::lastInsertId();
     298    }
     299
    284300}