改名
This commit is contained in:
+25
-5
@@ -11,7 +11,6 @@ namespace Database;
|
||||
|
||||
use Database\Traits\QueryTrait;
|
||||
use Exception;
|
||||
use HttpServer\Http\Context;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
@@ -93,6 +92,27 @@ class Db implements ISqlBuilder
|
||||
return 'ANY_VALUE(' . $column . ') as ' . $alias;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @return string
|
||||
*/
|
||||
public static function increment(string $column): string
|
||||
{
|
||||
return '+ ' . $column;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @return string
|
||||
*/
|
||||
public static function decrement(string $column): string
|
||||
{
|
||||
return '- ' . $column;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Connection|null $db
|
||||
* @return mixed
|
||||
@@ -167,19 +187,19 @@ class Db implements ISqlBuilder
|
||||
*/
|
||||
public static function findAllBySql(string $sql, array $attributes = [], Connection $db = NULL): int|bool|array|string|null
|
||||
{
|
||||
return $db->createCommand($sql, $attributes)->all();
|
||||
return $db->createCommand($sql, $db?->database, $attributes)->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sql
|
||||
* @param array $attributes
|
||||
* @param Connection|NULL $db
|
||||
* @return array|mixed
|
||||
* @return string|array|bool|int|null
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function findBySql(string $sql, array $attributes = [], Connection $db = NULL): mixed
|
||||
public static function findBySql(string $sql, array $attributes = [], Connection $db = NULL): string|array|bool|int|null
|
||||
{
|
||||
return $db->createCommand($sql, $attributes)->one();
|
||||
return $db->createCommand($sql, $db?->database, $attributes)->one();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user