@@ -148,50 +148,67 @@ public actor SQLClient {
148148 }
149149
150150 public func connect( options: SQLClientConnectionOptions ) async throws {
151+ print ( " DEBUG SQL: connect start " )
151152 await awaitPrevious ( )
153+ print ( " DEBUG SQL: connect entering task " )
152154 let task = Task {
155+ print ( " DEBUG SQL: connect execution start " )
153156 guard !self . connected else { throw SQLClientError . alreadyConnected }
154157
155158 let result = try await self . runBlocking {
159+ print ( " DEBUG SQL: connect blocking start " )
156160 return try self . _connectSync ( options: options)
157161 }
158162
159163 self . login = result. login. pointer
160164 self . connection = result. connection. pointer
161165 self . connected = true
166+ print ( " DEBUG SQL: connect execution complete " )
162167 }
163168 activeTask = Task { _ = await task. result }
164169 try await task. value
165170 }
166171
167172 public func disconnect( ) async {
173+ print ( " DEBUG SQL: disconnect start " )
168174 await awaitPrevious ( )
175+ print ( " DEBUG SQL: disconnect entering task " )
169176 let task = Task {
177+ print ( " DEBUG SQL: disconnect execution start " )
170178 guard self . connected else { return }
171179 let lgn = self . login. map { TDSHandle ( pointer: $0) }
172180 let conn = self . connection. map { TDSHandle ( pointer: $0) }
173181 await self . runBlockingVoid {
182+ print ( " DEBUG SQL: disconnect blocking start " )
174183 self . _disconnectSync ( login: lgn, connection: conn)
175184 }
176185 self . login = nil
177186 self . connection = nil
178187 self . connected = false
188+ print ( " DEBUG SQL: disconnect execution complete " )
179189 }
180190 activeTask = Task { _ = await task. result }
181191 _ = await task. result
182192 }
183193
184194 public func execute( _ sql: String ) async throws -> SQLClientResult {
195+ let snippet = String ( sql. prefix ( 30 ) ) . replacingOccurrences ( of: " \n " , with: " " )
196+ print ( " DEBUG SQL: execute start [ \( snippet) ...] " )
185197 await awaitPrevious ( )
198+ print ( " DEBUG SQL: execute entering task [ \( snippet) ...] " )
186199 let task = Task {
200+ print ( " DEBUG SQL: execute execution start [ \( snippet) ...] " )
187201 guard self . connected, let conn = self . connection else { throw SQLClientError . notConnected }
188202 guard !sql. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty else { throw SQLClientError . noCommandText }
189203 let maxText = self . maxTextSize
190204 let handle = TDSHandle ( pointer: conn)
191205
192- return try await self . runBlocking {
206+ let res = try await self . runBlocking {
207+ print ( " DEBUG SQL: execute blocking start [ \( snippet) ...] " )
193208 return try self . _executeSync ( sql: sql, connection: handle, maxTextSize: maxText)
194209 }
210+ print ( " DEBUG SQL: execute execution complete [ \( snippet) ...] " )
211+ return res
195212 }
196213 activeTask = Task { _ = await task. result }
197214 return try await task. value
0 commit comments