mdb 转db_DB-2-MDB2

mdb 转db

mdb 转db

介绍(Intro)

Recently I had to move an existing project from using PEAR::DB to PEAR::MDB2 - the new database abstraction layer. I took notes on the parts of the code I needed to change, I hope they can benefit someone who's doing the same. Many thanks go to Lukas Smith, the lead developer, he was always responding very fast to my reports and questions in the PEAR mailing list.

最近,我不得不将现有项目从使用PEAR :: DB迁移到PEAR :: MDB2-新的数据库抽象层。 我记下了需要更改的代码部分,希望它们可以使这样做的人受益。 非常感谢首席开发人员Lukas Smith ,他一直对PEAR邮件列表中的报告和问题做出非常快速的响应。

One thing to notice in MDB2 is that it tries not to do any unnecessary work and does many things only on demand. For example when you create an object, that doesn't mean that a connection is established. It is established only when you make the first real database access, a SELECT for example.

在MDB2中要注意的一件事是,它试图不做任何不必要的工作,并且仅在需要时才做很多事情。 例如,当您创建对象时,这并不意味着已建立连接。 仅当您首次进行真正的数据库访问(例如SELECT时,才会建立该数据库。

I assume you have an idea of PEAR::DB, since this posting illustrates a DB-to-MDB2 endeavour, but even if you don't, I hope the posting will still be useful as an intro to DB and MDB2.

我假设您有一个PEAR :: DB的想法,因为此发布说明了从DB到MDB2的工作,但是即使您没有,我希望该发布对DB和MDB2的介绍还是有用的。

包括库 (Including the libs)

So first off, including the libs (I assume you have PEAR on your machine).

所以首先,包括库(我假设您的计算机上装有PEAR)。

require_once 'DB.php';
require_once 'MDB2.php';

One thing to note here is that installing MDB2 doesn't install any of the database wrappers. So if you use MySQL for example, you'd need to install it separately: pear install MDB2_Driver_mysql-beta in addition to pear install MDB2-beta

这里要注意的一件事是,安装MDB2不会安装任何数据库包装程序。 因此,例如,如果您使用MySQL,则需要单独安装它:除pear install MDB2-beta外, pear install MDB2-beta pear install MDB2_Driver_my

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值