当前位置: 首页>>代码示例>>PHP>>正文


PHP sqlsrv_next_result函数代码示例

本文整理汇总了PHP中sqlsrv_next_result函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlsrv_next_result函数的具体用法?PHP sqlsrv_next_result怎么用?PHP sqlsrv_next_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sqlsrv_next_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insertarBD

 public function insertarBD()
 {
     $sqlA = 'INSERT INTO [usuarios] ([nombreUsuario], [password], [nombre], [apellidoPaterno], 
             [apellidoMaterno], [correo], [idCatTipoUsuario]';
     $sqlB = 'VALUES (\'' . trim($this->nombreUsuario) . '\', \'' . md5(trim($this->password)) . '\', \'' . $this->nombre . '\', \'' . $this->apellidoPaterno . '\', \'' . $this->apellidoMaterno . '\', \'' . $this->correo . '\', \'' . $this->idCatTipoUsuario . '\' ';
     if ($this->idCatEstado != '' && !is_null($this->idCatEstado)) {
         $sqlA .= ', [idCatEstado]';
         $sqlB .= ', \'' . $this->idCatEstado . '\'';
     }
     if ($this->idCatJurisdiccion != '' && !is_null($this->idCatJurisdiccion)) {
         $sqlA .= ', [idCatJurisdiccion]';
         $sqlB .= ', \'' . $this->idCatJurisdiccion . '\'';
     }
     if ($this->habilitado != '' && !is_null($this->habilitado)) {
         $sqlA .= ', [habilitado]';
         $sqlB .= ', \'' . $this->habilitado . '\'';
     }
     $sqlA .= ') ' . $sqlB . '); SELECT @@Identity AS nuevoId;';
     $consulta = ejecutaQueryClases($sqlA);
     if (is_string($consulta)) {
         $this->error = true;
         $this->msgError = $consulta . ' SQL:' . $sqlA;
     } else {
         sqlsrv_next_result($consulta);
         $tabla = devuelveRowAssoc($consulta);
         $this->idUsuario = $tabla['nuevoId'];
     }
 }
开发者ID:p4scu41,项目名称:sail,代码行数:28,代码来源:Usuario.php

示例2: query

 public function query($sql)
 {
     LogMaster::log($sql);
     if ($this->start_from) {
         $res = sqlsrv_query($this->connection, $sql, array(), array("Scrollable" => SQLSRV_CURSOR_STATIC));
     } else {
         $res = sqlsrv_query($this->connection, $sql);
     }
     if ($res === false) {
         $errors = sqlsrv_errors();
         $message = array();
         foreach ($errors as $error) {
             $message[] = $error["SQLSTATE"] . $error["code"] . $error["message"];
         }
         throw new Exception("SQLSrv operation failed\n" . implode("\n\n", $message));
     }
     if ($this->insert_operation) {
         sqlsrv_next_result($res);
         $last = sqlsrv_fetch_array($res);
         $this->last_id = $last["dhx_id"];
         sqlsrv_free_stmt($res);
     }
     if ($this->start_from) {
         $data = sqlsrv_fetch($res, SQLSRV_SCROLL_ABSOLUTE, $this->start_from - 1);
     }
     return $res;
 }
开发者ID:rokkit,项目名称:temp,代码行数:27,代码来源:db_sqlsrv.php

示例3: insertarBD

 public function insertarBD()
 {
     $sqlA = "INSERT INTO [control] ([idDiagnostico], [fecha]";
     $sqlB = "VALUES (" . $this->idDiagnostico . " , '" . formatFechaObj($this->fecha, 'Y-m-d') . "'";
     if ($this->reingreso != '' && !is_null($this->reingreso)) {
         $sqlA .= ", [reingreso]";
         $sqlB .= ", " . $this->reingreso;
     }
     if ($this->idCatEstadoPaciente != '' && !is_null($this->idCatEstadoPaciente)) {
         $sqlA .= ", [idCatEstadoPaciente]";
         $sqlB .= ", " . $this->idCatEstadoPaciente;
     }
     if ($this->idCatTratamientoPreescrito != '' && !is_null($this->idCatTratamientoPreescrito)) {
         $sqlA .= ", [idCatTratamientoPreescrito]";
         $sqlB .= ", " . $this->idCatTratamientoPreescrito;
     }
     if ($this->vigilanciaPostratamiento != '' && !is_null($this->vigilanciaPostratamiento)) {
         $sqlA .= ", [vigilanciaPostratamiento]";
         $sqlB .= ", " . $this->vigilanciaPostratamiento;
     }
     if ($this->observaciones != '' && !is_null($this->observaciones)) {
         $sqlA .= ", [observaciones]";
         $sqlB .= ", '" . $this->observaciones . "'";
     }
     if ($this->idCatEvolucionClinica != '' && !is_null($this->idCatEvolucionClinica)) {
         $sqlA .= ", [idCatEvolucionClinica]";
         $sqlB .= ", '" . $this->idCatEvolucionClinica . "'";
     }
     if ($this->idCatBaja != '' && !is_null($this->idCatBaja)) {
         $sqlA .= ", [idCatBaja]";
         $sqlB .= ", '" . $this->idCatBaja . "'";
     }
     if ($this->seed != '' && !is_null($this->seed)) {
         $sqlA .= ", [seed]";
         $sqlB .= ", '" . $this->seed . "'";
     }
     $sqlA .= ") " . $sqlB . "); SELECT @@Identity AS nuevoId;";
     $consulta = ejecutaQueryClases($sqlA);
     if (is_string($consulta)) {
         $this->error = true;
         $this->msgError = $consulta . " SQL:" . $sqlA;
     } else {
         sqlsrv_next_result($consulta);
         $tabla = devuelveRowAssoc($consulta);
         $this->idControl = $tabla["nuevoId"];
     }
     // Revisar, actualiza el Estado del paciente (Diagnostico) al reguistrar un nuevo control
     $sql = "";
     if ($this->idCatEstadoPaciente != '' && !is_null($this->idCatEstadoPaciente)) {
         $sql .= "UPDATE diagnostico SET idCatEstadoPaciente = " . $this->idCatEstadoPaciente . " WHERE idDiagnostico = " . $this->idDiagnostico . ";";
     }
     if ($this->idCatTratamientoPreescrito != '' && !is_null($this->idCatTratamientoPreescrito)) {
         $sql .= "UPDATE diagnostico SET idCatTratamiento = " . $this->idCatTratamientoPreescrito . " WHERE idDiagnostico = " . $this->idDiagnostico . ";";
     }
     $consulta = ejecutaQueryClases($sql);
     if (is_string($consulta)) {
         $this->error = true;
         $this->msgError = $consulta . " No se pudo actualizar el estado del paciente en la tabla Diagnostico SQL:" . $sqlA;
     }
 }
开发者ID:p4scu41,项目名称:sail,代码行数:60,代码来源:Control.php

示例4: createImage

 /**
  * Erstellt ein Bild in der Datenbank
  * @param int $idLocation
  * @return mixed
  */
 public function createImage(int $idLocation)
 {
     $query = 'INSERT INTO image (fk_location) VALUES(?);SELECT SCOPE_IDENTITY() as ID';
     $stmt = sqlsrv_query(Database::getConnection(), $query, array($idLocation));
     if (sqlsrv_errors()) {
         http_response_code(500);
     }
     sqlsrv_next_result($stmt);
     $stmt = sqlsrv_fetch_array($stmt);
     return $stmt['ID'];
 }
开发者ID:PascalHonegger,项目名称:M151,代码行数:16,代码来源:ImageModel.php

示例5: createEvent

 /**
  * Erstellt einen Event und gib die ID dessen zurück
  * @param int $idcreator
  * @param string $name
  * @param string $description
  * @param int $location
  * @return mixed
  */
 public function createEvent(int $idcreator, string $name, string $description, int $location)
 {
     $query = 'INSERT INTO event(fk_person_creator,fk_location,name,description) VALUES (?,?,?,?);SELECT SCOPE_IDENTITY() as ID';
     $stmt = sqlsrv_query(Database::getConnection(), $query, array($idcreator, $location, $name, $description));
     if (sqlsrv_errors()) {
         http_response_code(500);
     }
     //Select next Result (SCOPE_IDENTITY)
     sqlsrv_next_result($stmt);
     $stmt = sqlsrv_fetch_array($stmt);
     return $stmt['ID'];
 }
开发者ID:PascalHonegger,项目名称:M151,代码行数:20,代码来源:EventModel.php

示例6: insertarBD

 public function insertarBD()
 {
     // OJO, ponendo estado como NUEVA (dada la inicializacion)
     $sql = "INSERT INTO [incidencia] ([idUsuario], [idCatEstadoIncidencia], [contenido]) VALUES (" . $_SESSION[ID_USR_SESSION] . ", " . (int) $_SESSION[EDO_USR_SESSION] . " , '" . $this->contenido . "'); SELECT @@identity AS nuevoId;";
     $consulta = ejecutaQueryClases($sql);
     if (is_string($consulta)) {
         $this->error = true;
         $this->msgError = $consulta . " SQL:" . $sql;
     } else {
         sqlsrv_next_result($consulta);
         $tabla = devuelveRowAssoc($consulta);
         $this->fechaCaptura = date("Y-m-d H:i:s");
         $this->idIncidencia = $tabla["nuevoId"];
     }
 }
开发者ID:p4scu41,项目名称:sail,代码行数:15,代码来源:Incidencia.php

示例7: insertarBD

 public function insertarBD()
 {
     $sql = "INSERT INTO [diagramaDermatologico] ([idDiagnostico], [idCatTipoLesion], [x], [y], [w], [h], [idPaciente]) VALUES (";
     $sql .= (int) $this->idDiagnostico . " ," . $this->idCatTipoLesion . " ," . $this->x . " ," . $this->y . " ," . $this->w . " ," . $this->h . "," . (int) $this->idPaciente . ");";
     $sql .= "SELECT @@Identity AS nuevoId";
     $consulta = ejecutaQueryClases($sql);
     if (is_string($consulta)) {
         $this->error = true;
         $this->msgError = $consulta . " SQL:" . $sqlA;
     } else {
         sqlsrv_next_result($consulta);
         $tabla = devuelveRowAssoc($consulta);
         $this->idLesion = $tabla["nuevoId"];
     }
 }
开发者ID:p4scu41,项目名称:sail,代码行数:15,代码来源:DiagramaDermatologico.php

示例8: insertarBD

 public function insertarBD()
 {
     $sql = "INSERT INTO [casosRelacionados] ([idDiagnostico], [Nombre], [idCatParentesco], [idCatSituacionCasoRelacionado], \n                [tiempoConvivenciaMeses], [tiempoConvivenciaAnos]) ";
     $sql .= "VALUES (" . $this->idDiagnostico . ", '" . $this->nombre . "' ," . $this->idCatParentesco . " ," . $this->idCatSituacionCasoRelacionado . " ," . (int) $this->tiempoConvivenciaMeses . " ," . (int) $this->tiempoConvivenciaAnos . ");";
     $sql .= "SELECT @@Identity AS nuevoId";
     $consulta = ejecutaQueryClases($sql);
     if (is_string($consulta)) {
         $this->error = true;
         $this->msgError = $consulta . " SQL:" . $sqlA;
         return false;
     } else {
         sqlsrv_next_result($consulta);
         $tabla = devuelveRowAssoc($consulta);
         $this->idCasoRelacionado = $tabla["nuevoId"];
     }
     return true;
 }
开发者ID:p4scu41,项目名称:sail,代码行数:17,代码来源:CasoRelacionado.php

示例9: callStoredProcedure

function callStoredProcedure($conn, $spName, $spParams)
{
    // Count total array parameters
    $ttlParams = count($spParams);
    // define string
    $spData = '';
    // Build string Component
    for ($i = 0; $i <= $ttlParams - 1; $i++) {
        // if string value is not null, add a placeholder as [?]
        if ($spParams[$i][0] != 'null') {
            $spData[$i] = '?';
        } else {
            if ($spParams[$i][0] == 'null') {
                // insert blank array space holder
                $spData[$i] = '';
                // delete the array entry from the spParams
                unset($spParams[$i]);
            }
        }
    }
    // Turn array into comma delimited string
    $spComponent = implode(', ', $spData);
    // Build Stored Procedure Call
    $sp = "{ call {$spName}({$spComponent}) }";
    // Call the Stored Procedure
    $result = sqlsrv_query($conn, $sp, $spParams);
    // if there is a result, Makes the next result of the specified statement active
    // @TODO Probably should move this to a different function as this is specialized for WYTOBACCO
    if ($next_result = sqlsrv_next_result($result)) {
        while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
            // Get the ID and Report Name.
            $result = array("success" => TRUE, "report_name" => $row['report_name'], "report_id" => $row['report_id']);
            return $result;
        }
    } elseif (is_null($next_result)) {
        // no result return to script
        return;
    } else {
        // Return whatever sql serv error there was
        $result = array("success" => FALSE, "errors" => sqlsrv_errors());
        return $result;
    }
}
开发者ID:WYSAC,项目名称:wy-tobacco-v2,代码行数:43,代码来源:processReportUpload.php

示例10: query

 public function query($sql)
 {
     LogMaster::log($sql);
     if ($this->start_from) {
         $res = sqlsrv_query($this->connection, $sql, array(), array("Scrollable" => SQLSRV_CURSOR_STATIC));
     } else {
         $res = sqlsrv_query($this->connection, $sql);
     }
     if ($this->insert_operation) {
         sqlsrv_next_result($res);
         $last = sqlsrv_fetch_array($res);
         $this->last_id = $last["dhx_id"];
         sqlsrv_free_stmt($res);
     }
     if ($this->start_from) {
         $data = sqlsrv_fetch($res, SQLSRV_SCROLL_ABSOLUTE, $this->start_from - 1);
     }
     return $res;
 }
开发者ID:mudassartufail,项目名称:dhtmlx,代码行数:19,代码来源:db_sqlsrv.php

示例11: query

 public static function query($queryStr = '', $objectStr = '')
 {
     $queryDB = sqlsrv_query(self::$dbConnect, $queryStr);
     if (preg_match('/insert into/i', $queryDB)) {
         sqlsrv_next_result($queryDB);
         sqlsrv_fetch($queryDB);
         self::$insertID = sqlsrv_get_field($queryDB, 0);
     }
     if ($queryDB) {
         if (is_object($objectStr)) {
             $objectStr($queryDB);
         }
         //            sqlsrv_free_stmt($queryDB);
         return $queryDB;
     } else {
         self::$error = sqlsrv_errors();
         return false;
     }
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:19,代码来源:DatabaseSqlserver.php

示例12: insertarBD

 public function insertarBD()
 {
     $sqlA = "INSERT INTO [contactos] ([idDiagnostico], [nombre], [sexo], [edad], [idCatParentesco]";
     $sqlB = "VALUES (" . $this->idDiagnostico . ", '" . $this->nombre . "', '" . $this->sexo . "', " . (int) $this->edad . ", " . $this->idCatParentesco;
     if ($this->tiempoConvivenciaAnos != '' && !is_null($this->tiempoConvivenciaAnos)) {
         $sqlA .= ", [tiempoConvivenciaAnos]";
         $sqlB .= ", " . (int) $this->tiempoConvivenciaAnos;
     }
     if ($this->tiempoConvivenciaMeses != '' && !is_null($this->tiempoConvivenciaMeses)) {
         $sqlA .= ", [tiempoConvivenciaMeses]";
         $sqlB .= ", " . (int) $this->tiempoConvivenciaMeses;
     }
     $sqlA .= ") " . $sqlB . "); SELECT @@Identity AS nuevoId;";
     $consulta = ejecutaQueryClases($sqlA);
     if (is_string($consulta)) {
         $this->error = true;
         $this->msgError = $consulta . " SQL:" . $sqlA;
     } else {
         sqlsrv_next_result($consulta);
         $tabla = devuelveRowAssoc($consulta);
         $this->idContacto = $tabla["nuevoId"];
     }
 }
开发者ID:p4scu41,项目名称:sail,代码行数:23,代码来源:Contacto.php

示例13: sp_execute_multi

/**
 * 执行存储过程,多结果集
 * @param $sql
 * @param $params
 * @return array
 */
function sp_execute_multi($sql, $params)
{
    $conn = get_sqlsrv_conn();
    if ($conn === false) {
        die(print_r(sqlsrv_errors(), true));
    }
    $stmt = sqlsrv_query($conn, $sql, $params);
    if ($stmt === false) {
        die(print_r(sqlsrv_errors(), true));
    }
    //
    $rss = array();
    do {
        $rs = array();
        while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
            array_push($rs, $row);
        }
        array_push($rss, $rs);
    } while (sqlsrv_next_result($stmt));
    sqlsrv_free_stmt($stmt);
    free_sqlsrv_conn($conn);
    return $rss;
}
开发者ID:noikiy,项目名称:Bentley,代码行数:29,代码来源:conn.php

示例14: insert

 /**
  * Fügt einen neuen User der Person hinzu.
  * @param string $username
  * @param string $password
  * @param string $surname
  * @param string $name
  * @param string $mail
  * @return array|false|null
  */
 public function insert(string $username, string $password, string $surname, string $name, string $mail)
 {
     $loginModel = new LoginModel();
     $user = $loginModel->load($username);
     //User already exists
     if ($user != null) {
         return false;
     }
     $connection = Database::getConnection();
     $hashedPassword = password_hash($password, PASSWORD_BCRYPT);
     $query = "INSERT INTO person(username, password, surname, name, mail) VALUES(?, ?, ?, ?, ?); SELECT SCOPE_IDENTITY() as ID;";
     //Execute Query
     $stmt = sqlsrv_query($connection, $query, array($username, $hashedPassword, $surname, $name, $mail));
     if (sqlsrv_errors()) {
         http_response_code(500);
     }
     //Select next Result (SCOPE_IDENTITY)
     sqlsrv_next_result($stmt);
     $res = sqlsrv_fetch_array($stmt);
     //Load inserted Row
     $query = 'SELECT * FROM person WHERE id_person = ' . $res['ID'];
     $stmt = sqlsrv_query($connection, $query);
     return sqlsrv_fetch_array($stmt);
 }
开发者ID:PascalHonegger,项目名称:M151,代码行数:33,代码来源:RegisterModel.php

示例15: nextResult

 /**
  * Move the internal result pointer to the next available result
  *
  * @return true on success, false if there is no more result set or an error object on failure
  * @access public
  */
 function nextResult()
 {
     if (false === $this->result) {
         return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__);
     }
     if (null === $this->result) {
         return false;
     }
     $ret = sqlsrv_next_result($this->result);
     if ($ret) {
         $this->cursor = 0;
         $this->rows = array();
         $this->numFields = sqlsrv_num_fields($this->result);
         $this->fieldMeta = sqlsrv_field_metadata($this->result);
         $this->numRowsAffected = sqlsrv_rows_affected($this->result);
         while ($row = sqlsrv_fetch_array($this->result, SQLSRV_FETCH_ASSOC)) {
             if ($row !== null) {
                 if ($this->offset && $this->offset_count < $this->offset) {
                     $this->offset_count++;
                     continue;
                 }
                 foreach ($row as $k => $v) {
                     if (is_object($v) && method_exists($v, 'format')) {
                         //DateTime Object
                         //$v->setTimezone(new DateTimeZone('GMT'));//TS_ISO_8601 with a trailing 'Z' is GMT
                         $row[$k] = $v->format("Y-m-d H:i:s");
                     }
                 }
                 $this->rows[] = $row;
                 //read results into memory, cursors are not supported
             }
         }
         $this->rowcnt = count($this->rows);
     }
     return $ret;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:42,代码来源:sqlsrv.php


注:本文中的sqlsrv_next_result函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。