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

StackOverflow https://stackoverflow.com/questions/9365594

문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

A line taken from the codeigniter site

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top