Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b6acff

Browse files
committed
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.
1 parent d08741e commit 5b6acff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/interfaces/odbc/statement.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
#include "qresult.h"
2323
#include "convert.h"
2424
#include "environ.h"
25+
2526
#include <stdio.h>
2627
#include <string.h>
28+
#include <ctype.h>
2729

2830
#ifndef WIN32
2931
#include "iodbc.h"
@@ -353,6 +355,10 @@ statement_type(char *statement)
353355
{
354356
int i;
355357

358+
/* ignore leading whitespace in query string */
359+
while (*statement && isspace((unsigned char) *statement))
360+
statement++;
361+
356362
for (i = 0; Statement_Type[i].s; i++)
357363
if ( ! strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
358364
return Statement_Type[i].type;

0 commit comments

Comments
 (0)