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


PHP DB::disconnect方法代码示例

本文整理汇总了PHP中DB::disconnect方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::disconnect方法的具体用法?PHP DB::disconnect怎么用?PHP DB::disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


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

示例1: tearDown

 public function tearDown()
 {
     $this->beforeApplicationDestroyed(function () {
         DB::disconnect();
     });
     parent::tearDown();
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:7,代码来源:TestCase.php

示例2: test_1_create_table

 function test_1_create_table()
 {
     DB::query("CREATE TABLE `accounts` (\n    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n    `profile_id` INT NOT NULL,\n    `username` VARCHAR( 255 ) NOT NULL ,\n    `password` VARCHAR( 255 ) NULL ,\n    `age` INT NOT NULL DEFAULT '10',\n    `height` DOUBLE NOT NULL DEFAULT '10.0',\n    `favorite_word` VARCHAR( 255 ) NULL DEFAULT 'hi',\n    `birthday` TIMESTAMP NOT NULL\n    ) ENGINE = InnoDB");
     DB::query("CREATE TABLE `profile` (\n    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n    `signature` VARCHAR( 255 ) NULL DEFAULT 'donewriting'\n    ) ENGINE = InnoDB");
     $mysqli = DB::get();
     DB::disconnect();
     @$this->assert($mysqli->server_info === null);
 }
开发者ID:hllau9,项目名称:Euro2016,代码行数:8,代码来源:BasicTest.php

示例3: smarty_modifier_getImg

function smarty_modifier_getImg($string)
{
    $db = new DB();
    $db->connect();
    $url = $db->getImg($string);
    $db->disconnect();
    return $url;
}
开发者ID:xuhongxu96,项目名称:Tagexing,代码行数:8,代码来源:modifier.getImg.php

示例4: _disconnect

 /**
  * Disconnects from the SQL server and cleans up the connection.
  */
 protected function _disconnect()
 {
     if ($this->_connected) {
         $this->_connected = false;
         $this->_db->disconnect();
         $this->_write_db->disconnect();
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:11,代码来源:Sql.php

示例5:

 /**
  * Disconnects from the SQL server and cleans up the connection.
  *
  * @access private
  *
  * @return boolean  True on success, false on failure.
  */
 function _disconnect()
 {
     if ($this->_connected) {
         $this->_connected = false;
         $this->_db->disconnect();
         $this->_write_db->disconnect();
     }
     return true;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:pdnsgsql.php

示例6: getTopology

 public function getTopology()
 {
     $conn = DB::connection('sqlsrvtest');
     $select = "exec GetTopologyRing";
     $result = $conn->select($select);
     $datos = json_encode($result);
     DB::disconnect('sqlsrvtest');
     return $datos;
 }
开发者ID:miguelcamargo9,项目名称:dactool,代码行数:9,代码来源:TopologyController.php

示例7: test_successful_and_bad_login

 public function test_successful_and_bad_login()
 {
     $db = new DB();
     $db->connect();
     $this->assertEquals($db->insertNewUserInTableUsers(new User("DavidTest", new Password("1234"))), true);
     $this->assertEquals($db->checkLogin(new User("DavidTest", new Password("1234"))), true);
     $this->assertEquals($db->checkLogin(new User("fake", new Password("1234"))), false);
     $this->assertEquals($db->checkLogin(new User("DavidTest", new Password("fake"))), false);
     $this->assertEquals($db->checkLogin(new User("fake", new Password("fake"))), false);
     $this->assertEquals($db->deleteUserWithName("DavidTest"), true);
     $db->disconnect();
 }
开发者ID:espumitadk,项目名称:php_tdd,代码行数:12,代码来源:_DB.php

示例8: mystery_db_disconnect

function mystery_db_disconnect($connection = 'dbh')
{
    // this rarely used function disconnects from the database.  If you have non-persistent
    // connections, this is done automatically at the end of the script so there is no
    // reason to manually disconnect it.
    global $_MYSTERY;
    if (is_resource(@$_MYSTERY[$connection])) {
        $_MYSTERY[$connection] =& DB::disconnect(MYSTERY_DB_CONNECT_STRING);
        if (DB::isError($_MYSTERY[$connection])) {
            trigger_error('Could not connect to database: ' . $_MYSTERY[$connection]->getMessage() . "\n\n" . $_MYSTERY[$connection]->getDebugInfo(), E_USER_WARNING);
        }
    }
}
开发者ID:stepheneb,项目名称:test-from-svn,代码行数:13,代码来源:database.php

示例9: __construct

 public function __construct()
 {
     $this->TestSuite('All Tests');
     $basedir = dirname(__FILE__) . '/';
     foreach (self::$dirs as $dirname) {
         $this->addFile("{$basedir}{$dirname}/test_{$dirname}.php");
     }
     Magnus::init('test');
     DB::disconnect();
     // since we auto-connect in Magnus::init()
     DB::$config['dbname'] = 'timber_test';
     DB::connect();
 }
开发者ID:kylebragger,项目名称:helloworld,代码行数:13,代码来源:run_all.php

示例10: resetearBD

 private function resetearBD()
 {
     $db_final = Config::get('database.connections.migracion_sasyc.database');
     $this->info("Verificando si sasyc_migracion existe");
     $existe = DB::select("SELECT 1 FROM pg_database WHERE datname = '{$db_final}'");
     if (!empty($existe)) {
         $this->info("Borrando base de datos " . $db_final);
         DB::statement('DROP DATABASE ' . $db_final);
     }
     $this->info("Cerrando conexion con la BD");
     DB::disconnect('sasyc_migracion');
     DB::disconnect('pgsql');
     $this->info("Creando base de datos " . $db_final);
     DB::statement('CREATE DATABASE ' . $db_final);
     $this->info("Corriendo archivos de migrations y seeds");
     $this->call('migrate', ['--database' => 'migracion_sasyc']);
     $this->call('db:seed', ['--database' => 'migracion_sasyc']);
 }
开发者ID:armandolazarte,项目名称:sasyc,代码行数:18,代码来源:MigrarSasyc.php

示例11: VerReportes

 public function VerReportes()
 {
     $conn = DB::connection('DactoolDB');
     $select = "select * from Reportes";
     $result = $conn->select($select);
     $datos = array();
     foreach ($result as $reporte) {
         $selectautor = "select NombreUsuario from Usuarios where IdUsuario = {$reporte->AutorReporte}";
         $resultautor = $conn->select($selectautor);
         foreach ($resultautor as $autor) {
             $reporte->AutorReporte = $autor->NombreUsuario;
         }
         $datos[] = $reporte;
     }
     $datos = json_encode($datos);
     DB::disconnect('DactoolDB');
     return View::make('ReportesController.listareportes', array('datos' => $datos));
 }
开发者ID:miguelcamargo9,项目名称:dactool,代码行数:18,代码来源:ReportesController.php

示例12: VerNotificaciones

 public function VerNotificaciones()
 {
     $conn = DB::connection('DactoolDB');
     $select = "select * from Notificaciones";
     $result = $conn->select($select);
     $datos = array();
     foreach ($result as $notificacion) {
         $selectautor = "select NombreUsuario from Usuarios where IdUsuario = {$notificacion->AutorNotificacion}";
         $resultautor = $conn->select($selectautor);
         foreach ($resultautor as $autor) {
             $notificacion->AutorNotificacion = $autor->NombreUsuario;
         }
         $notificacion->Destinatarios = $this->GetDestinatarios($notificacion->IdNotificacion, $conn);
         $datos[] = $notificacion;
     }
     $datos = json_encode($datos);
     DB::disconnect('DactoolDB');
     return View::make('NotificacionesController.listanotificaciones', array('datos' => $datos));
 }
开发者ID:miguelcamargo9,项目名称:dactool,代码行数:19,代码来源:NotificacionesController.php

示例13: VerDependenciaScripts

 public function VerDependenciaScripts($idscript = null)
 {
     $conn = DB::connection('DactoolDB');
     $select = "select * from ScriptsToScripts where IdScriptHijo = {$idscript}";
     $result = $conn->select($select);
     $datos = array();
     foreach ($result as $script) {
         $detalleScript = "select * from Scripts where IdScript = {$script->IdScriptPadre}";
         $resultD = $conn->select($detalleScript);
         foreach ($resultD as $scriptD) {
             $scriptD->AutorScript = $this->getAuthor($scriptD->AutorScript, $conn);
             $datos[] = $scriptD;
         }
     }
     $selectS = "select * from Scripts where IdScript = {$idscript}";
     $resultS = $conn->select($selectS);
     foreach ($resultS as $script) {
         $nameScript = $script->NombreScript;
     }
     $datosEncode = json_encode($datos);
     DB::disconnect('DactoolDB');
     return View::make('ScriptsController.listascriptspadres', array('datos' => $datosEncode, 'hijo' => $nameScript));
 }
开发者ID:miguelcamargo9,项目名称:dactool,代码行数:23,代码来源:ScriptsController.php

示例14: getSettings

function getSettings($p_mailbox)
{
    global $g_use_database;
    global $g_voicemail_conf_path;
    global $g_db_host, $g_db_name, $g_db_user, $g_db_pass;
    if ($g_use_database == true) {
        // Authenticate with Database
        $my_db = new DB();
        $my_db->construct($g_db_host, $g_db_name, $g_db_user, $g_db_pass);
        $my_db->connect();
        $my_db->select();
        $sql = "SELECT uniqueid,password,fullname,email,saycid,envelope,sendvoicemail,'delete' AS deleteafteremail FROM voicemail WHERE mailbox='{$p_mailbox}';";
        //if ($g_debug) echo("SQL: $sql<br />\n");
        $result = $my_db->query($sql);
        if ($result) {
            if (mysql_num_rows($result) > 0) {
                $row = mysql_fetch_array($result);
                $temp['FullName'] = $row['fullname'];
                $temp['Password'] = $row['password'];
                $temp['SayCallerId'] = $row['saycid'];
                $temp['Envelope'] = $row['envelope'];
                $temp['Email'] = $row['email'];
                $temp['SendToEmail'] = $row['sendvoicemail'];
                $temp['DeleteAfterEmail'] = $row['deleteafteremail'];
            }
            mysql_free_result($result);
        }
        $my_db->disconnect();
    } else {
        // cat the voicemail.conf file, grep for mailbox
        $cmd = "cat " . $g_voicemail_conf_path . " | grep " . $p_mailbox;
        $last_line = exec($cmd, $retvalue);
        // parse out the info - 1001 => 1001,Chris Carey,chris@chriscarey.com
        list($mailbox, $everything_else) = split('=>', $last_line);
        list($password, $name, $email) = split(",", $everything_else);
        // Settings from voicemail.conf
        $temp['FullName'] = $name;
        $temp['Password'] = $password;
        $temp['SayCallerId'] = "true";
        $temp['Envelope'] = "true";
        $temp['Email'] = $email;
        $temp['SendToEmail'] = "true";
        $temp['DeleteAfterEmail'] = "true";
    }
    return $temp;
}
开发者ID:xishuiye,项目名称:asterisk-voicemail-for-iphone,代码行数:46,代码来源:i_functions.php

示例15: getReporteEstadosGrafica

 public function getReporteEstadosGrafica()
 {
     $pais = Input::get('filtro') ? Input::get('filtro') : null;
     $conn = DB::connection('atlas');
     $datosa = array();
     $select = "SELECT DI.Location as Pais, TM.Description, COUNT(*) as Val \n                    FROM [dbo].[DashboardGraficasInterfaces] DI \n                    LEFT JOIN TypeMedio TM ON TM.ID = DI.IdTypeMedio\t\n                    WHERE CAST(DI.[Date] AS DATE) = (SELECT MAX(CAST(DI.[Date] AS DATE)) FROM [DashboardGraficasInterfaces] DI WITH (NOLOCK)) \n                    AND DI.Grafica = 0 ";
     if ($pais['Pais']) {
         $select .= "and DI.Location = '{$pais['Pais']}' ";
     }
     $select .= "GROUP BY DI.Location, TM.Description \n                    ORDER BY Pais ";
     $result = $conn->select($select);
     $labels = array('COLOMBIA', 'ARGENTINA', 'BRASIL', 'MEXICO', 'PERU', 'CHILE', 'ECUADOR', 'PANAMA', 'PUERTORICO', 'URUGUAY', 'USA', 'VENEZUELA');
     $series = array('Cobre', 'Fibra', 'Wireless', 'NoAplica');
     foreach ($result as $estado) {
         $datosa[$estado->Pais][$estado->Description] = $estado->Val;
     }
     $labels = isset($pais['Pais']) ? array($pais['Pais']) : $labels;
     $datospre = array();
     foreach ($series as $serie) {
         foreach ($labels as $label) {
             if (isset($datosa[$label][$serie])) {
                 $datospre[$serie][] = intval($datosa[$label][$serie]);
             } else {
                 $datospre[$serie][] = null;
             }
         }
     }
     $datos = array();
     foreach ($datospre as $value) {
         $datos['data'][] = $value;
     }
     $datos['labels'] = $labels;
     $datos['series'] = $series;
     $datos = json_encode($datos);
     DB::disconnect('atlas');
     return $datos;
 }
开发者ID:miguelcamargo9,项目名称:dactool,代码行数:37,代码来源:ReportesController.php


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