global
Variables
Utilities
COMPONENTS
CUSTOM STYLES

Postgresql-odbc -

return 0; // In odbcapi.c - implement new ODBC function SQLRETURN SQL_API SQLMyNewFunction( SQLHENV EnvironmentHandle, SQLCHAR *Parameter, SQLSMALLINT ParameterLen)

switch (target_type) case SQL_C_CHAR: if (target_value) // Convert JSONB to string strncpy((char *)target_value, value, *target_len); *target_len = strlen(value); break; case SQL_C_BINARY: // Handle binary JSONB conversion if (target_value) memcpy(target_value, value, min(*target_len, strlen(value))); *target_len = strlen(value); break; default: return SQL_ERROR;

Build Environment # Clone the repository git clone https://github.com/postgres/postgresql-odbc.git cd postgresql-odbc Configure with debug options ./configure --enable-debug --enable-unicode CFLAGS="-g -O0" Build make clean make make install Testing Your Feature // Add test in test/test_feature.c void test_new_connection_parameter() SQLHDBC hdbc; SQLRETURN ret; // Test connection with new parameter ret = SQLConnect(hdbc, (SQLCHAR*)"DSN=PostgreSQL;MyNewFeature=1", SQL_NTS, NULL, 0, NULL, 0); postgresql-odbc

if (duration > stmt->perf_metrics->slow_query_threshold_ms) QLOG_LOG(LOG_WARNING, "Slow query detected: %s (duration: %llu ms)", stmt->perf_metrics->last_query, duration);

// In connection.h typedef struct // ... existing fields char my_new_param[256]; // new parameter int my_new_feature_enabled; ConnectionInfo_; // In connection.c - parse connection string static int parse_connection_string(ConnectionInfo_ *ci, const char *conn_str) // ... existing parsing code return 0; // In odbcapi

// In convert.c SQLRETURN convert_jsonb_to_c( const char *value, SQLSMALLINT target_type, void *target_value, SQLLEN *target_len)

Adding support for a PostgreSQL data type (e.g., JSONB with better handling): *target_len = strlen(value)

void end_query_trace(StatementInfo_ *stmt) if (stmt->perf_metrics) stmt->perf_metrics->query_end_time = get_current_time_ms(); uint64_t duration = stmt->perf_metrics->query_end_time - stmt->perf_metrics->query_start_time;