Delphi:从 BDE 迁移到 DBExpress 教程

发布于 2025-01-03 16:20:03 字数 242 浏览 0 评论 0原文

我正在尝试将使用 BDE 和 DBF/MDX 数据文件的 Delphi 应用程序迁移到使用本地数据文件的 DBExpress。

简单地用 TClientDataset 替换 TTable 组件会导致涉及索引属性的错误。

我用谷歌搜索了一下,得到的只是鲍勃博士的一篇文章,其中没有提到索引,也没有演示如何使用排序方法。所有其他文章都是对 DBExpress 的一般描述,没有与我相关的细节。

有需要遵循的步骤的教程/示例吗?

I'm attempting to migrate a Delphi application using BDE, with DBF/MDX data files, to DBExpress using local data files.

Simply replacing TTable components with TClientDataset resulted in errors involving the index properties.

I Googled it and all I came up with is an article by Dr. Bob which has no mention of indexes, and does not demonstrate how to use the sort method. All the other articles were general descriptions of DBExpress with no details relevant to me.

Are there any tutorials/examples of the steps to follow?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

随风而去 2025-01-10 16:20:03

恕我直言,TTable 和 TClientDataSet 是非常不同的数据访问方法。我会建议 2 种迁移路径:

  1. 正如您所说的 DBF/MDX,请注意 Advantage Database 和 TAdsTable。您会发现它与 TTable 比 TClientDataSet 和 dbExpress 更兼容。
  2. 考虑 Anydac 及其 TADTable 作为迁移路径。除了其他 Anydac 功能之外,TADTable 看起来也是兼容且速度更快的 TTable 替代品。

IMHO, TTable and TClientDataSet are very different data access methods. I will suggest 2 migration paths:

  1. As you sayd about DBF/MDX, pay attention to Advantage Database and TAdsTable. You will find it more compatible with TTable than with TClientDataSet and dbExpress.
  2. Consider Anydac and its TADTable as a migration path. TADTable looks as a compatible and more fast TTable replacement, additionally to other Anydac features.
乱世争霸 2025-01-10 16:20:03

遗憾的是,TClientDataset 本地文件并不能替代 BDE 作为本地数据库引擎。基本上,它们是内存中的数据集,能够将数据保存在磁盘上。但它们缺乏 BDE 中可以找到的许多功能。如果您的需求很少,它们可以工作(您可以在客户端数据集 TIndexDefs 属性内定义索引),但它们可能不是您所需要的。

而且TClientDataset不是dbExpress相关的组件。它们实际上是与 MIDAS(后来更名为 Datasnap)一起引入的,作为多层应用程序中远程数据集的客户端(因此得名)(磁盘存储的功能允许断开连接的操作)。

dbExpress是一个数据访问层,可以通过“驱动程序”与不同的数据库服务器一起工作,就像ODBC/BDE/OLEDB一样。决定在 dbExpress 中仅使用单向数据集,重用现有 TClientDataset 的缓存/游标功能来提供双向游标和缓存。如果您仅使用 TClientDataset,则根本没有使用 dbExpress,并且 TClientDataset 可以与实现所需接口(包括 BDE 接口)的任何数据集一起使用。

如果您正在寻找小型且免费的引擎(只有当您的应用程序是 GPL 时 MySQL 才是免费的),您应该考虑 SQLite、Firebird(如果您只需要本地访问,则有一个“嵌入式”版本)或 Postgres 等替代品,或者还有其他几种引擎可以从商业引擎的精简版本(即 SQL Server Express 和 Oracle Express)或相对便宜的引擎中获得。

TClientDataset local files unfortunately are not a replacement for the BDE as a local database engine. Basically, they are in-memory datasets with the capability to save data on disk. But they lack many features you can find in the BDE. If your needs are minimal they can work (you can define indexes inside the client dataset TIndexDefs property), but they could be not what you need.

Moreover TClientDataset is not a dbExpress related component. They were actually introduced with MIDAS (later renamed Datasnap) as the client (hence the name) counterpart of a remote dataset in a multitier application (the capability of disk storage allows for disconnected operations).

dbExpress is a data access layer that can work with different database servers through "drivers", as ODBC/BDE/OLEDB do. It was decided to have only unidirectional datasets in dbExpress, reusing the caching/cursor capabilities of the already existing TClientDataset to provide the bidirectional cursor and cache. If you're using TClientDataset only, you're not using dbExpress at all, and TClientDataset can work with any dataset implementing the required interfaces (including BDE ones).

You should look at alternatives like SQLite, Firebird (there is an "embedded" version if you need only local access) or Postgres if you're looking for small and free engines (MySQL is free only if your application is GPL), or there are several other engines available from stripped down versions of commercial ones (i.e. SQL Server Express and Oracle Express), or relatively cheap ones.

如若梦似彩虹 2025-01-10 16:20:03

你找不到人这样做是有原因的;这不仅是一个坏主意,而且可能几乎是不可能的。

我想建议您放弃使用 ClientDataSet 的想法,因为它不应被视为“您需要的唯一数据库”,并考虑使用 IBObjects [商业!] 加 Firebird [免费] 或 dbExpress + Delphi 附带的受支持的 SQL Db 或 Interbase Express (IBX) 组件。

您会发现,您要么需要一个完整的关系 SQL dbms,甚至是一个非常小的或轻量级的数据库管理系统,来替换 BDE,甚至您可能已经习惯使用 dBase、Access 或 Paradox 表的功能集。

在这种情况下,常用教程完全适合您的情况。

There is a reason you can't find people doing that; it's not just a bad idea, it's probably nearly impossible.

I would like to suggest that you abandon the idea of using ClientDataSet as it is not to be thought of as "the only database you'll ever need", and consider using either IBObjects [commercial!] plus Firebird [free], or dbExpress + a supported SQL Db, or Interbase Express (IBX) components that come with Delphi.

You will find that you either need a full relational SQL dbms, even a very small or light one, to replace the BDE and even the featureset you might have been used to with dBase, Access, or Paradox tables.

In that case, then the usual tutorials apply perfectly to your situation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文