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


PHP ConnectionFactory::getConnection方法代码示例

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


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

示例1: testFunctional

 public function testFunctional()
 {
     $pdo = $this->factory->getConnection();
     $this->assertInstanceOf('PDO', $pdo);
     $pdo->exec("CREATE TABLE `foo`(`id` int,`name` varchar)");
     $pdo->exec("insert into `foo` VALUES (1,'foo')");
     $repo = new FooRepository($this->factory);
     $entity = $repo->getById(1);
     $expected = new FooEntity();
     $expected->id = 1;
     $expected->name = 'foo';
     $this->assertEquals($expected, $entity);
 }
开发者ID:mitallast,项目名称:php-db,代码行数:13,代码来源:ExampleRepositoryTest.php

示例2: inScriptPermissionsCheck

 public static function inScriptPermissionsCheck($user_id, $showMenuIfFailed)
 {
     $pageURI = $_SERVER['REQUEST_URI'];
     if (!Permissions::hasPermissionsForScript($user_id, $pageURI)) {
         if ($showMenuIfFailed) {
             include dirname(dirname(__FILE__)) . '/include/header.include.php';
         } else {
             echo '<html><head></head><body>';
         }
         echo '<h3>You need the following permissions to use this page:</h3>';
         echo '<ul>';
         $fileCache = self::createFileCache();
         $db = null;
         $ps = new PreparedStatement('select description from appperm where perm_name = ?');
         foreach (Permissions::getRequiredPermissionsForScript($pageURI) as $p) {
             $cacheKey = sprintf('apppermDesc%s', $p);
             if (($desc = $fileCache->get($cacheKey)) === false) {
                 if ($db === null) {
                     $db = ConnectionFactory::getConnection();
                 }
                 $ps->clearParams();
                 $ps->setString($p);
                 if (($row = $db->fetchObject($db->executeQuery($ps), true)) !== false) {
                     $desc = $row->description;
                 } else {
                     $desc = $p;
                 }
                 $fileCache->set($cacheKey, $desc);
             }
             echo '<li>';
             echo htmlspecialchars($desc);
             echo '</li>';
         }
         if ($db !== null) {
             $db->close();
         }
         echo '</ul>';
         if ($showMenuIfFailed) {
             include dirname(dirname(__FILE__)) . '/include/footer.include.php';
         } else {
             echo '</body></html>';
         }
         exit;
     }
 }
开发者ID:roncemer,项目名称:pfmgr2,代码行数:45,代码来源:Permissions.class.php

示例3: dirname

// If you need to customize this file, please edit the corresponding
// yaml file in the gencfg directory, and then re-generate this file
// by running searchgen, passing in the table name.
include dirname(dirname(dirname(__FILE__))) . '/jax/include/l10n.include.php';
loadResourceBundle(dirname(dirname(dirname(__FILE__))) . '/jax/resources/system');
loadResourceBundle(dirname(dirname(dirname(__FILE__))) . '/resources/system');
loadResourceBundle(__FILE__);
if (isset($command) && $command == 'searchPostingtypes_getSearchableColumns') {
    header('Content-Type: application/json');
    $searchableColumns = array((object) array('name' => 'id', 'pfx' => 'pri.', 'title' => _t('postingtype_search.searchableColumn.id.title', 'Id'), 'sqlType' => 'integer', 'queryOperator' => '='), (object) array('name' => 'description', 'pfx' => 'pri.', 'title' => _t('postingtype_search.searchableColumn.description.title', 'Description'), 'sqlType' => 'varchar', 'queryOperator' => 'contains'), (object) array('name' => 'normal_sign', 'pfx' => 'pri.', 'title' => _t('postingtype_search.searchableColumn.normal_sign.title', 'Normal Sign'), 'sqlType' => 'char', 'queryOperator' => 'contains'));
    echo json_encode($searchableColumns);
    exit;
}
if (isset($command) && $command == 'searchPostingtypes') {
    header('Content-Type: application/json');
    $db = ConnectionFactory::getConnection();
    $returnColumns = isset($params['sColumns']) ? explode(',', preg_replace('/[^a-zA-Z0-9_$,]/', '', $params['sColumns'])) : array();
    $sEcho = isset($params['sEcho']) ? (int) $params['sEcho'] : 0;
    $offset = isset($params['iDisplayStart']) ? (int) $params['iDisplayStart'] : 0;
    $limit = isset($params['iDisplayLength']) ? (int) $params['iDisplayLength'] : 0;
    if ($limit < 1 || $limit > 100) {
        $limit = 100;
    }
    $orderBy = '';
    if (isset($params['iSortingCols']) && ($nsc = (int) $params['iSortingCols']) > 0) {
        for ($i = 0; $i < $nsc; $i++) {
            $sci = isset($params['iSortCol_' . $i]) ? (int) $params['iSortCol_' . $i] : 0;
            if ($sci < 0 || $sci >= count($returnColumns)) {
                $sci = 0;
            }
            $scd = isset($params['sSortDir_' . $i]) ? strtolower($params['sSortDir_' . $i]) : 'asc';
开发者ID:roncemer,项目名称:pfmgr2,代码行数:31,代码来源:postingtype_search.include.php

示例4: __construct

 /**
  * コンストラクタ
  * @access public
  */
 function __construct()
 {
     $this->db = ConnectionFactory::getConnection();
 }
开发者ID:nkawa,项目名称:acs-git-test,代码行数:8,代码来源:Service.class.php

示例5: set

 /**
  * Set string param
  *
  * @param String $value value to set
  */
 public function set($value)
 {
     $value = mysqli_escape_string(ConnectionFactory::getConnection(), $value);
     $this->params[$this->idx++] = "'" . $value . "'";
 }
开发者ID:Cristian93,项目名称:changeManagementKPI,代码行数:10,代码来源:SqlQuery.class.php

示例6: Connection

	public function Connection(){
		$this->connection = ConnectionFactory::getConnection();
	}
开发者ID:ngduc,项目名称:Thin-PHP-Framework,代码行数:3,代码来源:Connection.class.php

示例7: catch

         try {
             @$__loginAppuserpersistentloginDAO->insert($kmli);
         } catch (Exception $ex) {
         }
         // Confirm that we were able to add the row successfully.
         $kmlis = $__loginAppuserpersistentloginDAO->findByKeep_me_logged_in_uniqid($kmli->keep_me_logged_in_uniqid);
         if (count($kmlis) == 1 && $kmlis[0]->user_id == $loggedInUser->id) {
             // Success. Set the cookie and stop trying new unique Ids.
             setcookie('kmliuid', $kmli->keep_me_logged_in_uniqid, time() + $KEEP_ME_LOGGED_IN_TIME, '/');
             return true;
         }
     }
     return false;
 }
 $__loginErrorMsg = '';
 $__loginDB = ConnectionFactory::getConnection();
 $__loginAppuserDAO = new AppuserDAO($__loginDB);
 $__loginAppuserpersistentloginDAO = new AppuserpersistentloginDAO($__loginDB);
 $loggedInUser = null;
 // Try logging in with username and password from a login form POST.
 if ($loggedInUser === null && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['loginUserName']) && isset($_POST['loginPassword'])) {
     $__loginUsers = $__loginAppuserDAO->findByUser_name(trim($_POST['loginUserName']));
     if (empty($__loginUsers)) {
         $__loginUsers = $__loginAppuserDAO->findByEmail_addr(trim($_POST['loginUserName']));
     }
     if (count($__loginUsers) == 1 && $__loginUsers[0] && $__loginUsers[0]->is_active) {
         if ($__loginUsers[0]->login_failures >= $MAX_LOGIN_FAILURES && strtotime($__loginUsers[0]->last_login_failure) >= time() - $LOGIN_FAILURE_LOCKOUT_TIME) {
             __accountLocked();
         }
         $loggedInUser = $__loginUsers[0];
         $saltidx = strrpos($loggedInUser->password_hash, '{');
开发者ID:roncemer,项目名称:pfmgr2,代码行数:31,代码来源:requireLogin.include.php

示例8: __construct

 function __construct(Cliente $cli)
 {
     $this->dao = ConnectionFactory::getConnection();
     $this->cli = $cli;
     $this->tabela = strtolower(get_class($this->cli));
 }
开发者ID:lucams,项目名称:Petshop-PHPOO,代码行数:6,代码来源:ClienteDAO.php

示例9: Participante

<?php

require_once 'modelos/participante.php';
require_once 'modelos/dao/participante_dao.php';
require_once 'infra/connection_factory.php';
$nome = $_POST['nome'];
$sobrenome = $_POST['sobrenome'];
$email = $_POST['email'];
$participante = new Participante($nome, $sobrenome, $email);
$factory = new ConnectionFactory();
$conexao = $factory->getConnection();
$participanteDao = new ParticipanteDao($conexao);
$participanteDao->adiciona($participante);
?>

开发者ID:leonardocordeiro,项目名称:lema_day,代码行数:14,代码来源:inscricao.php

示例10: __construct

 public function __construct()
 {
     $cf = new ConnectionFactory();
     $this->conn = $cf->getConnection();
 }
开发者ID:viniciuscl,项目名称:casamento-rv,代码行数:5,代码来源:class.Dao.php

示例11: executeInsert

 public static function executeInsert($sqlQuery)
 {
     QueryExecutor::executeUpdate($sqlQuery);
     return mysqli_insert_id(ConnectionFactory::getConnection());
 }
开发者ID:Cristian93,项目名称:changeManagementKPI,代码行数:5,代码来源:QueryExecutor.class.php

示例12: preViewOutputHook

function preViewOutputHook()
{
    global $ALL_PERM_NAMES, $ALL_PERM_DESCRIPTIONS_BY_PERM_NAMES;
    $db = ConnectionFactory::getConnection();
    $ALL_PERM_NAMES = array();
    $ALL_PERM_DESCRIPTIONS_BY_PERM_NAMES = array();
    $ps = new PreparedStatement('select perm_name, description from appperm order by perm_name');
    $rs = $db->executeQuery($ps);
    while ($r = $db->fetchObject($rs)) {
        $ALL_PERM_NAMES[] = $r->perm_name;
        $ALL_PERM_DESCRIPTIONS_BY_PERM_NAMES[$r->perm_name] = $r->description;
    }
    $db->freeResult($rs);
    $db->close();
}
开发者ID:roncemer,项目名称:jaxframework,代码行数:15,代码来源:apppageuri.php


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