phpDocumentor db
[ class tree: db ] [ index: db ] [ all elements ]

Class: WindConnectionManager

Source Location: /db/WindConnectionManager.php

Class WindConnectionManager

Class Overview

数据库链接管理

配置说明:

  1.  1. 当没有任何策略部署时 ,默认返回当前配置中的第一个链接句柄
  2.  2. 当没有任何策略部署时,如果在sql语句中有链接句柄指定时则返回指定的链接句柄
  3.  例如:'{db1:tableName}'返回db1指定的链接句柄
  4.  3. 如果当前有策略部署时,则按照策略部署规则返回
  5.  4. createStatement($sql null$forceMaster false)
  6.  $forceMaster为true时则强制主链接
  7.  配置格式如下:
  8.  <connections except='*:db1;user*,tablename2:db1|db2;'>
  9.  <connection name='db1'>
  10.  <dsn>mysql:host=localhost;dbname=test</dsn>
  11.  <user>root</user>
  12.  <pwd>root</pwd>
  13.  <charset>utf8</charset>
  14.  <tablePrefix>pw_</tablePrefix>
  15.  </connection>
  16.  <connection name='db2'>
  17.  <dsn>mysql:host=localhost;dbname=test</dsn>
  18.  <user>root</user>
  19.  <pwd>root</pwd>
  20.  <charset>utf8</charset>
  21.  <tablePrefix>pw_</tablePrefix>
  22.  </connection>
  23.  </connections>

Located in /db/WindConnectionManager.php [line 37]

WindModule
   |
   --WindConnection
      |
      --WindConnectionManager
Author(s): Information Tags:
Version:  $Id: WindConnectionManager.php 3397 2012-03-14 08:49:50Z yishuo $
Copyright:  ©2003-2103 phpwind.com
License:  http://www.windframework.com

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From WindConnection

WindConnection::$_attributes
WindConnection::$_charset
WindConnection::$_dbHandle
WindConnection::$_driverName
WindConnection::$_dsn
WindConnection::$_pwd
WindConnection::$_tablePrefix
WindConnection::$_user

Inherited From WindModule

WindModule::$_config
WindModule::$_proxy
WindModule::$_typeValidation

Inherited From WindConnection

WindConnection::__construct()
WindConnection::close()
关闭数据库连接
WindConnection::createStatement()
接受一条sql语句,并返回sqlStatement对象
WindConnection::createTable()
创建表,返回是否创建成功
WindConnection::execute()
执行一条sql语句 同时返回影响行数
WindConnection::getAttribute()
获得链接相关属性设置
WindConnection::getDbHandle()
返回数据库链接对象
WindConnection::getDriverName()
返回DB驱动类型
WindConnection::getTablePrefix()
获得表前缀
WindConnection::init()
初始化DB句柄
WindConnection::lastInsertId()
返回最后一条插入的数据值,当传一个'name'给该方法,则返回'name'对应的列值
WindConnection::parseQueryString()
解析当前查询语句,并返回解析后结果
WindConnection::query()
执行一条查询同时返回结果集
WindConnection::quote()
sql元数据安全过滤,并返回过滤后值
WindConnection::quoteArray()
过滤数组变量,将数组变量转换为字符串,并用逗号分隔每个数组元素支持多维数组
WindConnection::quoteMultiArray()
过滤二维数组将数组变量转换为多组的sql字符串
WindConnection::setAttribute()
设置链接相关属性
WindConnection::setConfig()
(non-PHPdoc)
WindConnection::setTablePrefix()
设置表前缀
WindConnection::sqlMetadata()
过滤SQL元数据,数据库对象(如表名字,字段等)
WindConnection::sqlSingle()
过滤数组值并返回(insert/update)sql语句形式
WindConnection::_initConfig()
根据配置信息,初始化当前连接对象

Inherited From WindModule

WindModule::getConfig()
根据配置名取得相应的配置
WindModule::getRequest()
返回当前应用的WindHttpRequest对象
WindModule::getResponse()
返回当前应用的WindHttpResponse对象
WindModule::getSystemFactory()
返回当前应用的WindFactory对象
WindModule::setConfig()
设置类配置
WindModule::setDelayAttributes()
设置延迟加载类属性相关组件配置信息
WindModule::toArray()
返回该对象的数组类型
WindModule::writeTableCloneProperty()
类对象clone白名单
WindModule::__call()
重载了魔术方法__call
WindModule::__clone()
重载魔术方法__clone
WindModule::__get()
重载了魔术方法__get
WindModule::__set()
重载了魔术方法__set

[ Top ]
Method Summary
void   createStatement()  
void   getDbHandle()  
void   init()  
void   parseQueryString()  
void   _initConfig()  

[ Top ]
Methods
createStatement  [line 79]

  void createStatement( [ $sql = null], [ $forceMaster = false]  )

Parameters:
   $sql: 
   $forceMaster: 

API Tags:
Access:  public


Redefinition of:
WindConnection::createStatement()
接受一条sql语句,并返回sqlStatement对象

[ Top ]
getDbHandle  [line 87]

  void getDbHandle( )


API Tags:
Access:  public


Redefinition of:
WindConnection::getDbHandle()
返回数据库链接对象

[ Top ]
init  [line 95]

  void init( )


API Tags:
Access:  public


Redefinition of:
WindConnection::init()
初始化DB句柄

[ Top ]
parseQueryString  [line 120]

  void parseQueryString( $sql  )

Parameters:
   $sql: 

API Tags:
Access:  protected


Redefinition of:
WindConnection::parseQueryString()
解析当前查询语句,并返回解析后结果

[ Top ]
_initConfig  [line 203]

  void _initConfig( )


API Tags:
Access:  protected


Redefinition of:
WindConnection::_initConfig()
根据配置信息,初始化当前连接对象

[ Top ]

Documentation generated on Fri, 30 Mar 2012 11:43:29 +0800 by phpDocumentor 1.4.4