Here I come, there I am.

 

При последователно извикване на няколко сторнати процедури с MySQL в CodeIgniter, получаваме следната грешка:

Commands out of sync; you can't run this command now

Причината е проблем при превключването на резултатите, върнати от последователните заявки. Тъй като само free_result() методът не успява да flush-не правилно резултатите, правим следната кръпка:

Отваряме /system/database/drivers/mysqli/mysqli_result.php

Добавяме нов метод за следващ резултат при stored routines.

function next_result()
  {
    if (is_object($this->conn_id))
    {
      return mysqli_next_result($this->conn_id);
    }
  }

След което в кода между две извиквания добавяме просто:

 $result = $this->db->query($sql,$params);
 ...
 $result->next_result(); 
 $result->free_result(); 
 ...

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • MySpace
  • Slashdot
  • Technorati
  • TwitThis
del.icio.us Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati ReadMe.ru Dobavi.com Dao.bg Lubimi.com Ping.bg Pipe.bg Svejo.net Web-bg.com

Безподобния пост.

Related posts brought to you by Yet Another Related Posts Plugin.

Comments

One Response to “Множество Stored Routines в CodeIgniter”

  1. nofearinc on December 16th, 2009 12:53 [#]

    Други hint-ове за решение: http://codeigniter.com/forums/viewthread/73714/

Leave a Reply