diff --git a/helper/database.mysql.cmd.php b/helper/database.mysql.cmd.php index 1e1ee55..c3411e1 100644 --- a/helper/database.mysql.cmd.php +++ b/helper/database.mysql.cmd.php @@ -18,10 +18,11 @@ if(check_function_exists("exec_db_mysql_cmd_query")) { $args[] = sprintf("-u%s", $config['db_username']); $args[] = sprintf("-p%s", $config['db_password']); $args[] = sprintf("-h%s", $config['db_host']); + $args[] = "-s"; // --slient $args[] = sprintf("-D '%s'", $config['db_name']); $args[] = sprintf("-e '%s'", make_safe_argument($sql)); - $cmd = trim(implode(" ", $args)); + $cmd = implode(" ", $args); $result = exec_command($cmd); } @@ -30,8 +31,20 @@ if(check_function_exists("exec_db_mysql_cmd_query")) { } if(check_function_exists("exec_db_mysql_cmd_fetch_all")) { - function exec_db_mysql_cmd_fetch_all() { - // todo + function exec_db_mysql_cmd_fetch_all($sql, $bind) { + $result = false; + + $tsvData = exec_db_mysql_cmd_query($sql, $bind); + $lines = explode(DOC_EOL, $tsvData); + $rows = array(); + foreach ($lines as $line) { + $rows[] = str_getcsv($line, "\t"); + } + + if(count($rows) > 0) { + $result = $rows; + } + + return $result; } } -