/** * INSERT SELECT wrapper * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...) * Source items may be literals rather than field names, but strings should be quoted with Database::addQuotes() * $conds may be "*" to copy the whole table * srcTable may be an array of tables. */ function insertSelect($destTable, $srcTable, $varMap, $conds, $fname = 'DatabaseMssql::insertSelect', $insertOptions = array(), $selectOptions = array()) { $ret = parent::insertSelect($destTable, $srcTable, $varMap, $conds, $fname, $insertOptions, $selectOptions); if ($ret === false) { throw new DBQueryError($this, $this->getErrors(), $this->lastErrno(), '', $fname); } elseif ($ret != NULL) { // remember number of rows affected $this->mAffectedRows = sqlsrv_rows_affected($ret); return $ret; } return NULL; }
/** * INSERT SELECT wrapper * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...) * Source items may be literals rather than field names, but strings should * be quoted with Database::addQuotes(). * @param string $destTable * @param array|string $srcTable May be an array of tables. * @param array $varMap * @param array $conds May be "*" to copy the whole table. * @param string $fname * @param array $insertOptions * @param array $selectOptions * @throws DBQueryError * @return null|ResultWrapper */ public function insertSelect($destTable, $srcTable, $varMap, $conds, $fname = __METHOD__, $insertOptions = array(), $selectOptions = array()) { $this->mScrollableCursor = false; try { $ret = parent::insertSelect($destTable, $srcTable, $varMap, $conds, $fname, $insertOptions, $selectOptions); } catch (Exception $e) { $this->mScrollableCursor = true; throw $e; } $this->mScrollableCursor = true; return $ret; }
/** * INSERT SELECT wrapper * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...) * Source items may be literals rather than field names, but strings should be quoted with Database::addQuotes() * $conds may be "*" to copy the whole table * srcTable may be an array of tables. * @param string $destTable * @param array|string $srcTable * @param array $varMap * @param array $conds * @param string $fname * @param array $insertOptions * @param array $selectOptions * @throws DBQueryError * @return null|ResultWrapper */ function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = __METHOD__, $insertOptions = array(), $selectOptions = array() ) { $ret = parent::insertSelect( $destTable, $srcTable, $varMap, $conds, $fname, $insertOptions, $selectOptions ); if ( $ret === false ) { throw new DBQueryError( $this, $this->getErrors(), $this->lastErrno(), /*$sql*/ '', $fname ); } elseif ( $ret != null ) { // remember number of rows affected $this->mAffectedRows = sqlsrv_rows_affected( $ret ); return $ret; } return null; }