使用CodeIgniter 3设置mysql更新(和插入)的“速度”

In a update i'm working with it's a

UPDATE LOW_PRIORITY table 

What we have been using before is an override in the database class protect_identifiers, it typically looks like this

$this->db->_reserved_identifiers = array('*', 'LOW_PRIORITY');

It seems to be the way to roll up until CI3. Codeigniter : Error in ORDER BY CASE query (basicly the same problem)

In CI2 when you called

$this->db->_reserved_identifiers = array('*', 'LOW_PRIORITY')  

The piece of code i was trying to execute would generate

UPDATE LOW_PRIORITY table set ...

but in CI3 it would generate

UPDATE 'LOW_PRIORITY' 'table' set ... 

(it basicly tries to escape it it seems. )

Now the protect_identifiers var is protected, and I can't really update it from the outside without extending the db-class. I really don't want to do this as this seems to be my only "unsolvable" problem after the CI update.

Is it possible to handle this in a different manner?

This is what i'm trying to do

if($exist){
    if($this->db->update('LOW_PRIORITY table', $allMyDatas)
    /* 
     * Should print something like 
     * UPDATE LOW_PRIORITY table 
     * SET field = 'fielddata' WHERE something = 'something'
     */
} else {
    if($this->db->insert('LOW_PRIORITY table', $allMyDatas)
}

There are two "hacks"(?) that I know of that allow you to access such protected/private properties at runtime: reflection and closures.

Reflection documentation says everything for itself. Closures seems to be a bit more hacky way, but it's actually faster than reflection in this case. Closure#bind() allows you to get into the scope of a given object and access it from there, so to say.

Here's dummy example, but it should give you pretty good idea:

class Foo { protected $var = 'protected'; }

$foo = new Foo();
var_dump($foo); // $var value is 'protected'
$fun = function(Foo $obj) { $obj->var = 'unprotected'; };
$closure = Closure::bind($fun, null, $foo);
$closure($foo);
var_dump($foo); // $var value is now 'unprotected'

Closed as developers shouldn't do it like this. Reference the issues section in CI github.

LOW PRIORITY is an old clause for MyISAM tables. You are (or should be) using InnoDB, which has no need for such. Please elaborate on the desire for such; we can then discuss why you don't need it and/or workarounds.