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


PHP Connection::get方法代碼示例

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


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

示例1: getCurrent

 /**
  * Returns the list of currently executing queries
  *
  * @throws Exception
  *
  * @return array
  */
 public function getCurrent()
 {
     $url = UrlHelper::buildUrl(Urls::URL_QUERY, array('current'));
     $response = $this->_connection->get($url);
     $result = $response->getJson();
     return $result;
 }
開發者ID:vinigomescunha,項目名稱:ArangoDB-Ajax-PHP-Example,代碼行數:14,代碼來源:QueryHandler.php

示例2: getTopList

 public static function getTopList()
 {
     $connection = Connection::get();
     $sql = '
         SELECT
             u.*,
             SUM(IF(ug.type = "gold" AND ug.expire_date > NOW(), ug.amount - ug.used, 0)) AS gold,
             SUM(IF(ug.type = "coin" AND ug.expire_date > NOW(), ug.amount - ug.used, 0)) AS coin
         FROM users u
         LEFT JOIN user_gifts ug
             ON u.id = ug.user_id
         GROUP BY ug.user_id
         ORDER BY (
             (SUM(IF(ug.type = "gold" AND ug.expire_date > NOW(), ug.amount - ug.used, 0)) * 10) +
             SUM(IF(ug.type = "coin" AND ug.expire_date > NOW(), ug.amount - ug.used, 0))
         ) DESC
     ';
     $STH = $connection->prepare($sql);
     $STH->execute();
     $users = array();
     if ($STH->rowCount() > 0) {
         while ($row = $STH->fetch(PDO::FETCH_ASSOC)) {
             $user = new User();
             $user->fillByArray($row);
             $userWallet = new UserWallet();
             $userWallet->setUserId($user->getId());
             $userWallet->setGold($row['gold']);
             $userWallet->setCoin($row['coin']);
             $user->setWallet($userWallet);
             $users[] = $user;
         }
     }
     return $users;
 }
開發者ID:mmaydin,項目名稱:peak,代碼行數:34,代碼來源:statistics.php

示例3: validationDate

/**
* Yeah ! Tentative !!
*Sans dec, je vais en chier.
*/
function validationDate($date_deb, $date_fin)
{
    $conn = Connection::get();
    // requete sql preparé
    $result = $conn->prepare("SELECT * FROM tarif_transaction WHERE date_deb >= :date_deb AND date_fin <= :date_fin");
    echo var_dump($result);
    //TH : je fixe la date de fin car le menu deroulant ne permet pas de mettre 2015 (rien touché d'autre)
    //$date_fin="2015-12-31";
    $result->execute(array('date_deb' => $date_deb, 'date_fin' => $date_fin));
    $true = null;
    while ($row = $result->fetch()) {
        $true[] = $row;
    }
    //TH  :et hop ici $true prend bien la bonne valeur (6 avec la base de max)
    echo "tadaaaaaaaaaa!";
    echo var_dump($true);
    // Long story short, ça marche pas
    //$fakeresult = null; // array(2,2);
    //echo var_dump($fakeresult);
    if ($true != null) {
        // Ce test ne sert à rien s un resultat vide renvoit effectivement un null
        return $true;
    } else {
        return null;
    }
}
開發者ID:ThierryHund,項目名稱:CCLeclour,代碼行數:30,代碼來源:controleTransaction.class.php

示例4: getNbType

 public static function getNbType()
 {
     $conn = Connection::get();
     $select = $conn->query("SELECT type_presentation.id_type as id, type_presentation.nom_type as type, count(presentation.id_presentation) as nb from type_presentation LEFT JOIN presentation on type_presentation.id_type = presentation.id_type GROUP BY type_presentation.id_type ORDER BY type_presentation.nom_type");
     $result = array();
     $result = $select->fetchAll(PDO::FETCH_ASSOC);
     return $result;
 }
開發者ID:ThierryHund,項目名稱:projet_conf,代碼行數:8,代碼來源:type_presentation.class.php

示例5: insererSurperso

 public static function insererSurperso($array)
 {
     $conn = Connection::get();
     var_dump($array);
     // requete d'insertion
     $request = $conn->prepare("INSERT INTO sur_perso (nom_beneficiaire, prenom_beneficiaire, evenement, nom_entp, id_carte)\n\t\t\t\tVALUES (:nom , :prenom , :evenement, :entreprise, 1)");
     $request->execute($array);
 }
開發者ID:ThierryHund,項目名稱:CCLeclour,代碼行數:8,代碼來源:surperso.class.php

示例6: connection

 /**
  * @todo use static vars
  */
 public function connection()
 {
     if (!$this->connected) {
         $this->connected = true;
         $this->setSource($this->table);
     }
     return Connection::get($this->connection);
 }
開發者ID:klawdyo,項目名稱:spaghettiphp,代碼行數:11,代碼來源:Model.php

示例7: insertOrateurNvEntp

 public static function insertOrateurNvEntp($nom_orateur, $prenom_orateur, $courriel_orateur, $tel_orateur)
 {
     $conn = Connection::get();
     $entreprise = $conn->query("SELECT max(last_insert_id(id_entp)) as last_entp_inserted FROM entreprise");
     $id_entreprise = $entreprise->fetch();
     $req = $conn->prepare("INSERT INTO orateur (nom_orateur, prenom_orateur, courriel_orateur, tel_orateur, id_entp) VALUES (:nom_orateur, :prenom_orateur, :courriel_orateur, :tel_orateur, :id_entp)");
     $req->execute(array('nom_orateur' => $nom_orateur, 'prenom_orateur' => $prenom_orateur, 'courriel_orateur' => $courriel_orateur, 'tel_orateur' => $tel_orateur, 'id_entp' => $id_entreprise['last_entp_inserted']));
 }
開發者ID:ThierryHund,項目名稱:projet_conf,代碼行數:8,代碼來源:orateur.class.php

示例8: getRegisteredUserFunctions

 /**
  * Get registered user functions
  *
  * The method can optionally be passed a $namespace parameter to narrow the results down to a specific namespace.
  *
  * @param null $namespace
  *
  * @throws Exception throw exception if the request failed
  *
  * @return mixed true if successful without a return value or the return value if one was set in the action
  */
 public function getRegisteredUserFunctions($namespace = null)
 {
     $url = UrlHelper::buildUrl(Urls::URL_AQL_USER_FUNCTION, array());
     if (!is_null($namespace)) {
         $url = UrlHelper::appendParamsUrl($url, array('namespace' => $namespace));
     }
     $response = $this->_connection->get($url);
     $responseArray = $response->getJson();
     return $responseArray;
 }
開發者ID:vinigomescunha,項目名稱:ArangoDB-Ajax-PHP-Example,代碼行數:21,代碼來源:AqlUserFunction.php

示例9: __construct

 public function __construct()
 {
     $this->stat = explode(' ', file_get_contents('/proc/self/stat'));
     $this->ts = microtime(true);
     self::$obj = $this;
     $this->script = $_SERVER['PHP_SELF'];
     $this->disabled = Connection::get()->isFailed();
     //если нет соединения, отключаем сбор счётчиков
     $this->conn = Connection::get();
 }
開發者ID:ilukyanov,項目名稱:btpapi,代碼行數:10,代碼來源:Request.php

示例10: connection

 /**
  * Método que irá abrir uma conexão com servidor.
  * 
  * @param <string> $name >> nome da conexão.
  */
 static function connection($name)
 {
     $config = Connection::get($name);
     # iniciando conexão, caso isto ainda não tenha sido feito.
     if (!array_key_exists('connection', $config)) {
         Connection::$connections[$name]['connection'] = pg_connect("host={$config['host']} port={$config['port']} dbname={$config['database']} user={$config['user']} password={$config['password']}");
         pg_set_client_encoding(Connection::$connections[$name]['connection'], 'UTF-8');
     }
     return Connection::$connections[$name]['connection'];
 }
開發者ID:xtiurti,項目名稱:web-service-lavanderia-encoder,代碼行數:15,代碼來源:postgresql.php

示例11: contratConcerne

 public static function contratConcerne($dateDeb, $dateFin)
 {
     $conn = Connection::get();
     $select = $conn->query("SELECT id_tarif, prix, date_deb, date_fin, nbcarte_max, nbcarte_min FROM tarif_transaction WHERE ((DATEDIFF(date_fin, '" . $dateDeb . "') >=0) AND (DATEDIFF(date_fin, '" . $dateFin . "') <=0) )OR ((DATEDIFF(date_deb, '" . $dateFin . "') <=0) AND (DATEDIFF(date_fin, '" . $dateDeb . "') >=0) ) ORDER BY date_deb ASC");
     $result = array();
     while ($row = $select->fetch()) {
         $result[] = $row;
     }
     return $result;
 }
開發者ID:ThierryHund,項目名稱:CCLeclour,代碼行數:10,代碼來源:tarif_transaction.class.php

示例12: novoCiclo

 public static function novoCiclo($codConta, $data)
 {
     $con = Connection::get();
     $prepared = $con->prepare("INSERT INTO Ciclos VALUES (NULL, :di, :code)");
     $prepared->bindParam(":di", $data);
     $prepared->bindParam(":code", $codConta);
     $prepared->execute();
     $prepared = null;
     $con = null;
 }
開發者ID:carlosrodriguesf,項目名稱:adeushomonios,代碼行數:10,代碼來源:Ciclo.class.php

示例13: getLibById

 public static function getLibById($id_grp)
 {
     $result = null;
     $conn = Connection::get();
     // requete sql preparé
     $request = $conn->prepare("SELECT id_grp, lib_grp FROM groupe WHERE id_grp=:id_grp");
     $request->execute(array('id_grp' => $id_grp));
     while ($row = $request->fetch()) {
         $result[] = $row;
     }
     return $result;
 }
開發者ID:ThierryHund,項目名稱:CCLeclour,代碼行數:12,代碼來源:groupe.class.php

示例14: adicionar

 public static function adicionar($nome, $categoria, $temporaria)
 {
     $conn = Connection::get();
     $prepared = $conn->prepare("INSERT INTO Fotos VALUES (:nome, :categoria, NOW(), :temporaria)");
     $prepared->bindParam(":nome", $nome);
     $prepared->bindParam(":categoria", $categoria);
     $prepared->bindParam(":temporaria", $temporaria);
     $prepared->execute();
     $prepared = null;
     $conn = null;
     return true;
 }
開發者ID:carlosrodriguesf,項目名稱:adeushomonios,代碼行數:12,代碼來源:Foto.class.php

示例15: getLibById

 public static function getLibById($id_mag)
 {
     $conn = Connection::get();
     // requete sql preparé
     $request = $conn->prepare("SELECT lib_mag FROM entite WHERE id_mag=:id_mag");
     $request->execute(array('id_mag' => $id_mag));
     $result = null;
     while ($row = $request->fetch()) {
         $result[] = $row;
     }
     return $result;
 }
開發者ID:ThierryHund,項目名稱:CCLeclour,代碼行數:12,代碼來源:magasin.class.php


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