| 13 |
13 |
|
| 14 |
14 |
// Global benchmark
|
| 15 |
15 |
public static $benchmarks = array();
|
|
16 |
|
|
17 |
private static $profile_all = FALSE;
|
| 16 |
18 |
|
| 17 |
19 |
// Configuration
|
| 18 |
20 |
protected $config = array
|
| ... | ... | |
| 101 |
103 |
|
| 102 |
104 |
// Merge the default config with the passed config
|
| 103 |
105 |
$this->config = array_merge($this->config, $config);
|
|
106 |
|
|
107 |
// Set the profile_all flag
|
|
108 |
if(isset($this->config['profile_all']))
|
|
109 |
{
|
|
110 |
$this->profile_all = $this->config['profile_all'];
|
|
111 |
}
|
| 104 |
112 |
|
| 105 |
113 |
if (is_string($this->config['connection']))
|
| 106 |
114 |
{
|
| ... | ... | |
| 1064 |
1072 |
|
| 1065 |
1073 |
$this->reset_select();
|
| 1066 |
1074 |
|
| 1067 |
|
return $this->driver->list_tables();
|
|
1075 |
$start = microtime(true);
|
|
1076 |
|
|
1077 |
$result = $this->driver->list_tables();
|
|
1078 |
|
|
1079 |
$stop = microtime(true);
|
|
1080 |
|
|
1081 |
if($this->profile_all)
|
|
1082 |
{
|
|
1083 |
self::$benchmarks[] = array('query' => 'Database::list_tables()', 'time' => $stop - $start, 'rows' => count($result));
|
|
1084 |
}
|
|
1085 |
|
|
1086 |
return $result;
|
| 1068 |
1087 |
}
|
| 1069 |
1088 |
|
| 1070 |
1089 |
/**
|
| ... | ... | |
| 1117 |
1136 |
{
|
| 1118 |
1137 |
$this->link or $this->connect();
|
| 1119 |
1138 |
|
| 1120 |
|
return $this->driver->field_data($this->config['table_prefix'].$table);
|
|
1139 |
$start = microtime(true);
|
|
1140 |
|
|
1141 |
$result = $this->driver->field_data($this->config['table_prefix'].$table);
|
|
1142 |
|
|
1143 |
$stop = microtime(true);
|
|
1144 |
|
|
1145 |
if($this->profile_all)
|
|
1146 |
{
|
|
1147 |
self::$benchmarks[] = array('query' => 'Database::field_data(\'' . $table . '\')', 'time' => $stop - $start, 'rows' => count($result));
|
|
1148 |
}
|
|
1149 |
|
|
1150 |
return $result;
|
| 1121 |
1151 |
}
|
| 1122 |
1152 |
|
| 1123 |
1153 |
/**
|
| ... | ... | |
| 1130 |
1160 |
{
|
| 1131 |
1161 |
$this->link or $this->connect();
|
| 1132 |
1162 |
|
| 1133 |
|
return $this->driver->list_fields($this->config['table_prefix'].$table);
|
|
1163 |
$start = microtime(true);
|
|
1164 |
|
|
1165 |
$result = $this->driver->list_fields($this->config['table_prefix'].$table);
|
|
1166 |
|
|
1167 |
$stop = microtime(true);
|
|
1168 |
|
|
1169 |
if($this->profile_all)
|
|
1170 |
{
|
|
1171 |
self::$benchmarks[] = array('query' => 'Database::list_fields(\'' . $table . '\')', 'time' => $stop - $start, 'rows' => count($result));
|
|
1172 |
}
|
|
1173 |
|
|
1174 |
return $result;
|
| 1134 |
1175 |
}
|
| 1135 |
1176 |
|
| 1136 |
1177 |
/**
|