<?php
/**
 * dbupgrade_model.php - FILE_DESCRIPTION_HERE
 *
 * @author $Author: dtong $
 * @version $Id: dbupgrade_model.php,v 1.1 2011/02/21 06:04:33 dtong Exp $
 * @copyright Copyright (c) 2011, Tiller Software Co., Ltd.
*/

class Dbupgrade_model extends CI_Model {
	public $error_message = '';
	public $error_number = '';

	function __construct() {
		parent::__construct();
	}

	function get_current_version() {
		//$query = $this->db->query('SELECT system_version FROM config LIMIT 1;');
		$query = $this->db->get('config');/*
		$row = $query->row();
		return $row->system_version ;*/

		foreach($query->result() as $row) {
			return $row->system_version;
		}
	}

	function update_sql($sql) {
		$ret = $this->db->simple_query($sql);
		if ( !$ret ) {
			$this->error_message = $this->db->_error_message();
			$this->error_number = $this->db->_error_number();
		}
		return $ret;
	}
}
