2024-06-23 00:08:28 -07:00
|
|
|
From a09926caf2fd91460ab75d75c3aba98a153f97fa Mon Sep 17 00:00:00 2001
|
2023-02-16 15:44:46 -08:00
|
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
|
|
Date: Mon, 6 Feb 2023 09:53:34 +1100
|
2024-06-23 00:08:28 -07:00
|
|
|
Subject: [PATCH] odbc32: Implement SQLAllocStmt
|
2023-02-16 15:44:46 -08:00
|
|
|
|
|
|
|
---
|
|
|
|
dlls/odbc32/proxyodbc.c | 39 ++++++++++++++++++++++++++++++++++++++-
|
|
|
|
1 file changed, 38 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
|
2024-06-23 00:08:28 -07:00
|
|
|
index eb274c5da5b..1e6ee80c03d 100644
|
2023-02-16 15:44:46 -08:00
|
|
|
--- a/dlls/odbc32/proxyodbc.c
|
|
|
|
+++ b/dlls/odbc32/proxyodbc.c
|
2024-06-23 00:08:28 -07:00
|
|
|
@@ -174,6 +174,13 @@ struct SQLHDBC_data
|
2023-02-16 15:44:46 -08:00
|
|
|
SQLUINTEGER login_timeout;
|
|
|
|
};
|
|
|
|
|
|
|
|
+struct SQLHSTMT_data
|
|
|
|
+{
|
|
|
|
+ int type;
|
|
|
|
+ struct SQLHDBC_data *connection;
|
|
|
|
+ SQLHSTMT driver_stmt;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
static void connection_bind_sql_funcs(struct SQLHDBC_data *connection)
|
|
|
|
{
|
|
|
|
#define LOAD_FUNCPTR(f) if((connection->p##f = (void*)GetProcAddress(connection->module, #f)) == NULL) \
|
2024-06-23 00:08:28 -07:00
|
|
|
@@ -365,11 +372,41 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S
|
2023-02-16 15:44:46 -08:00
|
|
|
*/
|
|
|
|
SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle)
|
|
|
|
{
|
|
|
|
+ struct SQLHDBC_data *connection = ConnectionHandle;
|
|
|
|
+ struct SQLHSTMT_data *stmt;
|
|
|
|
SQLRETURN ret = SQL_ERROR;
|
|
|
|
|
|
|
|
- FIXME("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
|
|
|
|
+ TRACE("(ConnectionHandle %p, StatementHandle %p)\n", ConnectionHandle, StatementHandle);
|
|
|
|
|
|
|
|
*StatementHandle = SQL_NULL_HSTMT;
|
|
|
|
+ if (connection->type != SQL_HANDLE_DBC)
|
|
|
|
+ {
|
|
|
|
+ WARN("Wrong handle type %d\n", connection->type);
|
|
|
|
+ return SQL_ERROR;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ stmt = malloc(sizeof(*stmt));
|
|
|
|
+ if (!stmt)
|
|
|
|
+ {
|
|
|
|
+ return SQL_ERROR;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ stmt->type = SQL_HANDLE_STMT;
|
|
|
|
+ stmt->connection = connection;
|
|
|
|
+
|
|
|
|
+ /* Default to ODBC v3 function */
|
|
|
|
+ if(connection->pSQLAllocHandle)
|
|
|
|
+ {
|
|
|
|
+ ret = connection->pSQLAllocHandle(SQL_HANDLE_STMT, connection->driver_hdbc, &stmt->driver_stmt);
|
|
|
|
+ }
|
|
|
|
+ else if (connection->pSQLAllocStmt)
|
|
|
|
+ {
|
|
|
|
+ ret = connection->pSQLAllocStmt(connection->driver_hdbc, &stmt->driver_stmt);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ *StatementHandle = stmt;
|
|
|
|
+
|
|
|
|
+ TRACE("ret %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2024-06-23 00:08:28 -07:00
|
|
|
2.43.0
|
2023-02-16 15:44:46 -08:00
|
|
|
|