This commit is contained in:
Julio Cesar Laura Avendaño
2018-05-15 12:31:51 -04:00
parent 8487e072d9
commit e4ec17ad60
3 changed files with 47 additions and 27 deletions

View File

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

View File

@@ -258,22 +258,10 @@ class DbConnections
$dbServices = array ('mysql' => array ('id' => 'mysql','command' => 'mysqli_connect','name' => 'MySql' $dbServices = array ('mysql' => array ('id' => 'mysql','command' => 'mysqli_connect','name' => 'MySql'
),'pgsql' => array ('id' => 'pgsql','command' => 'pg_connect','name' => 'PostgreSql' ),'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' ),'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) { foreach ($dbServices as $service) {
if (@function_exists($service['command'])) { if (@function_exists($service['command'])) {

View File

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