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


PHP DatabaseFactory类代码示例

本文整理汇总了PHP中DatabaseFactory的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseFactory类的具体用法?PHP DatabaseFactory怎么用?PHP DatabaseFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 public function __construct()
 {
     $this->headerFooter = HeaderFooterFactory::createHeaderFooter();
     $this->pageHome = PageFactory::createHome();
     $this->database = DatabaseFactory::createDatabase();
     $this->file = FileFactory::setFile();
 }
开发者ID:xcgpseud,项目名称:forum,代码行数:7,代码来源:Facade.php

示例2: GetInstance

 public static function GetInstance()
 {
     static $instance = null;
     if (is_null($instance)) {
         $factory = new DatabaseFactory();
         $instance = $factory->createObject(G_DB_TYPE);
         if (is_null($instance)) {
             die("Can not create database object\n");
         }
     }
     return $instance;
 }
开发者ID:FantasticThought,项目名称:tfsda,代码行数:12,代码来源:database.class.php

示例3: getOutData

 public function getOutData()
 {
     $id = $this->data;
     $query = "SELECT * FROM Users WHERE id = {$id}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchArray($query);
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:7,代码来源:D_ReadUserById.php

示例4: getOutData

 public function getOutData()
 {
     $date = $this->data['date'];
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     $rowsTotalNumberInArray = $db->SQLFetchArray("SELECT COUNT(*)\n                                                         FROM SquidData\n                                                         WHERE date = '{$date}' ");
     return (int) $rowsTotalNumberInArray['COUNT(*)'];
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:7,代码来源:D_ClientRequestsRowsTotalNumber.php

示例5: selectgen

 public static function selectgen($name, $label, $table, $required = null, $selected = null)
 {
     if ($required != null) {
         $required = 'required';
     }
     $s = '';
     $s .= '<div class="form-group">
         <label>' . $label . '</label>
         <select class="form-control" name="' . $name . '" required >';
     $s .= '<option value=""    > Select </option>';
     $pdo = DatabaseFactory::getFactory()->getConnection();
     $sql = "SELECT id, name FROM  " . $table;
     $query = $pdo->prepare($sql);
     $query->execute();
     $options = $query->fetchAll();
     foreach ($options as $k => $v) {
         $s .= '<option value="' . $v->id . '" ';
         if ($v->id == $selected) {
             $s .= ' selected ';
         }
         $s .= '    >' . $v->name . '</option>';
     }
     $s .= '</select>
     </div>';
     return $s;
 }
开发者ID:bribrink,项目名称:crudkiller,代码行数:26,代码来源:Fields.php

示例6: register_on_db

 private function register_on_db($cinema)
 {
     //o nome da classe é o id do banco, recupera dinamico
     $classname = get_class($this);
     $cinema->_id = $classname;
     $db = DatabaseFactory::get_provider();
     $cinema_db = $db->find($classname);
     if ($cinema_db) {
         if ($cinema_db->hash != $cinema->hash) {
             $cinema->_rev = $cinema_db->_rev;
             //utilizado mais para ter uma nocao olhando direto no banco...
             $cinema->last_update = date('d/m/y H:i:s');
             $db->save($cinema);
             //atributo utilizado para filtrar cinemas que foram atualizados para notificar clientes de atualizacao uma unica vez.
             //seta o valor temporariamente, não guarda no db, so para validacao
             $cinema->updated = 'YES';
             //Log::write($cinema->name . ' tem novidades');
         }
     } else {
         $cinema->last_update = date('d/m/y H:i:s');
         $db->save($cinema);
         $cinema->updated = 'YES';
     }
     if (!isset($cinema->updated)) {
         //controle so de validacao
         $cinema->updated = 'NO';
     }
     return $cinema;
 }
开发者ID:xxdf,项目名称:showtimes,代码行数:29,代码来源:AbstractCinemaAdapter.php

示例7: lookup_member

 public static function lookup_member($id = null, $email = null)
 {
     $id = (int) $id;
     $email = trim($email);
     $sql = "SELECT `AutoID` , `useremail`, `userFirstname`, `userLastname` FROM `user_signup`";
     if ($id || $email || $author) {
         $sql .= " WHERE";
     } else {
         return null;
     }
     if ($id) {
         $sql .= " `AutoID` = '{$id}'";
         if ($email || $author) {
             $sql .= " &&";
         }
     }
     if ($email) {
         $sql .= " `useremail` = '{$email}'";
     }
     if ($res = DatabaseFactory::passinggreen_master_db()->query($sql)) {
         if ($res->num_rows == 1) {
             $member = $res->fetch_object();
             return new Member($member->AutoID);
         } else {
             return null;
         }
     }
     return null;
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:29,代码来源:Member.class.inc.php

示例8: getFactory

 public static function getFactory()
 {
     if (!self::$factory) {
         self::$factory = new DatabaseFactory();
     }
     return self::$factory;
 }
开发者ID:alexanderkjackson-eagles,项目名称:application,代码行数:7,代码来源:DatabaseFactory.php

示例9: getOutData

 public function getOutData()
 {
     $date = $this->data['date'];
     $query = "SELECT client_ip, COUNT(client_ip) as frequency \n                    FROM SquidData \n        \t\t\tWHERE date = '{$date}'\n                    GROUP BY client_ip \n        \t\t\tORDER BY frequency DESC";
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:7,代码来源:D_ClientRequestVerticalBarPlot.php

示例10: getOutData

 public function getOutData()
 {
     $name = $this->data;
     $query = "SELECT * FROM Users WHERE name LIKE '%{$name}%'";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:7,代码来源:D_SearchUsersByName.php

示例11: getOutData

 public function getOutData()
 {
     $id = $this->data;
     $query = "SELECT roles.*, 1 as status\n                  FROM roles \n                  LEFT JOIN users_roles\n                  ON users_roles.role_id = roles.id\n                  WHERE users_roles.user_id = {$id}\n\n\t\t\t\t  UNION\n\n\t\t\t\t  SELECT roles.*, 0 as status\n                  FROM roles \n                  WHERE roles.id NOT IN \n                  (\n                  \tSELECT roles.id\n\t\t\t      \tFROM roles\n\t\t    \t  \tLEFT JOIN users_roles\n\t\t          \tON users_roles.role_id = roles.id\n\t\t          \tWHERE users_roles.user_id = {$id}\n\t\t          )";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:7,代码来源:D_ReadRolesWithStatus.php

示例12: setInData

 public function setInData($data)
 {
     $id = $data;
     $query = "DELETE FROM Users WHERE id={$id}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLQuery($query);
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:7,代码来源:D_DeleteUser.php

示例13: sendEmail

function sendEmail($recipient, $content, $subject = 'Notification', $includeStandardFooter = true)
{
    $subject = 'lanlist.org - ' . $subject;
    if (empty($content)) {
        throw new Exception('Cannot send a blank email');
    }
    $content = wordwrap($content);
    if ($includeStandardFooter) {
        $content .= "\n\n- lanlist.org";
    }
    ErrorHandler::getInstance()->beLazy();
    require_once 'Mail.php';
    require_once 'Mail/smtp.php';
    $host = 'ssl://smtp.gmail.com';
    $username = 'xconspirisist@lanlist.org';
    $password = 'ionicflame312';
    $smtp = new Mail_smtp(array('host' => $host, 'port' => 465, 'auth' => true, 'username' => $username, 'password' => $password));
    $headers = array('From' => '"lanlist.org" <mailer@lanlist.org>', 'To' => '<' . $recipient . '>', 'Subject' => $subject, 'Content-Type' => 'text/html');
    $smtp->send('<' . $recipient . '>', $headers, $content);
    ErrorHandler::getInstance()->beGreedy();
    Logger::messageDebug('Sending email to ' . $recipient . ', subject: ' . $subject);
    $sql = 'INSERT INTO email_log (subject, emailAddress, sent) VALUES (:subject, :emailAddress, now())';
    $stmt = DatabaseFactory::getInstance()->prepare($sql);
    $stmt->bindValue(':emailAddress', $recipient);
    $stmt->bindValue(':subject', $subject);
    $stmt->execute();
}
开发者ID:jamesread,项目名称:lanlist.org,代码行数:27,代码来源:misc.php

示例14: getInitialEventsList

 public function getInitialEventsList()
 {
     $sql = 'SELECT e.*, o.id AS organizerId, o.title AS organizerTitle FROM events e LEFT JOIN organizers o ON e.organizer = o.id WHERE e.dateStart > now()';
     $stmt = DatabaseFactory::getInstance()->prepare($sql);
     $stmt->execute();
     return $stmt->fetchAll();
 }
开发者ID:jamesread,项目名称:lanlist.org,代码行数:7,代码来源:EventsChecker.php

示例15: getOutData

 public function getOutData()
 {
     $actionName = $this->data;
     $query = "SELECT roles.*\n                  FROM roles\n                  LEFT JOIN roles_actions\n                  ON roles_actions.role_id = roles.id\n                  WHERE roles_actions.action_name = '{$actionName}'";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:7,代码来源:D_ReadRolesForTheAction.php


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