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


PHP DB::parseDSN方法代码示例

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


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

示例1: __construct

 function __construct($log_conn_id, $log_date)
 {
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->db = $dsn['database'];
     $this->log_conn_id = $log_conn_id;
     $this->log_date = $log_date;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:7,代码来源:Reverter.php

示例2: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     // don’t display the ‘Add these Contacts to Group’ button
     $this->_add2groupSupported = FALSE;
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->loggingDB = $dsn['database'];
     // used for redirect back to contact summary
     $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
     $this->_logTables = array('log_civicrm_contact' => array('fk' => 'id'), 'log_civicrm_email' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_phone' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_address' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_note' => array('fk' => 'entity_id', 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_note_comment' => array('fk' => 'entity_id', 'table_name' => 'log_civicrm_note', 'joins' => array('table' => 'log_civicrm_note', 'join' => "entity_log_civireport.entity_id = fk_table.id AND entity_log_civireport.entity_table = 'civicrm_note'"), 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_group_contact' => array('fk' => 'contact_id', 'bracket_info' => array('entity_column' => 'group_id', 'table' => 'log_civicrm_group', 'column' => 'title'), 'action_column' => 'status', 'log_type' => 'Group'), 'log_civicrm_entity_tag' => array('fk' => 'entity_id', 'bracket_info' => array('entity_column' => 'tag_id', 'table' => 'log_civicrm_tag', 'column' => 'name'), 'entity_table' => TRUE), 'log_civicrm_relationship' => array('fk' => 'contact_id_a', 'bracket_info' => array('entity_column' => 'relationship_type_id', 'table' => 'log_civicrm_relationship_type', 'column' => 'label_a_b')), 'log_civicrm_activity_for_target' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "(entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$targetID})"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_assignee' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$assigneeID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_source' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$sourceID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_case' => array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_case_contact', 'join' => 'entity_log_civireport.id = fk_table.case_id'), 'bracket_info' => array('entity_column' => 'case_type_id', 'options' => CRM_Case_PseudoConstant::caseType('title', FALSE))));
     $logging = new CRM_Logging_Schema();
     // build _logTables for contact custom tables
     $customTables = $logging->entityCustomDataLogTables('Contact');
     foreach ($customTables as $table) {
         $this->_logTables[$table] = array('fk' => 'entity_id', 'log_type' => 'Contact');
     }
     // build _logTables for address custom tables
     $customTables = $logging->entityCustomDataLogTables('Address');
     foreach ($customTables as $table) {
         $this->_logTables[$table] = array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_address', 'join' => 'entity_log_civireport.entity_id = fk_table.id'), 'log_type' => 'Contact');
     }
     // Allow log tables to be extended via report hooks.
     CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->_logTables);
     parent::__construct();
 }
开发者ID:vincent1892,项目名称:contact_report,代码行数:31,代码来源:ReportSummary.php

示例3: __construct

 function __construct()
 {
     // don’t display the ‘Add these Contacts to Group’ button
     $this->_add2groupSupported = FALSE;
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->db = $dsn['database'];
     $this->log_conn_id = CRM_Utils_Request::retrieve('log_conn_id', 'Integer', CRM_Core_DAO::$_nullObject);
     $this->log_date = CRM_Utils_Request::retrieve('log_date', 'String', CRM_Core_DAO::$_nullObject);
     $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
     $this->raw = CRM_Utils_Request::retrieve('raw', 'Boolean', CRM_Core_DAO::$_nullObject);
     parent::__construct();
     CRM_Utils_System::resetBreadCrumb();
     $breadcrumb = array(array('title' => ts('Home'), 'url' => CRM_Utils_System::url()), array('title' => ts('CiviCRM'), 'url' => CRM_Utils_System::url('civicrm', 'reset=1')), array('title' => ts('View Contact'), 'url' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")), array('title' => ts('Search Results'), 'url' => CRM_Utils_System::url('civicrm/contact/search', "force=1")));
     CRM_Utils_System::appendBreadCrumb($breadcrumb);
     if (CRM_Utils_Request::retrieve('revert', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         $reverter = new CRM_Logging_Reverter($this->log_conn_id, $this->log_date);
         $reverter->revert($this->tables);
         CRM_Core_Session::setStatus(ts('The changes have been reverted.'));
         if ($this->cid) {
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
         } else {
             CRM_Utils_System::redirect(CRM_Report_Utils_Report::getNextUrl($this->summary, 'reset=1', FALSE, TRUE));
         }
     }
     // make sure the report works even without the params
     if (!$this->log_conn_id or !$this->log_date) {
         $dao = new CRM_Core_DAO();
         $dao->query("SELECT log_conn_id, log_date FROM `{$this->db}`.log_{$this->tables[0]} WHERE log_action = 'Update' ORDER BY log_date DESC LIMIT 1");
         $dao->fetch();
         $this->log_conn_id = $dao->log_conn_id;
         $this->log_date = $dao->log_date;
     }
     $this->_columnHeaders = array('field' => array('title' => ts('Field')), 'from' => array('title' => ts('Changed From')), 'to' => array('title' => ts('Changed To')));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:34,代码来源:ReportDetail.php

示例4: __construct

 /**
  * Populate $this->tables and $this->logs with current db state.
  */
 public function __construct()
 {
     $dao = new CRM_Contact_DAO_Contact();
     $civiDBName = $dao->_database;
     $dao = CRM_Core_DAO::executeQuery("\nSELECT TABLE_NAME\nFROM   INFORMATION_SCHEMA.TABLES\nWHERE  TABLE_SCHEMA = '{$civiDBName}'\nAND    TABLE_TYPE = 'BASE TABLE'\nAND    TABLE_NAME LIKE 'civicrm_%'\n");
     while ($dao->fetch()) {
         $this->tables[] = $dao->TABLE_NAME;
     }
     // do not log temp import, cache, menu and log tables
     $this->tables = preg_grep('/^civicrm_import_job_/', $this->tables, PREG_GREP_INVERT);
     $this->tables = preg_grep('/_cache$/', $this->tables, PREG_GREP_INVERT);
     $this->tables = preg_grep('/_log/', $this->tables, PREG_GREP_INVERT);
     $this->tables = preg_grep('/^civicrm_queue_/', $this->tables, PREG_GREP_INVERT);
     $this->tables = preg_grep('/^civicrm_menu/', $this->tables, PREG_GREP_INVERT);
     //CRM-14672
     $this->tables = preg_grep('/_temp_/', $this->tables, PREG_GREP_INVERT);
     // do not log civicrm_mailing_event* tables, CRM-12300
     $this->tables = preg_grep('/^civicrm_mailing_event_/', $this->tables, PREG_GREP_INVERT);
     // do not log civicrm_mailing_recipients table, CRM-16193
     $this->tables = array_diff($this->tables, array('civicrm_mailing_recipients'));
     if (defined('CIVICRM_LOGGING_DSN')) {
         $dsn = DB::parseDSN(CIVICRM_LOGGING_DSN);
         $this->useDBPrefix = CIVICRM_LOGGING_DSN != CIVICRM_DSN;
     } else {
         $dsn = DB::parseDSN(CIVICRM_DSN);
         $this->useDBPrefix = FALSE;
     }
     $this->db = $dsn['database'];
     $dao = CRM_Core_DAO::executeQuery("\nSELECT TABLE_NAME\nFROM   INFORMATION_SCHEMA.TABLES\nWHERE  TABLE_SCHEMA = '{$this->db}'\nAND    TABLE_TYPE = 'BASE TABLE'\nAND    TABLE_NAME LIKE 'log_civicrm_%'\n");
     while ($dao->fetch()) {
         $log = $dao->TABLE_NAME;
         $this->logs[substr($log, 4)] = $log;
     }
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:37,代码来源:Schema.php

示例5: _connectDB

 /**
  * Connect to database by using the given DSN string
  *
  * @author  copied from PEAR::Auth, Martin Jansen, slightly modified
  * @access private
  * @param  string DSN string
  * @return mixed  Object on error, otherwise bool
  */
 function _connectDB($dsn)
 {
     // only include the db if one really wants to connect
     require_once 'DB.php';
     if (is_string($dsn) || is_array($dsn)) {
         // put the dsn parameters in an array
         // DB would be confused with an additional URL-queries, like ?table=...
         // so we do it before connecting to the DB
         if (is_string($dsn)) {
             $dsn = DB::parseDSN($dsn);
         }
         $this->dbh = DB::Connect($dsn);
     } else {
         if (get_parent_class($dsn) == "db_common") {
             $this->dbh = $dsn;
         } else {
             if (is_object($dsn) && DB::isError($dsn)) {
                 return new DB_Error($dsn->code, PEAR_ERROR_DIE);
             } else {
                 return new PEAR_Error("The given dsn was not valid in file " . __FILE__ . " at line " . __LINE__, 41, PEAR_ERROR_RETURN, null, null);
             }
         }
     }
     if (DB::isError($this->dbh)) {
         return new DB_Error($this->dbh->code, PEAR_ERROR_DIE);
     }
     return true;
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:36,代码来源:OptionsDB.php

示例6: __construct

 /**
  * Initialize the constants used during lock acquire / release
  *
  * @param string  $name name of the lock. Please prefix with component / functionality
  *                      e.g. civimail.cronjob.JOB_ID
  * @param int     $timeout the number of seconds to wait to get the lock. 1 if not set
  * @param boolean $serverWideLock should this lock be applicable across your entire mysql server
  *                                this is useful if you have mutliple sites running on the same
  *                                mysql server and you want to limit the number of parallel cron
  *                                jobs - CRM-91XX
  *
  * @return object the lock object
  *
  */
 function __construct($name, $timeout = NULL, $serverWideLock = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $dsnArray = DB::parseDSN($config->dsn);
     $database = $dsnArray['database'];
     $domainID = CRM_Core_Config::domainID();
     if ($serverWideLock) {
         $this->_name = $name;
     } else {
         $this->_name = $database . '.' . $domainID . '.' . $name;
     }
     if (defined('CIVICRM_LOCK_DEBUG')) {
         CRM_Core_Error::debug_log_message('trying to construct lock for ' . $this->_name);
     }
     static $jobLog = FALSE;
     if ($jobLog && CRM_Core_DAO::singleValueQuery("SELECT IS_USED_LOCK( '{$jobLog}')")) {
         return $this->hackyHandleBrokenCode($jobLog);
     }
     if (stristr($name, 'civimail.job.')) {
         $jobLog = $this->_name;
     }
     //if (defined('CIVICRM_LOCK_DEBUG')) {
     //CRM_Core_Error::debug_var('backtrace', debug_backtrace());
     //}
     $this->_timeout = $timeout !== NULL ? $timeout : self::TIMEOUT;
     $this->acquire();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:41,代码来源:Lock.php

示例7: __construct

 /**
  * @param int $log_conn_id
  * @param $log_date
  * @param string $interval
  */
 public function __construct($log_conn_id, $log_date, $interval = '10 SECOND')
 {
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->db = $dsn['database'];
     $this->log_conn_id = $log_conn_id;
     $this->log_date = $log_date;
     $this->interval = $interval;
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:13,代码来源:Differ.php

示例8: getDBConn

 function getDBConn($dsn, $persistent)
 {
     @($obj =& new db_Wrap());
     debug("DB", "connecting to: {$dsn}");
     $dsninfo = DB::parseDSN($dsn);
     $obj->connect($dsninfo, $persistent);
     return $obj;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:8,代码来源:db_Wrap.class.php

示例9: __construct

 function __construct()
 {
     $this->_add2groupSupported = false;
     // don’t display the ‘Add these Contacts to Group’ button
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->loggingDB = $dsn['database'];
     $this->_columns = array('log_civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('id' => array('no_display' => true, 'required' => true), 'log_user_id' => array('no_display' => true, 'required' => true), 'log_date' => array('default' => true, 'required' => true, 'type' => CRM_Utils_Type::T_TIME, 'title' => ts('When')), 'altered_contact' => array('default' => true, 'name' => 'display_name', 'title' => ts('Altered Contact')), 'log_conn_id' => array('no_display' => true, 'required' => true), 'log_action' => array('default' => true, 'title' => ts('Action')), 'is_deleted' => array('no_display' => true, 'required' => true)), 'filters' => array('log_date' => array('title' => ts('When'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE), 'altered_contact' => array('name' => 'display_name', 'title' => ts('Altered Contact'), 'type' => CRM_Utils_Type::T_STRING), 'log_action' => array('operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array('Insert' => ts('Insert'), 'Update' => ts('Update'), 'Delete' => ts('Delete')), 'title' => ts('Action'), 'type' => CRM_Utils_Type::T_STRING))), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('altered_by' => array('default' => true, 'name' => 'display_name', 'title' => ts('Altered By'))), 'filters' => array('altered_by' => array('name' => 'display_name', 'title' => ts('Altered By'), 'type' => CRM_Utils_Type::T_STRING))));
     parent::__construct();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:9,代码来源:LoggingSummary.php

示例10: connect

 public static function connect($dsn = null)
 {
     $pdsn = DB::parseDSN($dsn);
     if (!empty($pdsn)) {
         $db_port = empty($pdsn['port']) ? '' : ';port=' . $pdsn['port'];
         return new DB(new \FreePBX\Database($pdsn['dbsyntax'] . ':host=' . $pdsn['hostspec'] . $db_port . ';dbname=' . $pdsn['database'], $pdsn['username'], $pdsn['password']));
     }
     throw new \Exception(_("Could not understand DSN for connect"));
 }
开发者ID:powerpbx,项目名称:framework,代码行数:9,代码来源:DB.class.php

示例11: array

 function &connect($dsn, $options = array())
 {
     $dsninfo = DB::parseDSN($dsn);
     $type = $dsninfo['phptype'];
     @($obj = DB::factory($type, $options));
     $obj->_dsninfo = $dsninfo;
     $obj->_dboptions = $options;
     return $obj;
 }
开发者ID:mickdane,项目名称:zidisha,代码行数:9,代码来源:cachedDB.php

示例12: makeConnection

 function makeConnection($dsn, $persistent)
 {
     if ($this->debug) {
         logger("DB", "connecting to: {$dsn}");
     }
     $dsninfo = DB::parseDSN($dsn);
     $success = $this->connect($dsninfo, $persistent);
     return $success;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:9,代码来源:db_Wrap.class.php

示例13: Ethna_DB_PEAR

 /**
  *	Ethna_DB_PEARクラスのコンストラクタ
  *
  *	@access	public
  *	@param	object	Ethna_Controller	&$controller	コントローラオブジェクト
  *	@param	string	$dsn								DSN
  *	@param	bool	$persistent							持続接続設定
  */
 function Ethna_DB_PEAR(&$controller, $dsn, $persistent)
 {
     parent::Ethna_DB($controller, $dsn, $persistent);
     $this->db = null;
     $this->logger =& $controller->getLogger();
     $this->sql =& $controller->getSQL();
     $dsninfo = DB::parseDSN($dsn);
     $this->type = $dsninfo['phptype'];
 }
开发者ID:BackupTheBerlios,项目名称:delphinus-svn,代码行数:17,代码来源:Ethna_DB_PEAR.php

示例14: view_dsn

 function view_dsn($dsn = false)
 {
     if (!$dsn) {
         $dsninfo = DB::parseDSN($GLOBALS['DBParams']['dsn']);
     } else {
         $dsninfo = DB::parseDSN($dsn);
     }
     return sprintf("%s://%s:<not displayed>@%s/%s", $dsninfo['phptype'], $dsninfo['username'], $dsninfo['hostspec'], $dsninfo['database']);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:9,代码来源:SQL.php

示例15: __construct

 function __construct($name, $timeout = null)
 {
     $config = CRM_Core_Config::singleton();
     $dsnArray = DB::parseDSN($config->dsn);
     $database = $dsnArray['database'];
     $domainID = CRM_Core_Config::domainID();
     $this->_name = $database . '.' . $domainID . '.' . $name;
     $this->_timeout = $timeout ? $timeout : self::TIMEOUT;
     $this->acquire();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:10,代码来源:Lock.php


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