|
27 | 27 | #include "arrow/flight/sql/odbc/odbc_api.h" |
28 | 28 | #include "arrow/flight/sql/odbc/visibility.h" |
29 | 29 |
|
| 30 | +#include "arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/logger.h" |
| 31 | + |
30 | 32 | SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result) { |
31 | 33 | return arrow::SQLAllocHandle(type, parent, result); |
32 | 34 | } |
@@ -79,7 +81,8 @@ SQLRETURN SQL_API SQLSetEnvAttr(SQLHENV env, SQLINTEGER attr, SQLPOINTER valuePt |
79 | 81 |
|
80 | 82 | SQLRETURN SQL_API SQLSetConnectAttrW(SQLHDBC conn, SQLINTEGER attr, SQLPOINTER value, |
81 | 83 | SQLINTEGER valueLen) { |
82 | | - // TODO implement SQLSetConnectAttr |
| 84 | + LOG_DEBUG("SQLSetConnectAttrW called with conn: {}, attr: {}, value: {}, valueLen: {}", |
| 85 | + conn, attr, value, valueLen); |
83 | 86 | return SQL_ERROR; |
84 | 87 | } |
85 | 88 |
|
@@ -109,3 +112,217 @@ SQLRETURN SQL_API SQLConnectW(SQLHDBC conn, SQLWCHAR* dsnName, SQLSMALLINT dsnNa |
109 | 112 | } |
110 | 113 |
|
111 | 114 | SQLRETURN SQL_API SQLDisconnect(SQLHDBC conn) { return arrow::SQLDisconnect(conn); } |
| 115 | + |
| 116 | +SQLRETURN SQL_API SQLBindCol(SQLHSTMT statementHandle, SQLUSMALLINT columnNumber, |
| 117 | + SQLSMALLINT targetType, SQLPOINTER targetValuePtr, |
| 118 | + SQLLEN bufferLength, SQLLEN* strLen_or_IndPtr) { |
| 119 | + LOG_DEBUG( |
| 120 | + "SQLBindCol called with statementHandle: {}, columnNumber: {}, targetType: {}, " |
| 121 | + "targetValuePtr: {}, bufferLength: {}, strLen_or_IndPtr: {}", |
| 122 | + statementHandle, columnNumber, targetType, targetValuePtr, bufferLength, |
| 123 | + fmt::ptr(strLen_or_IndPtr)); |
| 124 | + return SQL_ERROR; |
| 125 | +} |
| 126 | + |
| 127 | +SQLRETURN SQL_API SQLCancel(SQLHSTMT statementHandle) { |
| 128 | + LOG_DEBUG("SQLCancel called with statementHandle: {}", statementHandle); |
| 129 | + return SQL_ERROR; |
| 130 | +} |
| 131 | + |
| 132 | +SQLRETURN SQL_API SQLCloseCursor(SQLHSTMT statementHandle) { |
| 133 | + LOG_DEBUG("SQLCloseCursor called with statementHandle: {}", statementHandle); |
| 134 | + return SQL_ERROR; |
| 135 | +} |
| 136 | + |
| 137 | +SQLRETURN SQL_API SQLColAttributeW(SQLHSTMT statementHandle, SQLUSMALLINT columnNumber, |
| 138 | + SQLUSMALLINT fieldIdentifier, |
| 139 | + SQLPOINTER characterAttributePtr, |
| 140 | + SQLSMALLINT bufferLength, SQLSMALLINT* stringLengthPtr, |
| 141 | + SQLLEN* numericAttributePtr) { |
| 142 | + LOG_DEBUG( |
| 143 | + "SQLColAttributeW called with statementHandle: {}, columnNumber: {}, " |
| 144 | + "fieldIdentifier: {}, characterAttributePtr: {}, bufferLength: {}, " |
| 145 | + "stringLengthPtr: {}, numericAttributePtr: {}", |
| 146 | + statementHandle, columnNumber, fieldIdentifier, characterAttributePtr, bufferLength, |
| 147 | + fmt::ptr(stringLengthPtr), fmt::ptr(numericAttributePtr)); |
| 148 | + return SQL_ERROR; |
| 149 | +} |
| 150 | + |
| 151 | +SQLRETURN SQL_API SQLColumnsW(SQLHSTMT statementHandle, SQLWCHAR* catalogName, |
| 152 | + SQLSMALLINT catalogNameLength, SQLWCHAR* schemaName, |
| 153 | + SQLSMALLINT schemaNameLength, SQLWCHAR* tableName, |
| 154 | + SQLSMALLINT tableNameLength, SQLWCHAR* columnName, |
| 155 | + SQLSMALLINT columnNameLength) { |
| 156 | + LOG_DEBUG( |
| 157 | + "SQLColumnsW called with statementHandle: {}, catalogName: {}, catalogNameLength: " |
| 158 | + "{}, " |
| 159 | + "schemaName: {}, schemaNameLength: {}, tableName: {}, tableNameLength: {}, " |
| 160 | + "columnName: {}, " |
| 161 | + "columnNameLength: {}", |
| 162 | + statementHandle, fmt::ptr(catalogName), catalogNameLength, fmt::ptr(schemaName), |
| 163 | + schemaNameLength, fmt::ptr(tableName), tableNameLength, fmt::ptr(columnName), |
| 164 | + columnNameLength); |
| 165 | + return SQL_ERROR; |
| 166 | +} |
| 167 | + |
| 168 | +SQLRETURN SQL_API SQLErrorW(SQLHENV handleType, SQLHDBC handle, SQLHSTMT hstmt, |
| 169 | + SQLWCHAR FAR* szSqlState, SQLINTEGER FAR* pfNativeError, |
| 170 | + SQLWCHAR FAR* szErrorMsg, SQLSMALLINT cbErrorMsgMax, |
| 171 | + SQLSMALLINT FAR* pcbErrorMsg) { |
| 172 | + LOG_DEBUG( |
| 173 | + "SQLErrorW called with handleType: {}, handle: {}, hstmt: {}, szSqlState: {}, " |
| 174 | + "pfNativeError: {}, szErrorMsg: {}, cbErrorMsgMax: {}, pcbErrorMsg: {}", |
| 175 | + handleType, handle, hstmt, fmt::ptr(szSqlState), fmt::ptr(pfNativeError), |
| 176 | + fmt::ptr(szErrorMsg), cbErrorMsgMax, fmt::ptr(pcbErrorMsg)); |
| 177 | + return SQL_ERROR; |
| 178 | +} |
| 179 | + |
| 180 | +SQLRETURN SQL_API SQLExecDirectW(SQLHSTMT statementHandle, SQLWCHAR* statementText, |
| 181 | + SQLINTEGER textLength) { |
| 182 | + LOG_DEBUG( |
| 183 | + "SQLExecDirectW called with statementHandle: {}, statementText: {}, textLength: {}", |
| 184 | + statementHandle, fmt::ptr(statementText), textLength); |
| 185 | + return SQL_ERROR; |
| 186 | +} |
| 187 | + |
| 188 | +SQLRETURN SQL_API SQLExecute(SQLHSTMT statementHandle) { |
| 189 | + LOG_DEBUG("SQLExecute called with statementHandle: {}", statementHandle); |
| 190 | + return SQL_ERROR; |
| 191 | +} |
| 192 | + |
| 193 | +SQLRETURN SQL_API SQLFetch(SQLHSTMT statementHandle) { |
| 194 | + LOG_DEBUG("SQLFetch called with statementHandle: {}", statementHandle); |
| 195 | + return SQL_ERROR; |
| 196 | +} |
| 197 | + |
| 198 | +SQLRETURN SQL_API SQLForeignKeysW(SQLHSTMT statementHandle, SQLWCHAR* pKCatalogName, |
| 199 | + SQLSMALLINT pKCatalogNameLength, SQLWCHAR* pKSchemaName, |
| 200 | + SQLSMALLINT pKSchemaNameLength, SQLWCHAR* pKTableName, |
| 201 | + SQLSMALLINT pKTableNameLength, SQLWCHAR* fKCatalogName, |
| 202 | + SQLSMALLINT fKCatalogNameLength, SQLWCHAR* fKSchemaName, |
| 203 | + SQLSMALLINT fKSchemaNameLength, SQLWCHAR* fKTableName, |
| 204 | + SQLSMALLINT fKTableNameLength) { |
| 205 | + LOG_DEBUG( |
| 206 | + "SQLForeignKeysW called with statementHandle: {}, pKCatalogName: {}, " |
| 207 | + "pKCatalogNameLength: " |
| 208 | + "{}, pKSchemaName: {}, pKSchemaNameLength: {}, pKTableName: {}, pKTableNameLength: " |
| 209 | + "{}, " |
| 210 | + "fKCatalogName: {}, fKCatalogNameLength: {}, fKSchemaName: {}, fKSchemaNameLength: " |
| 211 | + "{}, " |
| 212 | + "fKTableName: {}, fKTableNameLength : {}", |
| 213 | + statementHandle, fmt::ptr(pKCatalogName), pKCatalogNameLength, |
| 214 | + fmt::ptr(pKSchemaName), pKSchemaNameLength, fmt::ptr(pKTableName), |
| 215 | + pKTableNameLength, fmt::ptr(fKCatalogName), fKCatalogNameLength, |
| 216 | + fmt::ptr(fKSchemaName), fKSchemaNameLength, fmt::ptr(fKTableName), |
| 217 | + fKTableNameLength); |
| 218 | + return SQL_ERROR; |
| 219 | +} |
| 220 | + |
| 221 | +SQLRETURN SQL_API SQLGetConnectAttrW(SQLHDBC connectionHandle, SQLINTEGER attribute, |
| 222 | + SQLPOINTER valuePtr, SQLINTEGER bufferLength, |
| 223 | + SQLINTEGER* stringLengthPtr) { |
| 224 | + LOG_DEBUG( |
| 225 | + "SQLGetConnectAttrW called with connectionHandle: {}, attribute: {}, valuePtr: {}, " |
| 226 | + "bufferLength: {}, stringLengthPtr: {}", |
| 227 | + connectionHandle, attribute, valuePtr, bufferLength, fmt::ptr(stringLengthPtr)); |
| 228 | + return SQL_ERROR; |
| 229 | +} |
| 230 | + |
| 231 | +SQLRETURN SQL_API SQLGetData(SQLHSTMT statementHandle, SQLUSMALLINT col_or_Param_Num, |
| 232 | + SQLSMALLINT targetType, SQLPOINTER targetValuePtr, |
| 233 | + SQLLEN bufferLength, SQLLEN* strLen_or_IndPtr) { |
| 234 | + LOG_DEBUG( |
| 235 | + "SQLGetData called with statementHandle: {}, col_or_Param_Num: {}, targetType: {}, " |
| 236 | + "targetValuePtr: {}, bufferLength: {}, strLen_or_IndPtr: {}", |
| 237 | + statementHandle, col_or_Param_Num, targetType, targetValuePtr, bufferLength, |
| 238 | + fmt::ptr(strLen_or_IndPtr)); |
| 239 | + return SQL_ERROR; |
| 240 | +} |
| 241 | + |
| 242 | +SQLRETURN SQL_API SQLGetStmtAttrW(SQLHSTMT statementHandle, SQLINTEGER attribute, |
| 243 | + SQLPOINTER valuePtr, SQLINTEGER bufferLength, |
| 244 | + SQLINTEGER* stringLengthPtr) { |
| 245 | + LOG_DEBUG( |
| 246 | + "SQLGetStmtAttrW called with statementHandle: {}, attribute: {}, valuePtr: {}, " |
| 247 | + "bufferLength: {}, stringLengthPtr: {}", |
| 248 | + statementHandle, attribute, valuePtr, bufferLength, fmt::ptr(stringLengthPtr)); |
| 249 | + return SQL_ERROR; |
| 250 | +} |
| 251 | + |
| 252 | +SQLRETURN SQL_API SQLGetTypeInfoW(SQLHSTMT statementHandle, SQLSMALLINT dataType) { |
| 253 | + LOG_DEBUG("SQLGetTypeInfoW called with statementHandle: {} dataType: {}", |
| 254 | + statementHandle, dataType); |
| 255 | + return SQL_ERROR; |
| 256 | +} |
| 257 | + |
| 258 | +SQLRETURN SQL_API SQLMoreResults(SQLHSTMT statementHandle) { |
| 259 | + LOG_DEBUG("SQLMoreResults called with statementHandle: {}", statementHandle); |
| 260 | + return SQL_ERROR; |
| 261 | +} |
| 262 | + |
| 263 | +SQLRETURN SQL_API SQLNativeSqlW(SQLHDBC connectionHandle, SQLWCHAR* inStatementText, |
| 264 | + SQLINTEGER inStatementTextLength, |
| 265 | + SQLWCHAR* outStatementText, SQLINTEGER bufferLength, |
| 266 | + SQLINTEGER* outStatementTextLength) { |
| 267 | + LOG_DEBUG( |
| 268 | + "SQLNativeSqlW called with connectionHandle: {}, inStatementText: {}, " |
| 269 | + "inStatementTextLength: " |
| 270 | + "{}, outStatementText: {}, bufferLength: {}, outStatementTextLength: {}", |
| 271 | + connectionHandle, fmt::ptr(inStatementText), inStatementTextLength, |
| 272 | + fmt::ptr(outStatementText), bufferLength, fmt::ptr(outStatementTextLength)); |
| 273 | + return SQL_ERROR; |
| 274 | +} |
| 275 | + |
| 276 | +SQLRETURN SQL_API SQLNumResultCols(SQLHSTMT statementHandle, |
| 277 | + SQLSMALLINT* columnCountPtr) { |
| 278 | + LOG_DEBUG("SQLNumResultCols called with statementHandle: {}, columnCountPtr: {}", |
| 279 | + statementHandle, fmt::ptr(columnCountPtr)); |
| 280 | + return SQL_ERROR; |
| 281 | +} |
| 282 | + |
| 283 | +SQLRETURN SQL_API SQLPrepareW(SQLHSTMT statementHandle, SQLWCHAR* statementText, |
| 284 | + SQLINTEGER textLength) { |
| 285 | + LOG_DEBUG( |
| 286 | + "SQLPrepareW called with statementHandle: {}, statementText: {}, textLength: {}", |
| 287 | + statementHandle, fmt::ptr(statementText), textLength); |
| 288 | + return SQL_ERROR; |
| 289 | +} |
| 290 | + |
| 291 | +SQLRETURN SQL_API SQLPrimaryKeysW(SQLHSTMT statementHandle, SQLWCHAR* catalogName, |
| 292 | + SQLSMALLINT catalogNameLength, SQLWCHAR* schemaName, |
| 293 | + SQLSMALLINT schemaNameLength, SQLWCHAR* tableName, |
| 294 | + SQLSMALLINT tableNameLength) { |
| 295 | + LOG_DEBUG( |
| 296 | + "SQLPrimaryKeysW called with statementHandle: {}, catalogName: {}, " |
| 297 | + "catalogNameLength: " |
| 298 | + "{}, schemaName: {}, schemaNameLength: {}, tableName: {}, tableNameLength: {}", |
| 299 | + statementHandle, fmt::ptr(catalogName), catalogNameLength, fmt::ptr(schemaName), |
| 300 | + schemaNameLength, fmt::ptr(tableName), tableNameLength); |
| 301 | + return SQL_ERROR; |
| 302 | +} |
| 303 | + |
| 304 | +SQLRETURN SQL_API SQLSetStmtAttrW(SQLHSTMT statementHandle, SQLINTEGER attribute, |
| 305 | + SQLPOINTER valuePtr, SQLINTEGER stringLength) { |
| 306 | + LOG_DEBUG( |
| 307 | + "SQLSetStmtAttrW called with statementHandle: {}, attribute: {}, valuePtr: {}, " |
| 308 | + "stringLength: {}", |
| 309 | + statementHandle, attribute, valuePtr, stringLength); |
| 310 | + return SQL_ERROR; |
| 311 | +} |
| 312 | + |
| 313 | +SQLRETURN SQL_API SQLTablesW(SQLHSTMT statementHandle, SQLWCHAR* catalogName, |
| 314 | + SQLSMALLINT catalogNameLength, SQLWCHAR* schemaName, |
| 315 | + SQLSMALLINT schemaNameLength, SQLWCHAR* tableName, |
| 316 | + SQLSMALLINT tableNameLength, SQLWCHAR* tableType, |
| 317 | + SQLSMALLINT tableTypeLength) { |
| 318 | + LOG_DEBUG( |
| 319 | + "SQLTablesW called with statementHandle: {}, catalogName: {}, catalogNameLength: " |
| 320 | + "{}, " |
| 321 | + "schemaName: {}, schemaNameLength: {}, tableName: {}, tableNameLength: {}, " |
| 322 | + "tableType: {}, " |
| 323 | + "tableTypeLength: {}", |
| 324 | + statementHandle, fmt::ptr(catalogName), catalogNameLength, fmt::ptr(schemaName), |
| 325 | + schemaNameLength, fmt::ptr(tableName), tableNameLength, fmt::ptr(tableType), |
| 326 | + tableTypeLength); |
| 327 | + return SQL_ERROR; |
| 328 | +} |
0 commit comments