维基副本镜像

这是 pascal.chat 维基的镜像。编辑、历史记录和登录都在那里。

SQLdb Package/zh CN

English · Español · Français · 中文(中国) · 日本語

组件(Components)

SQLdb 包提供下列组件:

(原文:The SQLdb package provides the following components:)

TSQLQuery

查询组件,继承自 TDataset, 功能是将提交的 SQL 查询执行后的结果数据集作为一张表中来使用。但也可以用来执行不返回任何数据集的SQL查询。

(原文:This is a descendant of TDataset, and provides the data as a table from the SQL query that you submit. But can also be used to execute SQL-queries that don't return any data.)

TSQLTransaction

事务组件,封装了发生在数据库服务器上的事务。最重要的一点是,它使用 commit 或 rollback 方法来完成或取消数据库的事务。

(原文:This encapsulates the transaction on the database server. I am not going to say much about it as I haven't quite worked out the details myself! The important bit is that it has the commit and rollback methods to finish or cancel your transaction on the database.)

TXXXConnection

连接组件,XXX代表你所连接的数据库。每种连接组件都要配合 SQLQuery 组件和 SqlTransaction 组件一同使用,负责将 SQLQuery 发出的“标准”请求,转换成数据库请求,转换要符合所使用的特定数据库的专用语法格式。

实际包括的组件有:

(原文:where XXX is the flavour of the database you are connecting to. Each one of these components takes the "standard" requests of the SQLQuery and SQLTransaction components and translates them into database requests, allowing for the idiosyncrasies of the specific database you are using.

The actual components are:

使用 SQLdb 包(Using the SQLdb Package)

使用 SQLdb 包时,必须三种组件同时搭配使用:TSQLQuery、TSQLTransaction 和一种连接组件。

快速入门教程:

从下一步开始,对任何数据库添加控件的步骤、方法都是相同的,简单回顾如下:

当然,这仅仅是开始。但在表格中显示一些数据通常是确认数据库连接能够正常工作的第一步。更详细的解释可参见Working With TSQLQuery

(原文:To use the SQLdb package, you need a TSQLQuery component, a TSQLTransaction component, and one of the connection components.

Here is a quick tutorial:

From here on, adding controls is the same as for any database, but just to recap:

OF course, this is just the beginning, but getting some data in a grid is usually the first step to ensure the database connection is working. More detailed explanations will be found at Working With TSQLQuery.)

Notes

More details will be found in SQLdb Programming Reference

The pages related to the SQLdb package were initially written from explorations done using TPQConnection, using a PostgreSQL 8.1 database on Win XP O/S. They are expected to be true for the other databases and OSes as well. If you can confirm this, please leave a note here.

There are some notes and documentation started: http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=fcldbnotes

An interface view of the classes is availble: http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=index-4&unit=sqldb


From the Free Pascal wiki, page "SQLdb Package/zh CN", as it stood on 2012-02-03 after a change by Chronos, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

版本1,最后由WikiArchive于修改。