Skip to content
Newer
Older
100644 359 lines (346 sloc) 14.1 KB
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
1 <?php
471ae2b Move select function
jakubvrana authored Sep 13, 2009
2 /** Print select result
3 * @param Min_Result
4 * @param Min_DB connection to examine indexes
5 * @return null
6 */
64d616c Rename get_dbh to connection
jakubvrana authored Sep 22, 2009
7 function select($result, $connection2 = null) {
471ae2b Move select function
jakubvrana authored Sep 13, 2009
8 if (!$result->num_rows) {
9 echo "<p class='message'>" . lang('No rows.') . "\n";
10 } else {
11 echo "<table cellspacing='0' class='nowrap'>\n";
12 $links = array(); // colno => orgtable - create links from these columns
13 $indexes = array(); // orgtable => array(column => colno) - primary keys
14 $columns = array(); // orgtable => array(column => ) - not selected columns in primary key
15 $blobs = array(); // colno => bool - display bytes for blobs
16 $types = array(); // colno => type - display char in <code>
17 odd(''); // reset odd for each result
18 for ($i=0; $row = $result->fetch_row(); $i++) {
19 if (!$i) {
20 echo "<thead><tr>";
21 for ($j=0; $j < count($row); $j++) {
22 $field = $result->fetch_field();
23 if (strlen($field->orgtable)) {
24 if (!isset($indexes[$field->orgtable])) {
25 // find primary key in each table
26 $indexes[$field->orgtable] = array();
64d616c Rename get_dbh to connection
jakubvrana authored Sep 22, 2009
27 foreach (indexes($field->orgtable, $connection2) as $index) {
471ae2b Move select function
jakubvrana authored Sep 13, 2009
28 if ($index["type"] == "PRIMARY") {
29 $indexes[$field->orgtable] = array_flip($index["columns"]);
30 break;
31 }
32 }
33 $columns[$field->orgtable] = $indexes[$field->orgtable];
34 }
35 if (isset($columns[$field->orgtable][$field->orgname])) {
36 unset($columns[$field->orgtable][$field->orgname]);
37 $indexes[$field->orgtable][$field->orgname] = $j;
38 $links[$j] = $field->orgtable;
39 }
40 }
41 if ($field->charsetnr == 63) {
42 $blobs[$j] = true;
43 }
44 $types[$j] = $field->type;
45 echo "<th>" . h($field->name);
46 }
47 echo "</thead>\n";
48 }
49 echo "<tr" . odd() . ">";
50 foreach ($row as $key => $val) {
51 if (!isset($val)) {
52 $val = "<i>NULL</i>";
53 } else {
54 if ($blobs[$key] && !is_utf8($val)) {
55 $val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
24801a0 Display whitespace in texts (bug #2858042)
jakubvrana authored Sep 14, 2009
56 } elseif (!strlen($val)) {
471ae2b Move select function
jakubvrana authored Sep 13, 2009
57 $val = "&nbsp;"; // some content to print a border
58 } else {
50881f8 Move whitespace to CSS
jakubvrana authored Oct 13, 2009
59 $val = h($val);
471ae2b Move select function
jakubvrana authored Sep 13, 2009
60 if ($types[$key] == 254) {
61 $val = "<code>$val</code>";
62 }
63 }
64 if (isset($links[$key]) && !$columns[$links[$key]]) {
65 $link = "edit=" . urlencode($links[$key]);
66 foreach ($indexes[$links[$key]] as $col => $j) {
67 $link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]);
68 }
69 $val = "<a href='" . h(ME . $link) . "'>$val</a>";
70 }
71 }
72 echo "<td>$val";
73 }
74 }
75 echo "</table>\n";
76 }
77 }
78
1118566 Documentation
jakubvrana authored Oct 23, 2009
79 /** Get referencable tables with single column primary key except self
80 * @param string
81 * @return array ($table_name => $field)
82 */
ced9de9 Create single column foreign key in table structure
jakubvrana authored Jul 2, 2009
83 function referencable_primary($self) {
84 $return = array(); // table_name => field
85 foreach (table_status_referencable() as $table_name => $table) {
86 if ($table_name != $self) {
87 foreach (fields($table_name) as $field) {
88 if ($field["primary"]) {
89 if ($return[$table_name]) { // multi column primary key
90 unset($return[$table_name]);
91 break;
92 }
93 $return[$table_name] = $field;
94 }
95 }
96 }
97 }
98 return $return;
99 }
100
1118566 Documentation
jakubvrana authored Oct 23, 2009
101 /** Print table columns for type edit
102 * @param string
103 * @param array
104 * @param array
105 * @param array returned by referencable_primary()
106 * @return null
107 */
ced9de9 Create single column foreign key in table structure
jakubvrana authored Jul 2, 2009
108 function edit_type($key, $field, $collations, $foreign_keys = array()) {
26b07bf Separate types to groups in table creation
jakubvrana authored Jul 14, 2009
109 global $structured_types, $unsigned, $inout;
f2813b5 Don't hide/show added/dropped columns (bug 1920167)
jakubvrana authored Mar 20, 2008
110 ?>
0698409 Utilize html_select
jakubvrana authored Oct 2, 2009
111 <td><select name="<?php echo $key; ?>[type]" class="type" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select>
8caf24c Enlarge field for enum and set definition
jakubvrana authored Oct 19, 2009
112 <td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editing_length_focus(this);">
493eb6b Remove space
jakubvrana authored Jun 19, 2009
113 <td><?php
5cac902 Work with default values
jakubvrana authored Oct 6, 2009
114 echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
115 echo ($unsigned ? " <select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
116 }
117
1118566 Documentation
jakubvrana authored Oct 23, 2009
118 /** Filter length value including enums
119 * @param string
120 * @return string
121 */
f93c84e Function process_length used only in Adminer
jakubvrana authored Jul 27, 2009
122 function process_length($length) {
123 global $enum_length;
124 return (preg_match("~^\\s*(?:$enum_length)(?:\\s*,\\s*(?:$enum_length))*\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches) ? implode(",", $matches[0]) : preg_replace('~[^0-9,+-]~', '', $length));
125 }
126
1118566 Documentation
jakubvrana authored Oct 23, 2009
127 /** Create SQL string from field type
128 * @param array
129 * @param string
130 * @return string
131 */
a3c969c Routines uses CHARACTER SET
jakubvrana authored Jul 17, 2007
132 function process_type($field, $collate = "COLLATE") {
5cac902 Work with default values
jakubvrana authored Oct 6, 2009
133 global $connection, $unsigned;
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
134 return " $field[type]"
5c862ba Allow char(0)
jakubvrana authored Oct 6, 2009
135 . (strlen($field["length"]) && !ereg('^date|time$', $field["type"]) ? "(" . process_length($field["length"]) . ")" : "")
5abd943 Change simple preg_match to ereg
jakubvrana authored Jul 13, 2009
136 . (ereg('int|float|double|decimal', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
64d616c Rename get_dbh to connection
jakubvrana authored Sep 22, 2009
137 . (ereg('char|text|enum|set', $field["type"]) && $field["collation"] ? " $collate " . $connection->quote($field["collation"]) : "")
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
138 ;
139 }
140
1118566 Documentation
jakubvrana authored Oct 23, 2009
141 /** Create SQL string from field
142 * @param array basic field information
143 * @param array information about field type
144 * @return string
145 */
2e680bc Speedup of simple alter table
jakubvrana authored Sep 9, 2009
146 function process_field($field, $type_field) {
64d616c Rename get_dbh to connection
jakubvrana authored Sep 22, 2009
147 global $connection;
2e680bc Speedup of simple alter table
jakubvrana authored Sep 9, 2009
148 return idf_escape($field["field"]) . process_type($type_field)
149 . ($field["null"] ? " NULL" : " NOT NULL") // NULL for timestamp
5cac902 Work with default values
jakubvrana authored Oct 6, 2009
150 . (!isset($field["default"]) ? "" : " DEFAULT " . ($field["type"] == "timestamp" && eregi("^CURRENT_TIMESTAMP$", $field["default"]) ? $field["default"] : $connection->quote($field["default"])))
151 . ($field["on_update"] ? " ON UPDATE $field[on_update]" : "")
64d616c Rename get_dbh to connection
jakubvrana authored Sep 22, 2009
152 . " COMMENT " . $connection->quote($field["comment"])
2e680bc Speedup of simple alter table
jakubvrana authored Sep 9, 2009
153 ;
154 }
155
1118566 Documentation
jakubvrana authored Oct 23, 2009
156 /** Get type class to use in CSS
157 * @param string
158 * @return string class=''
159 */
3015aed Separate type_class
jakubvrana authored Jul 14, 2009
160 function type_class($type) {
d144e9c Save bytes
jakubvrana authored Sep 19, 2009
161 foreach (array(
162 'char' => 'text',
163 'date' => 'time|year',
164 'binary' => 'blob',
165 'enum' => 'set',
166 ) as $key => $val) {
c0c7ab3 Typo
jakubvrana authored Sep 19, 2009
167 if (ereg("$key|$val", $type)) {
d144e9c Save bytes
jakubvrana authored Sep 19, 2009
168 return " class='$key'";
169 }
3015aed Separate type_class
jakubvrana authored Jul 14, 2009
170 }
171 }
172
1118566 Documentation
jakubvrana authored Oct 23, 2009
173 /** Print table interior for fields editing
174 * @param array
175 * @param array
176 * @param string TABLE or PROCEDURE
177 * @param int number of fields allowed by Suhosin
178 * @param array returned by referencable_primary()
179 * @return bool column comments used
180 */
ced9de9 Create single column foreign key in table structure
jakubvrana authored Jul 2, 2009
181 function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $foreign_keys = array()) {
d31d4e9 Emulate REQUEST_URI
jakubvrana authored Jul 28, 2009
182 global $inout;
540e217 Separate JavaScript
jakubvrana authored May 29, 2009
183 $column_comments = false;
184 foreach ($fields as $field) {
185 if (strlen($field["comment"])) {
186 $column_comments = true;
1118566 Documentation
jakubvrana authored Oct 23, 2009
187 break;
540e217 Separate JavaScript
jakubvrana authored May 29, 2009
188 }
189 }
f2813b5 Don't hide/show added/dropped columns (bug 1920167)
jakubvrana authored Mar 20, 2008
190 ?>
4e5b126 Highlight odd and hover rows
jakubvrana authored Apr 30, 2009
191 <thead><tr>
b349612 Remove useless translations
jakubvrana authored Aug 25, 2009
192 <?php if ($type == "PROCEDURE") { ?><td>&nbsp;<?php } ?>
ace55ed HTML instead of XHTML
jakubvrana authored Jul 11, 2009
193 <th><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
8caf24c Enlarge field for enum and set definition
jakubvrana authored Oct 19, 2009
194 <td><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="10" style="display: none;" onblur="editing_length_blur(this);"></textarea>
ace55ed HTML instead of XHTML
jakubvrana authored Jul 11, 2009
195 <td><?php echo lang('Length'); ?>
196 <td><?php echo lang('Options'); ?>
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
197 <?php if ($type == "TABLE") { ?>
b349612 Remove useless translations
jakubvrana authored Aug 25, 2009
198 <td>NULL
16ed399 Shorten Auto Increment to support 1024 width
jakubvrana authored Oct 19, 2009
199 <td><input type="radio" name="auto_increment_col" value=""><acronym title="<?php echo lang('Auto Increment'); ?>">A_I</acronym>
4cead56 Edit default values directly in table creation
jakubvrana authored Aug 21, 2009
200 <td class="hidden"><?php echo lang('Default values'); ?>
ace55ed HTML instead of XHTML
jakubvrana authored Jul 11, 2009
201 <td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><?php echo lang('Comment'); ?>
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
202 <?php } ?>
ab3c366 Separate static files
jakubvrana authored Sep 23, 2009
203 <td><?php echo "<input type='image' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>"; ?><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script>
ace55ed HTML instead of XHTML
jakubvrana authored Jul 11, 2009
204 </thead>
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
205 <?php
93c27c9 Separate type_change()
jakubvrana authored Jul 16, 2007
206 foreach ($fields as $i => $field) {
207 $i++;
3cd113f Procedures test
jakubvrana authored Oct 3, 2008
208 $display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i]));
93c27c9 Separate type_change()
jakubvrana authored Jul 16, 2007
209 ?>
a76c555 Remove odd() from create
jakubvrana authored Jun 11, 2009
210 <tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
0698409 Utilize html_select
jakubvrana authored Oct 2, 2009
211 <?php
212 if ($type == "PROCEDURE") {
213 echo "<td>" . html_select("fields[$i][inout]", $inout, $field["inout"]);
214 }
215 ?>
689699a Shortcut for htmlspecialchars
jakubvrana authored Jul 28, 2009
216 <th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo (strlen($field["field"]) || count($fields) > 1 ? "" : "editing_add_row(this, $allowed); "); ?>editing_name_change(this);" maxlength="64"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($field[($_POST ? "orig" : "field")]); ?>">
ced9de9 Create single column foreign key in table structure
jakubvrana authored Jul 2, 2009
217 <?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
218 <?php if ($type == "TABLE") { ?>
6b30cfa Separate checkbox
jakubvrana authored Sep 25, 2009
219 <td><?php echo checkbox("fields[$i][null]", 1, $field["null"]); ?>
cb6d36c HTML instead of XHTML
jakubvrana authored Jul 28, 2009
220 <td><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?>>
6b30cfa Separate checkbox
jakubvrana authored Sep 25, 2009
221 <td class="nowrap hidden"><?php echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onchange="this.previousSibling.checked = true;">
689699a Shortcut for htmlspecialchars
jakubvrana authored Jul 28, 2009
222 <td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo h($field["comment"]); ?>" maxlength="255">
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
223 <?php } ?>
224 <?php
8ddbf43 Don't remove onchange after click on add
jakubvrana authored Sep 25, 2009
225 echo "<td class='nowrap'><input type='image' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editing_add_row(this, $allowed, 1);'>";
ab3c366 Separate static files
jakubvrana authored Sep 23, 2009
226 echo "&nbsp;<input type='image' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);'>";
227 echo "&nbsp;<input type='image' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'>";
228 echo "&nbsp;<input type='image' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'>";
50881f8 Move whitespace to CSS
jakubvrana authored Oct 13, 2009
229 echo "\n";
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
230 }
93c27c9 Separate type_change()
jakubvrana authored Jul 16, 2007
231 return $column_comments;
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
232 }
93c27c9 Separate type_change()
jakubvrana authored Jul 16, 2007
233
1118566 Documentation
jakubvrana authored Oct 23, 2009
234 /** Move fields up and down or add field
235 * @param array
236 * @return null
237 */
fd8948f Order of columns in table
jakubvrana authored May 7, 2008
238 function process_fields(&$fields) {
239 ksort($fields);
240 $offset = 0;
241 if ($_POST["up"]) {
242 $last = 0;
243 foreach ($fields as $key => $field) {
244 if (key($_POST["up"]) == $key) {
245 unset($fields[$key]);
246 array_splice($fields, $last, 0, array($field));
247 break;
248 }
249 if (isset($field["field"])) {
250 $last = $offset;
251 }
252 $offset++;
253 }
254 }
255 if ($_POST["down"]) {
256 $found = false;
257 foreach ($fields as $key => $field) {
258 if (isset($field["field"]) && $found) {
259 unset($fields[key($_POST["down"])]);
260 array_splice($fields, $offset, 0, array($found));
261 break;
262 }
263 if (key($_POST["down"]) == $key) {
264 $found = $field;
265 }
266 $offset++;
267 }
268 }
269 $fields = array_values($fields);
270 if ($_POST["add"]) {
271 array_splice($fields, key($_POST["add"]), 0, array(array()));
272 }
273 }
274
1118566 Documentation
jakubvrana authored Oct 23, 2009
275 /** Callback used in routine()
276 * @param array
277 * @return string
278 */
8060c5b Routines
jakubvrana authored Jul 17, 2007
279 function normalize_enum($match) {
280 return "'" . str_replace("'", "''", addcslashes(stripcslashes(str_replace($match[0]{0} . $match[0]{0}, $match[0]{0}, substr($match[0], 1, -1))), '\\')) . "'";
281 }
282
1118566 Documentation
jakubvrana authored Oct 23, 2009
283 /** Get information about stored routine
284 * @param string
285 * @param string FUNCTION or PROCEDURE
286 * @return array ("fields" => array("field" => , "type" => , "length" => , "unsigned" => , "inout" => , "collation" => ), "returns" => , "definition" => )
287 */
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
288 function routine($name, $type) {
64d616c Rename get_dbh to connection
jakubvrana authored Sep 22, 2009
289 global $connection, $enum_length, $inout, $types;
9fa3b9d Type aliases in routine
jakubvrana authored Aug 16, 2007
290 $aliases = array("bit" => "tinyint", "bool" => "tinyint", "boolean" => "tinyint", "integer" => "int", "double precision" => "float", "real" => "float", "dec" => "decimal", "numeric" => "decimal", "fixed" => "decimal", "national char" => "char", "national varchar" => "varchar");
79c70ad Change regular expression (bug #2859386)
jakubvrana authored Sep 16, 2009
291 $type_pattern = "(" . implode("|", array_keys($types + $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";
26c9d64 Fix long SQL query crash (bug #2839231)
jakubvrana authored Aug 19, 2009
292 $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : implode("|", $inout)) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
64d616c Rename get_dbh to connection
jakubvrana authored Sep 22, 2009
293 $create = $connection->result($connection->query("SHOW CREATE $type " . idf_escape($name)), 2);
8060c5b Routines
jakubvrana authored Jul 17, 2007
294 preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match);
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
295 $fields = array();
8060c5b Routines
jakubvrana authored Jul 17, 2007
296 preg_match_all("~$pattern\\s*,?~is", $match[1], $matches, PREG_SET_ORDER);
2184679 Use field name in routine
jakubvrana authored Jul 24, 2009
297 foreach ($matches as $param) {
298 $name = str_replace("``", "`", $param[2]) . $param[3];
9fa3b9d Type aliases in routine
jakubvrana authored Aug 16, 2007
299 $data_type = strtolower($param[4]);
2184679 Use field name in routine
jakubvrana authored Jul 24, 2009
300 $fields[$name] = array(
301 "field" => $name,
9fa3b9d Type aliases in routine
jakubvrana authored Aug 16, 2007
302 "type" => (isset($aliases[$data_type]) ? $aliases[$data_type] : $data_type),
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
303 "length" => preg_replace_callback("~$enum_length~s", 'normalize_enum', $param[5]),
304 "unsigned" => strtolower(preg_replace('~\\s+~', ' ', trim("$param[7] $param[6]"))),
305 "inout" => strtoupper($param[1]),
8060c5b Routines
jakubvrana authored Jul 17, 2007
306 "collation" => strtolower($param[8]),
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
307 );
308 }
309 if ($type != "FUNCTION") {
8060c5b Routines
jakubvrana authored Jul 17, 2007
310 return array("fields" => $fields, "definition" => $match[10]);
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
311 }
8060c5b Routines
jakubvrana authored Jul 17, 2007
312 $returns = array("type" => $match[10], "length" => $match[11], "unsigned" => $match[13], "collation" => $match[14]);
313 return array("fields" => $fields, "returns" => $returns, "definition" => $match[15]);
a7096dd Separate editing functions
jakubvrana authored Jul 16, 2007
314 }
464d84a Define functions unconditionally
jakubvrana authored Sep 9, 2009
315
1118566 Documentation
jakubvrana authored Oct 23, 2009
316 /** Issue grant or revoke commands
317 * @param string GRANT or REVOKE
318 * @param array
319 * @param string
320 * @param string
321 * @return
322 */
464d84a Define functions unconditionally
jakubvrana authored Sep 9, 2009
323 function grant($grant, $privileges, $columns, $on) {
324 if (!$privileges) {
325 return true;
326 }
327 if ($privileges == array("ALL PRIVILEGES", "GRANT OPTION")) {
328 // can't be granted or revoked together
329 return ($grant == "GRANT"
330 ? queries("$grant ALL PRIVILEGES$on WITH GRANT OPTION")
331 : queries("$grant ALL PRIVILEGES$on") && queries("$grant GRANT OPTION$on")
332 );
333 }
334 return queries("$grant " . preg_replace('~(GRANT OPTION)\\([^)]*\\)~', '\\1', implode("$columns, ", $privileges) . $columns) . $on);
335 }
32d5b9c Inform about dropped routine, trigger and view
jakubvrana authored Oct 13, 2009
336
1118566 Documentation
jakubvrana authored Oct 23, 2009
337 /** Drop old object and create a new one
338 * @param string drop query
339 * @param string create query
340 * @param string
341 * @param string
342 * @param string
343 * @param string
344 * @param string
345 * @return bool dropped
346 */
32d5b9c Inform about dropped routine, trigger and view
jakubvrana authored Oct 13, 2009
347 function drop_create($drop, $create, $location, $message_drop, $message_alter, $message_create, $name) {
348 if ($_POST["drop"]) {
349 return query_redirect($drop, $location, $message_drop, true, !$_POST["dropped"]);
350 }
351 $dropped = strlen($name) && ($_POST["dropped"] || queries($drop));
352 $created = queries($create);
dbdd40a Introduce queries_redirect function
jakubvrana authored Oct 13, 2009
353 if (!queries_redirect($location, (strlen($name) ? $message_alter : $message_create), $created) && $dropped) {
be49e08 Improve session restarting
jakubvrana authored Nov 3, 2009
354 restart_session();
32d5b9c Inform about dropped routine, trigger and view
jakubvrana authored Oct 13, 2009
355 $_SESSION["messages"][] = $message_drop;
356 }
357 return $dropped;
358 }
Something went wrong with that request. Please try again.