當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Db::close方法代碼示例

本文整理匯總了PHP中Db::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP Db::close方法的具體用法?PHP Db::close怎麽用?PHP Db::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Db的用法示例。


在下文中一共展示了Db::close方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: rollback

 /**
  * 回滾所有全局事務。同時關閉全局事務選項.
  * @param string $dbname
  */
 static function rollback($dbname = null)
 {
     if ($dbname) {
         if (isset(Db::$txDbs[$dbname])) {
             $db = Db::$txDbs[$dbname];
             $db->rollback();
             unset(TxScope::$txDbs[$dbname]);
             unset(Db::$txDbs[$dbname]);
         }
     } else {
         Db::close();
         self::$tx = false;
     }
 }
開發者ID:comdeng,項目名稱:firegit,代碼行數:18,代碼來源:TxScope.php

示例2: disconnect

 /**
  * Disconnect from database
  */
 public static function disconnect()
 {
     self::$engine->close();
     self::$engine = null;
 }
開發者ID:mystralkk,項目名稱:geeklog,代碼行數:8,代碼來源:db.class.php

示例3: reset

 public static function reset($db = null, $atAllCost = false)
 {
     Db::close($db);
     Db::get($db, $atAllCost);
 }
開發者ID:ekowabaka,項目名稱:wyf,代碼行數:5,代碼來源:Db.php

示例4: catch

} catch (Exception $e) {
    print "<div style='background:#FFBBBB;border:1px solid red'>";
    print "Test '{$test_name}' (FALL&Oacute;) con mensaje: ({$e->getMessage()})";
    print "</div>";
}
if ($test) {
    $end_benckmark = microtime(true) - $start_benchmark;
    print "<div style='background:#CCFF99;border:1px solid green'>";
    print "Test '{$test_name}' (OK) con tiempo: ({$end_benckmark})";
    print "</div>";
}
$test = true;
$test_name = "CERRAR LA CONEXION A LA BASE DE DATOS";
$start_benchmark = microtime(true);
try {
    $value1 = $db->close();
    if (!$value1) {
        throw new DbException("No se puede cerrar la conexion (1)");
    }
} catch (Exception $e) {
    print "<div style='background:#FFBBBB;border:1px solid red'>";
    print "Test '{$test_name}' (FALL&Oacute;) con mensaje: ({$e->getMessage()})";
    print "</div>";
}
if ($test) {
    $end_benckmark = microtime(true) - $start_benchmark;
    print "<div style='background:#CCFF99;border:1px solid green'>";
    print "Test '{$test_name}' (OK) con tiempo: ({$end_benckmark})";
    print "</div>";
}
print "<div style='background:#CCFF99;border:1px solid green'>";
開發者ID:elgodmaster,項目名稱:app-distribuidora,代碼行數:31,代碼來源:adapters.php

示例5: define

<?php

define('DEBUG', true);
$root = realpath(dirname(__FILE__));
$urls = array('^/$' => 'Principal', '^/ingresar$' => 'Ingresar', '^/ingresar/amnesia$' => 'IngresarAmnesia', '^/personas$' => 'Personas', '^/personas/(\\d+)$' => 'PersonasVer', '^/personas/(\\d+)/editar$' => 'PersonasEditar', '^/empresas$' => 'Empresas', '^/empresas/agregar$' => 'EmpresasAgregar', '^/empresas/(\\d+)$' => 'EmpresasVer', '^/empresas/(\\d+)/editar$' => 'EmpresasEditar', '^/empresas/(\\d+)/personas$' => 'EmpresasPersonas', '^/empresas/(\\d+)/personas/agregar$' => 'EmpresasPersonasAgregar', '^/configuracion$' => 'Configuracion', '^/configuracion/apariencia$' => 'ConfiguracionApariencia', '^/salir$' => 'Salir');
include_once "{$root}/config.php";
if (DEBUG) {
    error_reporting(E_ALL);
}
include_once "{$root}/lib/Request.php";
include_once "{$root}/lib/Response.php";
include_once "{$root}/lib/Web.php";
include_once "{$root}/lib/WebBase.php";
include_once "{$root}/lib/Cookies.php";
include_once "{$root}/lib/Validation.php";
include_once "{$root}/lib/String.php";
include_once "{$root}/lib/Lang.php";
include_once "{$root}/lib/Db.php";
include_once "{$root}/lib/Config.php";
include_once "{$root}/lib/Session.php";
Db::open($dbConfig);
Cookies::$prefix = 'EME_';
Session::start();
Web::errorRegister(404, 'Error404');
Web::dispatch($urls);
Db::close();
開發者ID:joksnet,項目名稱:php-old,代碼行數:26,代碼來源:index.php

示例6: count

    $end = (int) $_POST['txtSize'];
    $len = count($characters);
    $list = array();
    for ($i = 1; $i < 1 << $len; $i++) {
        $c = '';
        for ($j = 0; $j < $len; $j++) {
            if ($i & 1 << $j) {
                $c .= $a[$j];
            }
        }
        $list[] = $c;
    }
    print_r($list);
    //$query = "INSERT INTO " . $_POST['txtTableName'] . " (PasswordValue) VALUES ('" . $value . "')";
    //$link -> query($query);
    Db::close($link);
}
?>


</form>

<script type="text/javascript">

    $(document).ready(function(){

        $('#txtTableName').focus();

    });

</script>
開發者ID:prizrak-andy,項目名稱:pwGen,代碼行數:31,代碼來源:index.php

示例7: Db

$Data->cat_id = "";
if (!is_null($Data->n_cat_id) && trim($Data->n_cat_id) != '') {
    $ShinshaDB = new Db();
    if ($ShinshaDB->connect(SHINSHA) == -1) {
        $Logger->error("DBコネクションエラーです。SHINSHA");
        _error(1);
        exit;
    }
    $result = $ShinshaDB->query("SELECT cat_id FROM catalog_master WHERE cat_id = " . $Data->n_cat_id);
    if ($result != -1) {
        if (pg_num_rows($result) > 0) {
            $Data->cat_id = $Data->n_cat_id;
        }
        pg_free_result($result);
    }
    $ShinshaDB->close();
}
$Zaiko->setZaikoData($Data);
// アイコンデータの取得(一文字づつに分解して、配列化)
$option_values_ary = array();
$length = strlen($Data->option_values);
for ($i = 0; $i < $length; $i++) {
    $option_values_ary[$i] = substr($Data->option_values, $i, 1);
}
$Zaiko->setOptionValues($option_values_ary);
$a_option_values_web = array();
$length = strlen($Data->option_values_web);
for ($i = 0; $i < $length; $i++) {
    $a_option_values_web[$i] = substr($Data->option_values_web, $i, 1);
}
$Zaiko->setOptionValuesWeb($a_option_values_web);
開發者ID:idaCI,項目名稱:TEST,代碼行數:31,代碼來源:getStockCarDetail.php

示例8: create_table

		color:green;
	}
	</style>

	
</head>
<body>
	<h2>Ejemplo de uso de la clase Db</h2>
<?php 
$db = new Db();
$columns = array('ID', 'Name', 'CountryCode', 'Population');
$resul = $db->select($columns, 'world.city')->limit(10)->exe();
?>
 <h3>Resultado con nombres de las columnas de las tablas</h3>
 <?php 
echo create_table($resul);
echo "<br>";
?>


<h3>Resultado con Alias para las columnas</h3>
<?php 
$columns = array('ID', 'Name', 'CountryCode', 'Population');
$resul = $db->select($columns, 'world.city')->where('CountryCode', '=', 'AFG')->andd('Population', '>', '130000')->exe();
$alias = array('Id', 'Nombre', 'Código de país', 'Población');
echo create_table($resul, $alias);
echo "<br>";
$db->close();
?>
</body>
</html>
開發者ID:kiviev,項目名稱:claseBaseDatos,代碼行數:31,代碼來源:index.php

示例9: checkExist

/**
 * 
 * @param Db $db
 * @param int $foodid
 */
function checkExist(&$db, $foodid)
{
    $sql = "select food_id from canteen_food where food_id={$foodid};";
    $res = $db->query($sql);
    if ($res !== false) {
        if (!empty($res)) {
            echo getJsonResponse(3, "食物已經存在", null);
            $db->rollback();
            //回滾
            $db->close();
            exit;
        }
        $sql2 = "select user_id from recommendedfood where user_id={$_POST['user_id']} and \n\t\t canteen_id={$_POST['canteen_id']} and food_id={$foodid};";
        $res2 = $db->query($sql2);
        if ($res2 !== false) {
            if (!empty($res2)) {
                echo getJsonResponse(4, "食物已經推薦給食堂", null);
                $db->rollback();
                //回滾
                $db->close();
                exit;
            }
        } else {
            echo getJsonResponse(1, $db->error, null);
            Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
            $db->rollback();
            $db->close();
            exit;
        }
    } else {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        $db->rollback();
        $db->close();
        exit;
    }
}
開發者ID:xiaoqinzhe,項目名稱:eatBetter,代碼行數:42,代碼來源:add_recommend_food.php


注:本文中的Db::close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。