@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class DatabaseLog implements LogInterface |
| 24 | 24 | { |
| 25 | - public static function log(string $databaseUserId, string $event, string $objectSchema, string $object, string $tSql) |
|
| 26 | - { |
|
| 27 | - $insertBuilder = (new Builder("QueryBuilder", "Insert"))->getBuilder(); |
|
| 28 | - try { |
|
| 29 | - $insertBuilder |
|
| 30 | - ->into(' |
|
| 25 | + public static function log(string $databaseUserId, string $event, string $objectSchema, string $object, string $tSql) |
|
| 26 | + { |
|
| 27 | + $insertBuilder = (new Builder("QueryBuilder", "Insert"))->getBuilder(); |
|
| 28 | + try { |
|
| 29 | + $insertBuilder |
|
| 30 | + ->into(' |
|
| 31 | 31 | [Logs].[DatabaseLog] |
| 32 | 32 | ( |
| 33 | 33 | PostTime, |
@@ -38,21 +38,21 @@ discard block |
||
| 38 | 38 | TSQL |
| 39 | 39 | ) |
| 40 | 40 | ') |
| 41 | - ->values([ |
|
| 42 | - 'GETDATE()', |
|
| 43 | - QB::wrapString($databaseUserId, "'"), |
|
| 44 | - QB::wrapString((string)$event, "'"), |
|
| 45 | - QB::wrapString($objectSchema, "'"), |
|
| 46 | - QB::wrapString($object, "'"), |
|
| 47 | - QB::wrapString(str_replace("'", "\"", $tSql), "'") |
|
| 48 | - ]); |
|
| 41 | + ->values([ |
|
| 42 | + 'GETDATE()', |
|
| 43 | + QB::wrapString($databaseUserId, "'"), |
|
| 44 | + QB::wrapString((string)$event, "'"), |
|
| 45 | + QB::wrapString($objectSchema, "'"), |
|
| 46 | + QB::wrapString($object, "'"), |
|
| 47 | + QB::wrapString(str_replace("'", "\"", $tSql), "'") |
|
| 48 | + ]); |
|
| 49 | 49 | |
| 50 | - DBConnectionFactory::getConnection()->query((string)$insertBuilder); |
|
| 51 | - } catch (\PDOException $e) { |
|
| 52 | - echo $e->getMessage(); |
|
| 53 | - throw new SQLException(sprintf( |
|
| 54 | - "Unable to store database log" |
|
| 55 | - ), 1); |
|
| 56 | - } |
|
| 57 | - } |
|
| 50 | + DBConnectionFactory::getConnection()->query((string)$insertBuilder); |
|
| 51 | + } catch (\PDOException $e) { |
|
| 52 | + echo $e->getMessage(); |
|
| 53 | + throw new SQLException(sprintf( |
|
| 54 | + "Unable to store database log" |
|
| 55 | + ), 1); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types=1); |
|
| 1 | +<?php declare (strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * @license MIT |
| 4 | 4 | * @author Samuel Adeshina <[email protected]> |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | ->values([ |
| 42 | 42 | 'GETDATE()', |
| 43 | 43 | QB::wrapString($databaseUserId, "'"), |
| 44 | - QB::wrapString((string)$event, "'"), |
|
| 44 | + QB::wrapString((string) $event, "'"), |
|
| 45 | 45 | QB::wrapString($objectSchema, "'"), |
| 46 | 46 | QB::wrapString($object, "'"), |
| 47 | 47 | QB::wrapString(str_replace("'", "\"", $tSql), "'") |
| 48 | 48 | ]); |
| 49 | 49 | |
| 50 | - DBConnectionFactory::getConnection()->query((string)$insertBuilder); |
|
| 50 | + DBConnectionFactory::getConnection()->query((string) $insertBuilder); |
|
| 51 | 51 | } catch (\PDOException $e) { |
| 52 | 52 | echo $e->getMessage(); |
| 53 | 53 | throw new SQLException(sprintf( |