Skip to main content

Postgresql-odbc Review

return SQL_SUCCESS; // In performance.c - new file for performance features typedef struct uint64_t query_start_time; uint64_t query_end_time; char last_query[4096]; int slow_query_threshold_ms; PerformanceMetrics; void start_query_trace(StatementInfo_ *stmt, const char *query) if (stmt->perf_metrics) stmt->perf_metrics->query_start_time = get_current_time_ms(); strncpy(stmt->perf_metrics->last_query, query, sizeof(stmt->perf_metrics->last_query) - 1);

int cache_prepared_statement(ConnectionInfo_ *ci, const char *name, const char *sql) StatementCacheEntry *entry = malloc(sizeof(StatementCacheEntry)); if (!entry) return -1; postgresql-odbc

// In prepared.c typedef struct StatementCacheEntry char *statement_name; char *sql; PGresult *prepared_result; time_t last_used; int use_count; struct StatementCacheEntry *next; StatementCacheEntry; static StatementCacheEntry *statement_cache = NULL; return SQL_SUCCESS; // In performance

curr = curr->next;

StatementCacheEntry *find_cached_statement(const char *sql) StatementCacheEntry *curr = statement_cache; while (curr) if (strcmp(curr->sql, sql) == 0) curr->last_used = time(NULL); curr->use_count++; return curr; void start_query_trace(StatementInfo_ *stmt

// Validate parameters if (!Parameter Adding support for a PostgreSQL data type (e.g., JSONB with better handling):