Merged in bugfix/HOR-4559 (pull request #6469)

HOR-4559

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Julio Cesar Laura Avendaño
2018-05-23 12:55:28 +00:00
3 changed files with 47 additions and 27 deletions

View File

@@ -1103,7 +1103,7 @@ EOREGEX;
*/
private function process_expr_list ($tokens)
{
$expr = "";
$expr = [];
$type = "";
$prev_token = "";
$skip_next = false;

View File

@@ -258,22 +258,10 @@ class DbConnections
$dbServices = array ('mysql' => array ('id' => 'mysql','command' => 'mysqli_connect','name' => 'MySql'
),'pgsql' => array ('id' => 'pgsql','command' => 'pg_connect','name' => 'PostgreSql'
),'mssql' => array ('id' => 'mssql','command' => 'mssql_connect','name' => 'Microsoft SQL Server'
),'mssql' => array ('id' => 'mssql','command' => 'mssql_connect','name' => 'Microsoft SQL Server (mssql extension)'
),'sqlsrv' => array ('id' => 'mssql','command' => 'sqlsrv_connect','name' => 'Microsoft SQL Server (sqlsrv extension)'
),'oracle' => array ('id' => 'oracle','command' => 'oci_connect','name' => 'Oracle'
)
);
/*,
'informix'=> Array(
'id' => 'informix',
'command' => 'ifx_connect',
'name' => 'Informix'
),
'sqlite' => Array(
'id' => 'sqlite',
'command' => 'sqlite_open',
'name' => 'SQLite'
)
*/
));
foreach ($dbServices as $service) {
if (@function_exists($service['command'])) {

View File

@@ -253,12 +253,27 @@ class Net
break;
case 'mssql':
//todo
if ($this->db_instance != "") {
$str_port = "";
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
if (!extension_loaded('sqlsrv')) {
if ($this->db_instance != "") {
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
} else {
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
$link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd);
}
} else {
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
if ($this->db_instance != "") {
$server = $this->ip . "\\" . $this->db_instance;
} else {
$server = $this->ip;
}
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ", " . $this->db_port;
$server .= $port;
$opt = [
'UID' => $this->db_user,
'PWD' => $this->db_passwd,
'Database' => $this->db_sourcename
];
$link = @sqlsrv_connect($server, $opt);
}
if ($link) {
@@ -382,15 +397,32 @@ class Net
}
break;
case 'mssql':
if ($this->db_instance != "") {
$str_port = "";
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
if (!extension_loaded('sqlsrv')) {
if ($this->db_instance != "") {
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
} else {
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
$link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd);
}
} else {
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
if ($this->db_instance != "") {
$server = $this->ip . "\\" . $this->db_instance;
} else {
$server = $this->ip;
}
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ", " . $this->db_port;
$server .= $port;
$opt = [
'UID' => $this->db_user,
'PWD' => $this->db_passwd,
'Database' => $this->db_sourcename
];
$link = $db = @sqlsrv_connect($server, $opt);
}
if ($link) {
$db = @mssql_select_db($this->db_sourcename, $link);
if (!extension_loaded('sqlsrv')) {
$db = @mssql_select_db($this->db_sourcename, $link);
}
if ($db) {
$stat->status = 'SUCCESS';
$this->errstr = "";