function saveData($data) { $id = $data['table_id'] = dbIdReport('table', 'create Tables', json_encode($data), 120); $data['table_created'] = date("Y-m-d H:i:s"); $this->db->insert($this->table, $data); $str = $this->db->last_query(); logConfig("create Tables:{$str}", 'logDB'); //==========TAMBAHKAN STATUS $data2 = array('tabstat_tables' => $id, 'tabstat_status' => 1); $this->db->insert($this->tableRel, $data2); $str = $this->db->last_query(); logConfig("create Relation:{$str}", 'logDB'); $data2 = array('tabstat_tables' => $id, 'tabstat_status' => 2); $this->db->insert($this->tableRel, $data2); $str = $this->db->last_query(); logConfig("create Relation:{$str}", 'logDB'); //==========CREATE TABLE========== $prefix = $data['table_prefix'] . "_"; $fields = array($prefix . 'id' => array('type' => 'BIGINT', 'auto_increment' => TRUE), $prefix . 'code' => array('type' => 'VARCHAR', 'constraint' => '100'), $prefix . 'name' => array('type' => 'VARCHAR', 'constraint' => '100'), $prefix . 'detail' => array('type' => 'text'), $prefix . 'modified' => array('type' => 'timestamp'), $prefix . 'created' => array('type' => 'datetime'), $prefix . 'status' => array('type' => 'int')); for ($i = 1; $i <= 10; $i++) { $name1 = sprintf("%sfield%02s", $prefix, $i); $fields[$name1] = array('type' => 'VARCHAR', 'constraint' => '100'); } $this->dbforge->add_field($fields); $this->dbforge->add_key($prefix . 'id', TRUE); $this->dbforge->create_table($data['table_name'], TRUE); $str = $this->db->last_query(); logConfig("create table:{$str}", 'logDB'); $this->db->reset_query(); return $id; }
function saveData($data) { $id = $data['gun_id'] = dbIdReport('id', 'create Gundam', json_encode($data), 100); $data['gun_created'] = date("Y-m-d H:i:s"); $this->db->insert($this->table, $data); $str = $this->db->last_query(); logConfig("create Gundam:{$str}", 'logDB'); return $id; }
function saveData($data) { $id = $data['stat_id'] = dbIdReport('status', 'create Status', json_encode($data), 2000); $data['stat_created'] = date("Y-m-d H:i:s"); $this->db->insert($this->table, $data); $str = $this->db->last_query(); logConfig("create Status:{$str}", 'logDB'); return $id; }
function saveData($data) { $id = $data['country_id'] = dbIdReport('permit', 'create Permision', json_encode($data), 10); $data['country_created'] = date("Y-m-d H:i:s"); $this->db->insert($this->table, $data); $str = $this->db->last_query(); logConfig("create Permision:{$str}", 'logDB'); return $id; }
public function run($module = '', $action = '', $param = array()) { $driver = $this->CI->altodriver; $result = $driver->run($module, $action, $param); logConfig('altoLibs|module:' . $module . '|action:' . $action . '|result:' . json_encode($result), 'logCoreAlto', 'debug'); logConfig('altoLibs|module:' . $module . '|action:' . $action, 'logAlto'); if ($result) { return $result; } else { //$result['message'], $result['code'] return array('code' => 13, 'message' => 'unknown result'); } }
function dbQuery($sql, $debug = 0) { $CI =& get_instance(); //$params = $CI->config->item('logConfig'); $query = $CI->db->query($sql); if (!$query) { logCreate($CI->db->error(), 'error'); logConfig('sql:' . $sql . '|error:' . print_r($CI->db->error(), 1), 'logDB', 'error'); return false; } else { //$query = $CI->db->query($sql); if ($debug == 1) { logCreate('sql:' . $sql . '|affected:' . $CI->db->affected_rows(), 'query'); } else { } logConfig('sql:' . $sql . '|affected:' . $CI->db->affected_rows(), 'logDB', 'query'); } return $query; }
public function __construct() { $this->CI =& get_instance(); logConfig('altoDriver|type:user', 'logAlto', 'info'); }
function test() { $dir = APPPATH . 'libraries/Altodriver/drivers'; if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { logConfig('dir:' . $dir . '|file:' . $entry, 'logAlto'); } } }
public function test() { $this->param['baseFolder'] = 'demo/'; $this->param['folder'] = 'demo/'; $this->param['content'] = 'table'; //$this->config->load('logConfig', TRUE); //$logConfig = $this->config->item( 'logConfig'); //var_dump( $logConfig ); die('--'); logCreate('hello'); logConfig('hello core', 'logCore'); logConfig('hello error', 'logError'); $this->load->view('demo/baseAdmin_view', $this->param); }
private function error($message = '', $code = 13, $detail = array()) { logConfig('code:' . $code . '|message:' . json_encode($message), 'logErrorAlto', 'error'); $res = array('code' => $code, 'message' => (string) $message); if (count($detail) != 0) { $res['detail'] = $detail; logConfig('message:' . json_encode($detail), 'logErrorAlto', 'error'); } else { } echo json_encode($res); exit; }