Skip to content

Commit f704cd8

Browse files
committed
feat: ODBC statement preparation
This commit refines the ODBC command execution process by introducing a dedicated `prepare` method in the `ConnectionWorker`, allowing for better management of SQL statement preparation and metadata retrieval. It also simplifies the command processing logic and improves the handling of SQL execution results. Additionally, new tests have been added to validate the functionality of prepared statements and error handling for parameter counts.
1 parent 597db7d commit f704cd8

File tree

3 files changed

+312
-175
lines changed

3 files changed

+312
-175
lines changed

sqlx-core/src/odbc/connection/executor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ impl<'c> Executor<'c> for &'c mut OdbcConnection {
6060
'c: 'e,
6161
{
6262
Box::pin(async move {
63-
// Basic statement metadata: no parameter/column info without executing
63+
let (_, columns, parameters) = self.worker.prepare(sql).await?;
6464
Ok(OdbcStatement {
6565
sql: Cow::Borrowed(sql),
66-
columns: Vec::new(),
67-
parameters: 0,
66+
columns,
67+
parameters,
6868
})
6969
})
7070
}

0 commit comments

Comments
 (0)