55use Exception ;
66use GuzzleHttp \Client ;
77use Litebase \OpenAPI \Model \StatementParameter ;
8+ use Ramsey \Uuid \Uuid ;
89use Throwable ;
910
1011class LitebaseClient
@@ -61,7 +62,7 @@ public function beginTransaction(): bool
6162 try {
6263 $ response = $ this ->transport ->send (
6364 new Query (
64- id: uniqid (),
65+ id: Uuid:: uuid4 ()-> toString (),
6566 statement: 'BEGIN ' ,
6667 )
6768 );
@@ -100,7 +101,7 @@ public function commit(): bool
100101 try {
101102 $ this ->transport ->send (
102103 new Query (
103- id: uniqid (),
104+ id: Uuid:: uuid4 ()-> toString (),
104105 transactionId: $ this ->transaction ->id ,
105106 statement: 'COMMIT ' ,
106107 )
@@ -141,7 +142,7 @@ public function errorInfo(): array
141142 public function exec (array $ input ): ?QueryResult
142143 {
143144 // Set a unique id for the request.
144- $ input ['id ' ] = uniqid ();
145+ $ input ['id ' ] = Uuid:: uuid4 ()-> toString ();
145146
146147 if ($ this ->transaction ) {
147148 $ input ['transaction_id ' ] = $ this ->transaction ->id ;
@@ -198,7 +199,7 @@ public function rollback(): bool
198199
199200 $ this ->transport ->send (
200201 new Query (
201- id: uniqid (),
202+ id: Uuid:: uuid4 ()-> toString (),
202203 transactionId: $ this ->transaction ->id ,
203204 statement: 'ROLLBACK ' ,
204205 )
@@ -219,7 +220,7 @@ public function withTransport(string $transportType): LitebaseClient
219220 $ this ->transport = new HttpStreamingTransport ($ this ->configuration );
220221 break ;
221222 default :
222- throw new Exception ('Invalid transport type: ' . $ transportType );
223+ throw new Exception ('Invalid transport type: ' . $ transportType );
223224 }
224225
225226 return $ this ;
0 commit comments