Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
+32
-13
@@ -453,7 +453,7 @@ class _Db extends \mysqli
|
||||
|
||||
/* Log */
|
||||
if ( \IPS\QUERY_LOG )
|
||||
{
|
||||
{
|
||||
/* Log */
|
||||
$this->log( static::_replaceBinds( $queryForLog, $binds ), ( $read and $this->readWriteSeparation ) ? 'read' : 'write' );
|
||||
}
|
||||
@@ -505,7 +505,7 @@ class _Db extends \mysqli
|
||||
/* Bind values */
|
||||
if( $bind->haveBinds() === TRUE )
|
||||
{
|
||||
call_user_func_array( array( $stmt, 'bind_param' ), $bind->get() );
|
||||
$stmt->bind_param( ...$bind->get() );
|
||||
|
||||
if( count( $sendAsLong ) )
|
||||
{
|
||||
@@ -618,7 +618,7 @@ class _Db extends \mysqli
|
||||
$tableQuery = $table->query;
|
||||
$binds = $table->binds;
|
||||
preg_match( '/FROM `(.+?)`( AS `(.+?)`)?/', $tableQuery, $matches );
|
||||
$query .= isset( $matches[3] ) ? " FROM ( {$tableQuery} ) AS `{$matches[3]}`" : ( " FROM ( {$tableQuery} ) AS `" . md5(uniqid()) . '`' );
|
||||
$query .= isset( $matches[3] ) ? " FROM ( {$tableQuery} ) AS `{$matches[3]}`" : ( " FROM ( {$tableQuery} ) AS `" . md5(mt_rand()) . '`' );
|
||||
}
|
||||
elseif ( is_array( $table ) )
|
||||
{
|
||||
@@ -1663,6 +1663,33 @@ class _Db extends \mysqli
|
||||
) )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get database tables
|
||||
*
|
||||
* @param string|NULL $prefix Optional table prefix to filter by
|
||||
* @return array
|
||||
*/
|
||||
public function getTables( $prefix=NULL )
|
||||
{
|
||||
$stmt = static::i()->prepare( "SHOW TABLES" );
|
||||
$stmt->execute();
|
||||
$stmt->bind_result( $name );
|
||||
|
||||
$tables = array();
|
||||
|
||||
while ( $stmt->fetch() === true )
|
||||
{
|
||||
if ( $prefix === NULL OR mb_substr( $name, 0, \strlen( $prefix ) ) === $prefix )
|
||||
{
|
||||
$tables[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
|
||||
return $tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the table definition for an existing table
|
||||
@@ -2234,7 +2261,8 @@ class _Db extends \mysqli
|
||||
{
|
||||
$definition = ( is_array( $data ) ) ? $data : $this->getTableDefinition( $data, FALSE, TRUE );
|
||||
$length = 0;
|
||||
$multiplier = ( $this->charset === 'utf8mb4' ) ? 4 : 3;
|
||||
/* We use 4 for utf8mb4 to prevent issues if the client attempts to switch or forgets to mark conf_global.php that utf8mb4 is used */
|
||||
$multiplier = 4;
|
||||
$needsFixing = array();
|
||||
$maxLen = 1000;
|
||||
|
||||
@@ -2284,15 +2312,6 @@ class _Db extends \mysqli
|
||||
{
|
||||
$length += $thisLength;
|
||||
}
|
||||
|
||||
/* Is this an MB4 column */
|
||||
if ( $multiplier === 3 AND isset( $definition['columns'][ $column ]['collation'] ) )
|
||||
{
|
||||
if ( mb_substr( $definition['columns'][ $column ]['collation'], 0, 7 ) === 'utf8mb4' )
|
||||
{
|
||||
$multiplier = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( $length * $multiplier > $maxLen ) or $hasText )
|
||||
|
||||
Reference in new issue
Block a user