Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

+13 -3
View File
@@ -17,6 +17,9 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
exit;
}
// Make sure PHP 8.1 uses MySQL errors as we expect
\mysqli_report( MYSQLI_REPORT_OFF );
/**
* @brief Database Class
* @note All functionality MUST be supported by MySQL 5.1.3 and higher. All references to the MySQL manual are therefore the 5.1 version.
@@ -904,7 +907,9 @@ class _Db extends \mysqli
}
/* Return */
return new \IPS\Db\Select( $query, $binds, $this );
$return = new \IPS\Db\Select( $query, $binds, $this );
$return->isUnion = TRUE;
return $return;
}
/**
@@ -1026,6 +1031,11 @@ class _Db extends \mysqli
$query = "{$type} INTO `{$this->prefix}{$table}` " . $set->query;
$binds = $set->binds;
}
elseif ( \is_array( $set ) and \count( $set ) == 2 and isset( $set[1] ) and $set[1] instanceof \IPS\Db\Select )
{
$query = "{$type} INTO `{$this->prefix}{$table}` (" . $set[0] . ") " . $set[1]->query;
$binds = $set[1]->binds;
}
else
{
/* Is this just one row? */
@@ -1088,7 +1098,7 @@ class _Db extends \mysqli
$binds = array();
/* Work out table */
$table = \is_array( $table ) ? "`{$this->prefix}{$table[0]}` {$this->prefix}{$table[1]}" : "`{$this->prefix}{$table}` {$table}";
$table = \is_array( $table ) ? "`{$this->prefix}{$table[0]}` `{$this->prefix}{$table[1]}`" : "`{$this->prefix}{$table}` `{$table}`";
/* Work out joins */
$_joins = array();
@@ -1236,7 +1246,7 @@ class _Db extends \mysqli
{
$alias = \is_string( $alias ) ? $alias : $_table;
$tables[] = "`{$this->prefix}{$_table}` AS {$alias}";
$tables[] = "`{$this->prefix}{$_table}` AS `{$alias}`";
}
$query .= implode( ', ', $tables );
+7 -2
View File
@@ -53,9 +53,14 @@ class _Select implements \Iterator, \Countable
protected $multiDimensional = FALSE;
/**
* @brief If read/write sepration is enabled, SELECTs normally go to the read server - this flag will set thia query to use the write server
* @brief If read/write separation is enabled, SELECTs normally go to the read server - this flag will set this query to use the write server
*/
protected $useWriteServer = FALSE;
/**
* @brief Is this a union query? - this should only be set by the UNION method in \IPS\Db
*/
public $isUnion = FALSE;
/**
* Constuctor
@@ -224,7 +229,7 @@ class _Select implements \Iterator, \Countable
$this->query = str_replace( $matches[0], $key, $this->query );
}
if ( mb_strstr( $this->query, 'UNION' ) )
if ( $this->isUnion )
{
$this->query = str_replace( 'derivedTable', "derivedTable {$query}", $this->query );
}