@@ -53,6 +53,9 @@ enum Command {
5353 sql : Box < str > ,
5454 tx : PrepareSender ,
5555 } ,
56+ GetDbmsName {
57+ tx : oneshot:: Sender < Result < String , Error > > ,
58+ } ,
5659}
5760
5861impl Drop for ConnectionWorker {
@@ -156,6 +159,11 @@ impl ConnectionWorker {
156159 )
157160 . await ?
158161 }
162+
163+ pub ( crate ) async fn get_dbms_name ( & mut self ) -> Result < String , Error > {
164+ let ( tx, rx) = oneshot:: channel ( ) ;
165+ send_command_and_await ( & self . command_tx , Command :: GetDbmsName { tx } , rx) . await ?
166+ }
159167}
160168
161169// Worker thread implementation
@@ -254,6 +262,7 @@ fn process_command(cmd: Command, conn: &OdbcConnection) -> Option<oneshot::Sende
254262 Command :: Shutdown { tx } => return Some ( tx) ,
255263 Command :: Execute { sql, args, tx } => handle_execute ( conn, sql, args, tx) ,
256264 Command :: Prepare { sql, tx } => handle_prepare ( conn, sql, tx) ,
265+ Command :: GetDbmsName { tx } => handle_get_dbms_name ( conn, tx) ,
257266 }
258267 None
259268}
@@ -309,6 +318,13 @@ fn handle_prepare(conn: &OdbcConnection, sql: Box<str>, tx: PrepareSender) {
309318 send_result ( tx, result) ;
310319}
311320
321+ fn handle_get_dbms_name ( conn : & OdbcConnection , tx : oneshot:: Sender < Result < String , Error > > ) {
322+ let result = conn
323+ . database_management_system_name ( )
324+ . map_err ( |e| Error :: Protocol ( format ! ( "Failed to get DBMS name: {}" , e) ) ) ;
325+ send_result ( tx, result) ;
326+ }
327+
312328// Helper functions
313329fn execute_simple ( conn : & OdbcConnection , sql : & str ) -> Result < ( ) , Error > {
314330 match conn. execute ( sql, ( ) , None ) {
0 commit comments