mirror of
https://github.com/postgres/postgres.git
synced 2025-08-05 07:41:25 +03:00
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.
This commit is contained in:
@@ -22,8 +22,10 @@
|
|||||||
#include "qresult.h"
|
#include "qresult.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "environ.h"
|
#include "environ.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include "iodbc.h"
|
#include "iodbc.h"
|
||||||
@@ -353,6 +355,10 @@ statement_type(char *statement)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* ignore leading whitespace in query string */
|
||||||
|
while (*statement && isspace((unsigned char) *statement))
|
||||||
|
statement++;
|
||||||
|
|
||||||
for (i = 0; Statement_Type[i].s; i++)
|
for (i = 0; Statement_Type[i].s; i++)
|
||||||
if ( ! strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
|
if ( ! strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
|
||||||
return Statement_Type[i].type;
|
return Statement_Type[i].type;
|
||||||
|
Reference in New Issue
Block a user