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


PHP Doctrine_Connection类代码示例

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


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

示例1: rechargerUserProjet

 public static function rechargerUserProjet($usersprojets, Doctrine_Connection $conn = null)
 {
     $conn->execute("TRUNCATE TABLE ei_project_user");
     //On vide la table pour purger les utilisateurs
     $userprojet = $usersprojets->getElementsByTagName("user_projet");
     if ($userprojet->length > 0) {
         //s'il ya au moins une balise trouvé
         $stmt = $conn->prepare("INSERT INTO ei_project_user (project_id, user_id, project_ref,user_ref,role) " . "VALUES (:project_id, :user_id, :project_ref,:user_ref,:role) " . "ON DUPLICATE KEY UPDATE project_id=project_id,user_id=user_id,project_ref=project_ref,user_ref=user_ref,role=:role");
         foreach ($userprojet as $u) {
             $project_id = $u->getAttribute("project_id");
             $user_id = $u->getAttribute("user_id");
             $project_ref = $u->getAttribute("project_ref");
             $user_ref = $u->getAttribute("user_ref");
             $role = $u->getElementsByTagName("role")->item(0)->nodeValue;
             //recherche du projet en base
             if ($project_id != null && $project_ref != null) {
                 $q = Doctrine_Core::getTable('EiProjet')->findOneByProjectIdAndRefId($project_id, $project_ref);
                 if ($q && $q != null) {
                     //si le projet existe
                     $stmt->bindValue("project_id", $project_id);
                     $stmt->bindValue("user_id", $user_id);
                     $stmt->bindValue("project_ref", $project_ref);
                     $stmt->bindValue("user_ref", $user_ref);
                     $stmt->bindValue("role", $role);
                     $stmt->execute(array());
                 }
             }
         }
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:30,代码来源:EiProjectUserTable.class.php

示例2: getAdapter

 protected function getAdapter(Doctrine_Connection $connection)
 {
     $adapterName = strtolower($connection->getDriverName());
     if (!isset($this->adapters[$adapterName])) {
         throw new dmException(sprintf('%s is not supported. Available adapters are %s', $adapterName, implode(', ', array_keys($this->adapters))));
     }
     return new $this->adapters[$adapterName]($this->filesystem, $connection);
 }
开发者ID:jwegner,项目名称:dmSqlBackupPlugin,代码行数:8,代码来源:dmSqlBackup.php

示例3: getAssignmentsHistory

 public function getAssignmentsHistory($subject_id = null, Doctrine_Connection $conn = null)
 {
     $q = "SELECT sa_vw.* FROM  ei_subject_assignment_vw as sa_vw   ";
     if ($subject_id != null) {
         $q .= "  WHERE  sah_subject_id=" . $subject_id;
     }
     $q .= ' Order by  sah_date DESC Limit 20';
     return $conn->fetchAll($q);
 }
开发者ID:lendji4000,项目名称:compose,代码行数:9,代码来源:EiSubjectAssignmentHistoryTable.class.php

示例4: getDatabaseName

 /** Returns the name of the Doctrine database.
  *
  * @throws RuntimeException If the active connection has no DSN.
  * @return string
  */
 protected function getDatabaseName()
 {
     /* Why oh why does Doctrine_Connection not do this for us? */
     /** @noinspection PhpVoidFunctionResultUsedInspection */
     if (!($dsn = $this->_connection->getOption('dsn'))) {
         throw new RuntimeException(sprintf('Doctrine connection "%s" does not have a DSN!', $this->_connection->getName()));
     }
     $info = $this->_connection->getManager()->parsePdoDsn($dsn);
     return isset($info['dbname']) ? $info['dbname'] : null;
 }
开发者ID:todofixthis,项目名称:sfJwtPhpUnitPlugin,代码行数:15,代码来源:Driver.class.php

示例5: deleteInactiveFunctions

 public function deleteInactiveFunctions(EiProjet $ei_project, Doctrine_Connection $conn)
 {
     if ($ei_project == null) {
         return null;
     }
     //Suppression de l'objet EiFonction
     $conn->createQuery()->from('EiFonction f')->where('KalFunction.function_id=f.function_id And KalFunction.function_ref=f.function_ref')->andWhere('KalFunction.project_id=? And KalFunction.project_ref=? And KalFunction.is_active = false', array($ei_project->getProjectId(), $ei_project->getRefId()))->execute()->delete();
     //Suppression de la fonction sous Script
     $conn->createQuery()->delete()->from('KalFunction f')->where('f.project_id=? And f.project_ref=? And f.is_active = false', array($ei_project->getProjectId(), $ei_project->getRefId()))->execute();
 }
开发者ID:lendji4000,项目名称:compose,代码行数:10,代码来源:KalFunctionTable.class.php

示例6: closeConnection

 /**
  * Closes the specified connection
  *
  * @param Doctrine_Connection $connection
  * @return void
  */
 public function closeConnection(Doctrine_Connection $connection)
 {
     $connection->close();
     $key = array_search($connection, $this->_connections, true);
     if ($key !== false) {
         unset($this->_connections[$key]);
     }
     $this->_currIndex = key($this->_connections);
     unset($connection);
 }
开发者ID:adnanali,项目名称:munch,代码行数:16,代码来源:Manager.php

示例7: proceedStep1_6

 private function proceedStep1_6($exists = false)
 {
     if ($exists == true) {
         $reqSQL = "SELECT * FROM ei_node WHERE type='EiDataSet';";
         $results = $this->connexion->execute($reqSQL);
         $noeudsFils = $results->fetchAll();
         $requeteToUpdate = "UPDATE ei_data_set SET ei_node_id = #{EI_NODE_ID} WHERE id = #{ID};";
         $requeteGlobale = array();
         foreach ($noeudsFils as $noeud) {
             // Remplacement NODE ID.
             $tmpRequete = str_replace("#{EI_NODE_ID}", $noeud["id"], $requeteToUpdate);
             // Remplacement OBJ ID.
             $tmpRequete = str_replace("#{ID}", $noeud["obj_id"], $tmpRequete);
             // Ajout dans la requête globale.
             $requeteGlobale[] = $tmpRequete;
         }
         // Préparation de la requête.
         $this->displayResultStep("Préparation de la requête...");
         $requete = implode(" ", $requeteGlobale);
         // Exécution de la requête.
         $this->displayResultStep("Exécution de la requête...");
         if (strlen($requete) > 5) {
             $this->connexion->execute($requete);
         }
         // Fin.
         $this->displayResultStep("Processus terminé avec succès.");
     } else {
         $this->displayResultStep("Mise à jour du node_id du jeu de données omise.");
     }
     return false;
 }
开发者ID:lendji4000,项目名称:compose,代码行数:31,代码来源:MigrateDataSetsTemplatesTask.class.php

示例8: getMaxIdentifier

 /**
  * returns the maximum primary key value
  *
  * @return integer
  */
 public final function getMaxIdentifier()
 {
     $sql = "SELECT MAX(" . $this->getIdentifier() . ") FROM " . $this->getTableName();
     $stmt = $this->conn->getDBH()->query($sql);
     $data = $stmt->fetch(PDO::FETCH_NUM);
     return isset($data[0]) ? $data[0] : 1;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:12,代码来源:Table.php

示例9: __construct

 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     $this->supported = array('sequences' => true, 'indexes' => true, 'summary_functions' => true, 'order_by_text' => true, 'current_id' => true, 'affected_rows' => true, 'transactions' => true, 'savepoints' => true, 'limit_queries' => true, 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => false, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => true, 'identifier_quoting' => true, 'pattern_escaping' => true);
     $this->properties['sql_file_delimiter'] = "\n/\n";
     $this->properties['varchar2_max_length'] = 4000;
     $this->properties['number_max_precision'] = 38;
     parent::__construct($manager, $adapter);
 }
开发者ID:yasirgit,项目名称:afids,代码行数:8,代码来源:Oracle.php

示例10: enumIndex

 /**
  * Retrieves an enum index.
  * @see enumValue()
  *
  * @param string $fieldName
  * @param mixed $value          value of the enum considered
  * @return integer              can be string if native enums are used.
  */
 public function enumIndex($fieldName, $value)
 {
     $values = $this->getEnumValues($fieldName);
     if ($this->_conn->getAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM)) {
         return $value;
     }
     return array_search($value, $values);
 }
开发者ID:sabaki-dev,项目名称:doctrine1,代码行数:16,代码来源:Table.php

示例11: drop

 /**
  * drops this view from the database
  *
  * @throws Doctrine_View_Exception
  * @return void
  */
 public function drop()
 {
     try {
         $this->_conn->execute(sprintf(self::DROP, $this->_name));
     } catch (Doctrine_Exception $e) {
         throw new Doctrine_View_Exception($e->__toString());
     }
 }
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:14,代码来源:View.php

示例12: shutdown

 /**
  * Execute the shutdown procedure.
  *
  * @return void
  */
 public function shutdown()
 {
     if ($this->connection !== null) {
         $this->connection = null;
     }
     if ($this->_doctrineConnection !== null) {
         $this->_doctrineConnection->getManager()->closeConnection($this->_doctrineConnection);
     }
 }
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:14,代码来源:sfDoctrineDatabase.class.php

示例13: __construct

 /**
  * the constructor
  *
  * @param Doctrine_Manager $manager
  * @param PDO $pdo                          database handle
  */
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     $this->supported = array('sequences' => true, 'indexes' => true, 'affected_rows' => true, 'summary_functions' => true, 'order_by_text' => true, 'transactions' => true, 'savepoints' => true, 'current_id' => true, 'limit_queries' => 'emulated', 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => true, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => true, 'identifier_quoting' => false, 'pattern_escaping' => true);
     // initialize all driver options
     /**
     $this->options['DBA_username'] = false;
     $this->options['DBA_password'] = false;
     $this->options['database_path'] = '';
     $this->options['database_extension'] = '.gdb';
     $this->options['server_version'] = '';
     */
     parent::__construct($manager, $adapter);
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:19,代码来源:Firebird.php

示例14: __construct

 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     $this->supported = array('sequences' => true, 'indexes' => true, 'summary_functions' => true, 'order_by_text' => true, 'current_id' => true, 'affected_rows' => true, 'transactions' => true, 'savepoints' => true, 'limit_queries' => true, 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => false, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => true, 'identifier_quoting' => true, 'pattern_escaping' => true);
     /**
     $this->options['DBA_username'] = false;
     $this->options['DBA_password'] = false;
     $this->options['database_name_prefix'] = false;
     $this->options['emulate_database'] = true;
     $this->options['default_tablespace'] = false;
     $this->options['default_text_field_length'] = 2000;
     $this->options['result_prefetching'] = false;
     */
     parent::__construct($manager, $adapter);
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:14,代码来源:Oracle.php

示例15: execute

 /**
  * Executes a prepared statement
  *
  * If the prepared statement included parameter markers, you must either:
  * call PDOStatement->bindParam() to bind PHP variables to the parameter markers:
  * bound variables pass their value as input and receive the output value,
  * if any, of their associated parameter markers or pass an array of input-only
  * parameter values
  *
  *
  * @param array $params             An array of values with as many elements as there are
  *                                  bound parameters in the SQL statement being executed.
  * @return boolean                  Returns TRUE on success or FALSE on failure.
  */
 public function execute($params = null)
 {
     try {
         //$event = new Doctrine_Event($this, Doctrine_Event::STMT_EXECUTE, $this->getQuery(), $params);
         //$this->_conn->getListener()->preStmtExecute($event);
         $result = true;
         //if ( ! $event->skipOperation) {
         $result = $this->_stmt->execute($params);
         //$this->_conn->incrementQueryCount();
         //}
         //$this->_conn->getListener()->postStmtExecute($event);
         return $result;
     } catch (PDOException $e) {
         $this->_conn->rethrowException($e, $this);
     }
     return false;
 }
开发者ID:jackbravo,项目名称:doctrine,代码行数:31,代码来源:Statement.php


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