Skip to content

Commit 70f4510

Browse files
authored
3.25
-routine comment field changed in textarea -fixed executed function
1 parent 586deb4 commit 70f4510

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

sql.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
session_start();
66
$bg=2;
77
$step=20;
8-
$version="3.24";
8+
$version="3.25";
99
$bbs=['False','True'];
1010
$deny=['mysql','information_schema','performance_schema','sys'];
1111
class DBT {
@@ -2434,7 +2434,7 @@ public function create_ro($db,$pn){
24342434
echo "</select></td></tr>
24352435
<tr><td>SQL data access</td><td><select name='rosda'>";
24362436
foreach($ed->sqlda as $sda) echo "<option value='$sda'".($r_rou[7]==$sda?" selected":"").">$sda</option>";
2437-
echo "</select></td></tr><tr><td>Comment</td><td><input type='text' name='rocom' value='".$r_rou[8]."'/></td></tr>
2437+
echo "</select></td></tr><tr><td>Comment</td><td><textarea name='rocom'>".$r_rou[8]."</textarea></td></tr>
24382438
<tr><td colspan='2'><button type='submit'>Save</button></td></tr></table></form>";
24392439
break;
24402440

@@ -2504,6 +2504,7 @@ public function create_ro($db,$pn){
25042504
$fi=[];$out='';$i=0;
25052505
foreach($plist as $lst){
25062506
preg_match('/(.*)`(.*?)`/',$lst,$ls);
2507+
if(!empty($ls)){
25072508
$rr="<tr><td>".$ls[2]."</td><td><input type='text' name='".$ls[2]."'/></td></tr>";
25082509
if($ty=='procedure' && trim($ls[1])=='IN'){
25092510
$fi[]=$ls[2];echo $rr;
@@ -2513,6 +2514,7 @@ public function create_ro($db,$pn){
25132514
$fi[]=$ls[2];echo $rr;
25142515
}
25152516
}
2517+
}
25162518
echo "<tr><td colspan='2'><button type='submit' name='run'>Call</button></td></tr></table></form>";
25172519
if($ed->post('run','i')){
25182520
echo "<table><tr><th colspan='2'>Executed `$sp`</th></tr>";
@@ -2521,20 +2523,25 @@ public function create_ro($db,$pn){
25212523
$re=substr($re,0,-1);
25222524
$out=substr($out,0,-1);
25232525
if($ty=='function'){
2524-
$q_ex=$ed->con->query("SELECT `$sp`".(empty($fi)?"":"($re)"))->fetch();
2526+
$q_ex=$ed->con->query("SELECT `$sp`".(empty($fi)?"":"($re)"));
2527+
if($q_ex){
2528+
$q_ex->fetch();
25252529
echo "<tr><td><input type='text' value='".$q_ex[0]."'/></td></tr>";
2530+
}
25262531
}elseif($ty=='procedure'){
2532+
$c="";
25272533
if($re!='' && $out!='') $c="($re,$out)";
25282534
elseif($re!='') $c="($re)";
25292535
elseif($out!='') $c="($out)";
2530-
else $c="";
25312536
$ed->con->query("CALL `$sp`".$c);
2537+
if($out!=''){
25322538
$q_ex=$ed->con->query("SELECT $out")->fetch();
25332539
$j=0;
25342540
while($j<$i){
25352541
echo "<tr><td><input type='text' value='".$q_ex[$j]."'/></td></tr>";
25362542
++$j;
25372543
}
2544+
}
25382545
}
25392546
echo "</table>";
25402547
}

0 commit comments

Comments
 (0)