本文整理汇总了PHP中dataBaseClass::getCnx方法的典型用法代码示例。如果您正苦于以下问题:PHP dataBaseClass::getCnx方法的具体用法?PHP dataBaseClass::getCnx怎么用?PHP dataBaseClass::getCnx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataBaseClass
的用法示例。
在下文中一共展示了dataBaseClass::getCnx方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateTid
public static function updateTid($id, $data)
{
try {
$sql = "UPDATE tipo_id SET ";
foreach ($data as $key => $value) {
$sql = $sql . " " . $key . " = '" . $value . "', ";
}
$newLeng = strlen($sql) - 2;
$sql = substr($sql, 0, $newLeng);
$sql = $sql . " WHERE cod_tip_id = " . $id;
dataBaseClass::getCnx()->beginTransaction();
$rsp = dataBaseClass::getCnx()->exec($sql);
dataBaseClass::getCnx()->commit();
if ($rsp !== false) {
$rsp = true;
} else {
throw new PDOException("El tipo de Identificacion {$id} no ha podido ser actualizado");
}
return $rsp;
} catch (PDOException $e) {
DataBaseClass::getCnx()->rollBack();
return $e;
}
}
示例2: updateMatricula
/**
*
* @param type $id
* @param type $data
* @return boolean|\PDOException
* @throws PDOException
*/
public static function updateMatricula($id, $data)
{
try {
$sql = "UPDATE matricula SET ";
foreach ($data as $key => $value) {
$sql = $sql . " " . $key . " = '" . $value . "', ";
}
$newLeng = strlen($sql) - 2;
$sql = substr($sql, 0, $newLeng);
$sql = $sql . " WHERE num_ficha = " . $id;
dataBaseClass::getCnx()->beginTransaction();
$rsp = dataBaseClass::getCnx()->exec($sql);
dataBaseClass::getCnx()->commit();
if ($rsp !== false) {
$rsp = true;
} else {
throw new PDOException("La Matricula no ha podido ser actualizado");
}
return $rsp;
} catch (PDOException $e) {
DataBaseClass::getCnx()->rollBack();
return $e;
}
}
示例3: deleteDepto
/**
*
* @param type $id
* @return boolean|\PDOException
* @throws PDOException
*/
public static function deleteDepto($id)
{
try {
$sql = "DELETE FROM depto WHERE cod_depto = " . $id;
dataBaseClass::getCnx()->beginTransaction();
$rsp = dataBaseClass::getCnx()->exec($sql);
dataBaseClass::getCnx()->commit();
if ($rsp !== false) {
$rsp = true;
} else {
throw new PDOException("El Departamento no ha podido ser eliminado", 2633);
}
return $rsp;
} catch (PDOException $e) {
dataBaseClass::getCnx()->rollback();
return $e;
}
}
示例4: deleteCredencial
/**
*
* @param type $id
* @return boolean|\PDOException
* @throws PDOException
*/
public static function deleteCredencial($id)
{
try {
$sql = "DELETE FROM usuario_credencial WHERE id = " . $id;
dataBaseClass::getCnx()->beginTransaction();
$rsp = dataBaseClass::getCnx()->exec($sql);
dataBaseClass::getCnx()->commit();
if ($rsp !== false) {
$rsp = true;
} else {
throw new PDOException("El usuario credencial no ha podido ser eliminado", 2633);
}
return $rsp;
} catch (PDOException $e) {
dataBaseClass::getCnx()->rollback();
return $e;
}
}
示例5: updateDatUser
public static function updateDatUser($id, $data)
{
try {
$sql = "UPDATE Datos_usuario SET ";
foreach ($data as $key => $value) {
$sql = $sql . " " . $key . " = '" . $value . "', ";
}
$newLeng = strlen($sql) - 2;
$sql = substr($sql, 0, $newLeng);
$sql = $sql . " WHERE id = " . $id;
dataBaseClass::getCnx()->beginTransaction();
$rsp = dataBaseClass::getCnx()->exec($sql);
dataBaseClass::getCnx()->commit();
if ($rsp !== false) {
$rsp = true;
} else {
throw new PDOException("Los Datos Del Usuario no han podido ser actualizado", 2632);
}
return $rsp;
} catch (PDOException $e) {
DataBaseClass::getCnx()->rollBack();
return $e;
}
}
示例6: deleteFicha
/**
*
* @param type $id
* @return boolean|\PDOException
* @throws PDOException
*/
public static function deleteFicha($id)
{
try {
$sql = "DELETE FROM ficha WHERE num_ficha = " . $id;
dataBaseClass::getCnx()->beginTransaction();
$rsp = dataBaseClass::getCnx()->exec($sql);
dataBaseClass::getCnx()->commit();
if ($rsp !== false) {
$rsp = true;
} else {
throw new PDOException("La ficha no ha podido ser eliminado", 2633);
}
return $rsp;
} catch (PDOException $e) {
dataBaseClass::getCnx()->rollback();
return $e;
}
}
示例7: deleteCausaDesercion
/**
*
* @param type $id
* @return boolean|\PDOException
* @throws PDOException
*/
public static function deleteCausaDesercion($id)
{
try {
$sql = "DELETE FROM causa_desercion WHERE cod_causa = " . $id;
dataBaseClass::getCnx()->beginTransaction();
$rsp = dataBaseClass::getCnx()->exec($sql);
dataBaseClass::getCnx()->commit();
if ($rsp !== false) {
$rsp = true;
} else {
throw new PDOException("La causa de desercion no ha podido ser ELIMINADA", 2633);
}
return $rsp;
} catch (PDOException $e) {
dataBaseClass::getCnx()->rollback();
return $e;
}
}