# Zhamao Framework: DBConnection类 参考

DBConnection类 参考
类 DBConnection 继承关系图:
[图例]
DBConnection 的协作图:
[图例]

## Public 成员函数

| __construct ($params)
| __destruct ()
| prepare ($sql, $options=[])
| query (... $args)
| quote ($value, $type=ParameterType::STRING)
| exec ($sql)
| lastInsertId ($name=null)
| beginTransaction ()
| commit ()
| rollBack ()
| errorCode ()
| errorInfo ()
| getPoolName ()

## 构造及析构函数说明

## __construct()

__construct | ( |  | $params | ) |

函数调用图:

## __destruct()

__destruct | ( |  | ) |

函数调用图:

## 成员函数说明

## beginTransaction()

beginTransaction | ( |  | ) |

## commit()

commit | ( |  | ) |

## errorCode()

errorCode | ( |  | ) |

## errorInfo()

errorInfo | ( |  | ) |

## exec()

exec | ( |  | $sql | ) |

参数

  mixed | $sql |

异常

  DBException |

函数调用图:

## getPoolName()

getPoolName | ( |  | ) |

返回
  mixed

## lastInsertId()

lastInsertId | ( |  | $name = `null` | ) |

参数

  null | mixed | $name |

异常

  DBException |

## prepare()

prepare | ( |  | $sql,
|  |  | $options = `[]`
| ) |  |

参数

  mixed | $sql |
  mixed | $options |

异常

  DBException |

函数调用图:

## query()

query | ( |  | $args | ) |

异常

  DBException |

## quote()

quote | ( |  | $value,
|  |  | $type = `ParameterType::STRING`
| ) |  |

## rollBack()

rollBack | ( |  | ) |

该类的文档由以下文件生成:

- src/ZM/Store/Database/DBConnection.php