goFrendiAsgard / No-CMS

No-CMS, A CodeIgniter Based CMS Framework
299 stars 199 forks source link

sqlite database locked #78

Open goFrendiAsgard opened 10 years ago

goFrendiAsgard commented 10 years ago

Sqlite database locked when doing repeating request. This might be sqlite version issue (as pointed here: http://stackoverflow.com/questions/6101480/sqlite-3-locking-in-php) or codeigniter pdo issue (as always).

NOTE TO MYSELF:

I've change num_rows function in /system/database/drivers/pdo/pdo_result.php into this:

        public function num_rows()
    {

                if (is_int($this->num_rows))
        {
            return $this->num_rows;
        }
        elseif (count($this->result_array) > 0)
        {
            return $this->num_rows = count($this->result_array);
        }
        elseif (count($this->result_object) > 0)
        {
            return $this->num_rows = count($this->result_object);
        }

                /*
                if (is_int($this->num_rows))
        {
            return $this->num_rows;
        }
        elseif (count($this->result_array) > 0)
        {
            return $this->num_rows = count($this->result_array);
        }
        elseif (count($this->result_object) > 0)
        {
            return $this->num_rows = count($this->result_object);
        }
        elseif (($num_rows = $this->result_id->rowCount()) > 0)
        {
            return $this->num_rows = $num_rows;
        }
                */

        return $this->num_rows = count($this->result_array());
    }

since ($num_rows = $this->result_id->rowCount()) > 0 show a strange result

goFrendiAsgard commented 10 years ago

changes so far https://github.com/goFrendiAsgard/No-CMS/commit/1248e558c62ab3329acd68c58dda3f578fd72a96