Patches to CodeIgniter for Sqlite Support

See CodeIgniter Forums

Note: The following doesn’t quite work as well.

From Price Change Blog (in Japanese):


function list_fields($table = '')
{
	// Is there a cached result?
	if (isset($this->data_cache['field_names'][$table]))
	{
		return $this->data_cache['field_names'][$table];
	}

	if ($table == '')
	{
		if ($this->db_debug)
		{
			return $this->display_error('db_field_param_missing');
		}
		return FALSE;
	}
	$sql = "SELECT * FROM ".$this->escape($table)." LIMIT 1";
	$query = $this->query($sql);

	$retval = array();

	if ($query->num_rows() > 0)
	{
		$row = $query->row_array();
		$keys = array_keys($row);
		foreach ($keys as $val)
		{
			if (!is_int($val))
				$retval[] = $val;
		}
	}

	$this->data_cache['field_names'][$table] = $retval;
	return $this->data_cache['field_names'][$table];
}


$query = $this->query("SELECT COUNT(*) AS numrows FROM '".$this->dbprefix.$table."'");

Leave a Reply