-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodelo.php
75 lines (58 loc) · 1.89 KB
/
modelo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
class modelo extends CI_Model {
function __construct() {
parent::__construct();
$this->load->database();
$this->load->dbutil();
}
function listado($tabla, $strAtributos, $strInner, $strConsulta) {
$query = $this->db->query("select " . $strAtributos . " from " . $tabla . " " . $strInner . " where 1=1 " . $strConsulta);
return $query->result_array();
}
function actualizar($tabla, $strId, $id, $data) {
$this->db->where($strId, $id);
$this->db->update($tabla, $data);
}
function ingreso($tabla, $data) {
$this->db->insert($tabla, $data);
}
function eliminar($tabla, $strId, $id) {
$this->db->where($strId, $id);
return $this->db->delete($tabla);
}
function consulta($strConsulta) {
$query = $this->db->query($strConsulta);
}
function consulta_listado_bases() {
$query = $this->dbutil->list_databases();
return $query;
}
function crear_bd($bd) {
$this->load->dbforge();
return $this->dbforge->create_database($bd);
}
function listado_paginacion($tabla, $strAtributos, $strInner, $strConsulta, $limit, $start) {
$query = $this->db->query("select " . $strAtributos . " from " . $tabla . " " . $strInner . " where 1=1 " . $strConsulta . " LIMIT " . $start . "," . $limit . " ");
return $query->result_array();
}
function eliminar_todo($tabla) {
//$this->db->where($strId, $id);
return $this->db->empty_table($tabla);
}
function existe_tabla($tabla) {
$bool = 0;
if ($this->db->table_exists($tabla)) {
$bool = 1;
}
return $bool;
}
function existe_base($bd) {
$this->load->dbutil();
$bool = 0;
if ($this->dbutil->database_exists($bd)) {
$bool = 1;
}
return $bool;
}
}
?>