SQLdb Programming Reference/zh CN

From Free Pascal wiki
Jump to navigationJump to search

English (en) español (es) français (fr) 中文(中国大陆)‎ (zh_CN)

类结构(Class Structure)

下图仅是说明 SQLDB 页面所涉及的主要组件的继承关系和彼此关系的一个尝试。这当然不能面面俱到,甚至也没有使用任何“合理”的图结构,所以不要期望太高,不会有很深入的内容。只希望它能帮助你理解源代码更容易一点,尤其是想借助源代码搞明白在幕后真正发生了什么的时候。

(原文:The following diagram attempts to show the hierarchy and required links of the MAIN components involved in SQLdb. It is certainly not exhaustive, nor does it use any "proper" diagram structure, so please don't try to read too much into it. I hope it will make it easier to work out which bits of the source code you need to look at to really work out what is happening.)

Laz SqlDB components.png

注释(Notes)

  • 从TDatabase 到 TTransaction的连接是事务集,也是一个列表,这意味着一个数据库可以有多个事务。然而,所建立的从 TSQLConnection 到TSQLTransaction 的新连接也是事务 -- 每个数据库只有一个事务。新建的连接实际上并不隐藏此前建立的连接,但只可以使用刚刚新建的连接,使用先前已经被隐藏的连接可能是不明智的。
  • 某些继承的连接需要强制转换为新的类型才能使用。不能直接调用 SQLQuery.Transaction.Commit,因为 COMMIT 仅在 TSQLTransaction 中有定义。可以调用 SQLTransaction.Commit,或“将 SQLQuery.Transaction 转型为 TSQLTransaction 后再 commit“。

(原文:* The link from TDatabase to TTransaction is Transactions, and is a list, implying many transactions are possible for the one database. However, a new link is defined from TSQLConnection to TSQLTransaction which is Transaction - a single transaction per database. This does not actually hide the previous link, but only the new link is published, and it is probably inadvisable to use the ancestor's link.

  • Some of the inherited links need to be typecast to the new types to be useful. You can't call SQLQuery.Transaction.Commit, as Commit is only defined in TSQLTransaction. Call SQLTransaction.Commit, or "with SQLQuery.Transaction as TSQLTransaction do commit")

(这仅仅是页面内容的开始,请扩充修改页面内容)

(原文:This is only the beginning of this page ...)