summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-02-10 03:12:16 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-02-10 03:12:16 +0000
commit5b6acff6e0ccba0797236c4202554c935bdf0f66 (patch)
treec1880ccc40e06b69afd74cde756327999cbd88b2
parentd08741eab55f44214d08f33177523ec4821de532 (diff)
Ignore leading whitespace when trying to determine statement type,
so that ODBC driver doesn't go belly up by failing to recognize a SELECT as such.
-rw-r--r--src/interfaces/odbc/statement.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c
index 185c78bf633..06d97f7457e 100644
--- a/src/interfaces/odbc/statement.c
+++ b/src/interfaces/odbc/statement.c
@@ -22,8 +22,10 @@
#include "qresult.h"
#include "convert.h"
#include "environ.h"
+
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#ifndef WIN32
#include "iodbc.h"
@@ -353,6 +355,10 @@ statement_type(char *statement)
{
int i;
+ /* ignore leading whitespace in query string */
+ while (*statement && isspace((unsigned char) *statement))
+ statement++;
+
for (i = 0; Statement_Type[i].s; i++)
if ( ! strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
return Statement_Type[i].type;