本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例6: connection
/**
* @todo use static vars
*/
public function connection()
{
if (!$this->connected) {
$this->connected = true;
$this->setSource($this->table);
}
return Connection::get($this->connection);
}
示例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']));
}
示例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;
}
示例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();
}
示例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'];
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}