/** @var int The number of rows affected as an integer */
protected $mAffectedRows;
- /** @var int */
- private $mInsertId = null;
-
/** @var bool */
private $ignoreDupValOnIndex = false;
function __destruct() {
if ( $this->mOpened ) {
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$this->close();
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
}
}
$session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : OCI_DEFAULT;
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
if ( $this->mFlags & DBO_PERSISTENT ) {
$this->mConn = oci_pconnect(
$this->mUser,
$session_mode
);
}
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( $this->mUser != $this->mDBname ) {
// change current schema in session
$explain_count
);
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$this->mLastResult = $stmt = oci_parse( $this->mConn, $sql );
if ( $stmt === false ) {
}
}
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( $explain_count > 0 ) {
return $this->doQuery( 'SELECT id, cardinality "ROWS" FROM plan_table ' .
return oci_field_name( $stmt, $n );
}
- /**
- * This must be called after nextSequenceVal
- * @return null|int
- */
function insertId() {
- return $this->mInsertId;
+ $res = $this->query( "SELECT lastval_pkg.getLastval FROM dual" );
+ $row = $this->fetchRow( $res );
+ return is_null( $row[0] ) ? null : (int)$row[0];
}
/**
return $e['code'];
}
- function affectedRows() {
+ protected function fetchAffectedRowCount() {
return $this->mAffectedRows;
}
}
}
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
$e = oci_error( $stmt );
$this->mAffectedRows = oci_num_rows( $stmt );
}
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( isset( $lob ) ) {
foreach ( $lob as $lob_v ) {
return preg_replace( '/.*\.(.*)/', '$1', $name );
}
- /**
- * Return the next in a sequence, save the value for retrieval via insertId()
- *
- * @param string $seqName
- * @return null|int
- */
- function nextSequenceValue( $seqName ) {
- $res = $this->query( "SELECT $seqName.nextval FROM dual" );
- $row = $this->fetchRow( $res );
- $this->mInsertId = $row[0];
-
- return $this->mInsertId;
- }
-
/**
* Return sequence_name if table has a sequence
*
}
$sql = 'ALTER SESSION SET CURRENT_SCHEMA=' . strtoupper( $db );
$stmt = oci_parse( $this->mConn, $sql );
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$success = oci_execute( $stmt );
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( !$success ) {
$e = oci_error( $stmt );
if ( $e['code'] != '1435' ) {
}
}
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
$e = oci_error( $stmt );
$this->mAffectedRows = oci_num_rows( $stmt );
}
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( isset( $lob ) ) {
foreach ( $lob as $lob_v ) {