Skip to content

Commit

Permalink
Upgrade Version
Browse files Browse the repository at this point in the history
Upgrade Version
  • Loading branch information
rmunate authored Jul 1, 2024
2 parents bfbcb4a + 13f7287 commit 03f3221
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 25 deletions.
4 changes: 0 additions & 4 deletions src/Bases/BaseSQLServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,19 @@ public static function status(string $connection, int $loginTimeout = 3)
(new SQLServerValidator($data, $connection))->verify();

try {

$instance = new static((object) $data, $connection, $loginTimeout);

return new SQLServerStatus([
'status' => true,
'message' => 'Connection Successful',
'query' => $instance,
]);

} catch (\Throwable $th) {

return new SQLServerStatus([
'status' => false,
'message' => $th->getMessage(),
'query' => null,
]);

}
}
}
5 changes: 1 addition & 4 deletions src/Response/SQLServerResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
use Illuminate\Support\Collection;

/**
* Class SQLServerResponse
* Class SQLServerResponse.
*
* This class represents a response from a SQL Server query.
* It extends the Illuminate\Support\Collection class to leverage
* Laravel's powerful collection functionalities.
*
* @package Rmunate\SqlServerLite\Response
*/

class SQLServerResponse extends Collection
{
/**
Expand Down
5 changes: 1 addition & 4 deletions src/Response/SQLServerRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
namespace Rmunate\SqlServerLite\Response;

/**
* Class SQLServerRow
* Class SQLServerRow.
*
* This class represents a single row of data from a SQL Server query.
* It dynamically assigns properties based on the provided associative array.
*
* @package Rmunate\SqlServerLite\Response
*/

class SQLServerRow
{
/**
Expand Down
13 changes: 0 additions & 13 deletions src/Singleton/SQLServerSingleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ class SQLServerSingleton
public static function mount($credentials, string $connection, int $loginTimeout)
{
if (empty(self::$instance[$connection])) {

try {

// Create the DSN:
$dsn = "sqlsrv:Server={$credentials->host}";
$dsn .= (isset($credentials->port) && !empty($credentials->port)) ? ",{$credentials->port}" : ',1433';
Expand All @@ -53,11 +51,8 @@ public static function mount($credentials, string $connection, int $loginTimeout
}

self::$instance[$connection] = $conection;

} catch (PDOException $e) {

throw SQLServerException::create($e->getMessage());

}
}

Expand Down Expand Up @@ -88,17 +83,13 @@ public static function beginTransaction()
public static function commit()
{
if (!empty(self::$instance)) {

foreach (self::$instance as $key => $instance) {
$instance->commit();
}

self::$beginTransaction = false;

} else {

throw SQLServerException::create('The connection to the database is not initialized.');

}
}

Expand All @@ -110,17 +101,13 @@ public static function commit()
public static function rollback()
{
if (!empty(self::$instance)) {

foreach (self::$instance as $key => $instance) {
$instance->rollBack();
}

self::$beginTransaction = false;

} else {

throw SQLServerException::create('The connection to the database is not initialized.');

}
}
}

0 comments on commit 03f3221

Please sign in to comment.