Welcome Guest, Not a member yet? Register   Sign In
Why InnoDB trans not work?
#1

[eluser]vps4[/eluser]
this works fine
Code:
$this->db->trans_start();
foreach ($arrs AS $arr) {
    $sql = 'UPDATE last SET open = ?, close = ?, last = ?, high = ?, low = ?, buy = ?, sell = ?, volume = ?, amount = ?, update_date = ?, update_time = ? WHERE code = ? LIMIT 1;';
    $this->db->query($sql, array(
                    $arr['open'], $arr['close'], $arr['last'], $arr['high'], $arr['low'], $arr['buy'],
                    $arr['sell'], $arr['volume'], $arr['amount'], $arr['update_date'], $arr['update_time'],
                    $arr['code']
                ));
}
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
    exit('db trans wrong');
}


this NOT work!!!
Code:
$this->db->trans_start();
foreach ($arrs AS $arr) {
    $this->db->update('last', $arr, array('code' => $code));
}
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
    exit('db trans wrong');
}
#2

[eluser]TheFuzzy0ne[/eluser]
"this NOT work!!!" is a bit vague... Can you be more specific? Do you get an error message? Does your computer explode?

I'm not sure if it works with transactions, but the profiler might help you see what's being executed. Add this to the beginning of your controller method:
Code:
$this->output->enable_profiler(TRUE);

Then, hopefully, you'll be able to see the queries and figure out what's going wrong.
#3

[eluser]Thorpe Obazee[/eluser]
[quote author="TheFuzzy0ne" date="1244727335"]"this NOT work!!!" is a bit vague... Can you be more specific? Do you get an error message? Does your computer explode?
Code:
$this->output->enable_profiler(TRUE);
[/quote]

My money is on "The computer exploded".
#4

[eluser]Dam1an[/eluser]
Good thing EL put that they will not be held responsible for exploding computers in the T&CsWink
#5

[eluser]gtech[/eluser]
also what is $code set to?




Theme © iAndrew 2016 - Forum software by © MyBB