在哪个函数/类中,dbprefix 添加到 Codeigniter Active Record 请求中的表名中?

发布于 2025-01-07 13:27:12 字数 177 浏览 2 评论 0原文

在 Codeigniter Active Record 请求中,dbprefix 添加到表名中的是哪个函数/类?

我需要根据表名动态更改前缀,但找不到在第一个中添加前缀的函数地方。

DB_active_rec.php 有一个 dbprefix() 函数,但这似乎没有效果。

In which function/class is the dbprefix added to the table name in Codeigniter Active Record requests?

I need to dynamically change the prefix based on the table name but cannot find the function which prepends the prefix in the first place.

DB_active_rec.php has a dbprefix() function but this appears to have no effect.

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

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

发布评论

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

评论(3

心头的小情儿 2025-01-14 13:27:12

这取决于您使用的驱动程序,并且它也可能位于该驱动程序的几个位置。

尝试使用 DB_active_rec.php 文件的 set_dbprefix() 方法来覆盖它。这会变得非常混乱(跟踪您正在查询的表),我建议改为更改您的架构。

It depends on the driver you're using, and it's probably in a few places in that driver too.

Try the DB_active_rec.php file's set_dbprefix() method to override it. This will get very messy (keeping track of which table you're querying), and I would recommend changing your schema instead.

兮颜 2025-01-14 13:27:12

取自 codeigniter 网站 的一行

$this->db->set_dbprefix('newprefix');

A line taken from the codeigniter site

$this->db->set_dbprefix('newprefix');
绝對不後悔。 2025-01-14 13:27:12

在 application/config/database.php 中,您可以设置前缀变量。每当您使用 Active Records 时,都会添加前缀。

In application/config/database.php you can set a prefix variable. Anytime you use Active Records, the prefix is added.

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