aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHiroshi Inoue <inoue@tpf.co.jp>2001-06-27 07:38:07 +0000
committerHiroshi Inoue <inoue@tpf.co.jp>2001-06-27 07:38:07 +0000
commitbbca11bf3bb33d5853ca83b1252d17c9df3ebe6f (patch)
tree115f63c7f6f46ee501b07acfdda49757ba395e66 /src
parentef20f0ce255a76973b48ab24e813beff7c5446a1 (diff)
downloadpostgresql-bbca11bf3bb33d5853ca83b1252d17c9df3ebe6f.tar.gz
postgresql-bbca11bf3bb33d5853ca83b1252d17c9df3ebe6f.zip
Handle Procedure calls.
Now the version is 7.01.0006.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/odbc/convert.c28
-rw-r--r--src/interfaces/odbc/info.c2
-rw-r--r--src/interfaces/odbc/psqlodbc.h4
-rw-r--r--src/interfaces/odbc/psqlodbc.rc8
-rw-r--r--src/interfaces/odbc/statement.c28
-rw-r--r--src/interfaces/odbc/statement.h1
6 files changed, 63 insertions, 8 deletions
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c
index 09c6ca81f55..69d3043b952 100644
--- a/src/interfaces/odbc/convert.c
+++ b/src/interfaces/odbc/convert.c
@@ -1056,7 +1056,30 @@ copy_statement_with_parameters(StatementClass *stmt)
if (!end)
continue;
-
+ /* procedure calls */
+ if (stmt->statement_type == STMT_TYPE_PROCCALL)
+ {
+ while (isspace((unsigned char) old_statement[++opos]));
+ if (old_statement[opos] == '?')
+ {
+ param_number++;
+ while (isspace((unsigned char) old_statement[++opos]));
+ if (old_statement[opos] != '=')
+ {
+ opos--;
+ continue;
+ }
+ while (isspace((unsigned char) old_statement[++opos]));
+ }
+ if (strnicmp(&old_statement[opos], "call", 4))
+ {
+ opos--;
+ continue;
+ }
+ opos += (4 - 1);
+ CVT_APPEND_STR("SELECT");
+ continue;
+ }
*end = '\0';
esc = convert_escape(begin);
@@ -1075,6 +1098,9 @@ copy_statement_with_parameters(StatementClass *stmt)
*end = '}';
continue;
}
+ /* End of a procedure call */
+ else if (oldchar == '}' && stmt->statement_type == STMT_TYPE_PROCCALL)
+ continue;
/*
* Can you have parameter markers inside of quotes? I dont think
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c
index 39a0a49a988..a18778ceddb 100644
--- a/src/interfaces/odbc/info.c
+++ b/src/interfaces/odbc/info.c
@@ -802,7 +802,7 @@ SQLGetFunctions(
{
static char *func = "SQLGetFunctions";
- mylog("%s: entering...\n", func);
+ mylog("%s: entering...%u\n", func);
if (fFunction == SQL_API_ALL_FUNCTIONS)
{
diff --git a/src/interfaces/odbc/psqlodbc.h b/src/interfaces/odbc/psqlodbc.h
index c14b32045bf..156ec458c2d 100644
--- a/src/interfaces/odbc/psqlodbc.h
+++ b/src/interfaces/odbc/psqlodbc.h
@@ -5,7 +5,7 @@
*
* Comments: See "notice.txt" for copyright and license information.
*
- * $Id: psqlodbc.h,v 1.43 2001/05/17 02:56:37 inoue Exp $
+ * $Id: psqlodbc.h,v 1.44 2001/06/27 07:38:07 inoue Exp $
*
*/
@@ -42,7 +42,7 @@ typedef UInt4 Oid;
#define DRIVERNAME "PostgreSQL ODBC"
#define DBMS_NAME "PostgreSQL"
-#define POSTGRESDRIVERVERSION "07.01.0005"
+#define POSTGRESDRIVERVERSION "07.01.0006"
#ifdef WIN32
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
diff --git a/src/interfaces/odbc/psqlodbc.rc b/src/interfaces/odbc/psqlodbc.rc
index 6f42f402da6..85bfcdb2893 100644
--- a/src/interfaces/odbc/psqlodbc.rc
+++ b/src/interfaces/odbc/psqlodbc.rc
@@ -342,8 +342,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 7,1,0,5
- PRODUCTVERSION 7,1,0,5
+ FILEVERSION 7,1,0,6
+ PRODUCTVERSION 7,1,0,6
FILEFLAGSMASK 0x3L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -365,14 +365,14 @@ BEGIN
VALUE "CompanyName", "Insight Distribution Systems\0"
#endif
VALUE "FileDescription", "PostgreSQL Driver\0"
- VALUE "FileVersion", " 07.01.0005\0"
+ VALUE "FileVersion", " 07.01.0006\0"
VALUE "InternalName", "psqlodbc\0"
VALUE "LegalCopyright", "\0"
VALUE "LegalTrademarks", "ODBC(TM) is a trademark of Microsoft Corporation. Microsoft® is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0"
VALUE "OriginalFilename", "psqlodbc.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Microsoft Open Database Connectivity\0"
- VALUE "ProductVersion", " 07.01.0005\0"
+ VALUE "ProductVersion", " 07.01.0006\0"
VALUE "SpecialBuild", "\0"
END
END
diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c
index 473d5709880..165700dc09d 100644
--- a/src/interfaces/odbc/statement.c
+++ b/src/interfaces/odbc/statement.c
@@ -82,6 +82,9 @@ static struct
STMT_TYPE_REVOKE, "REVOKE"
},
{
+ STMT_TYPE_PROCCALL, "{"
+ },
+ {
0, NULL
}
};
@@ -1054,6 +1057,31 @@ SC_execute(StatementClass *self)
CC_abort(conn);
}
+ if (self->statement_type == STMT_TYPE_PROCCALL &&
+ (self->errornumber == STMT_OK ||
+ self->errornumber == STMT_INFO_ONLY) &&
+ self->parameters &&
+ self->parameters[0].buflen > 0 &&
+ self->parameters[0].paramType == SQL_PARAM_OUTPUT)
+ { /* get the return value of the procedure call */
+ RETCODE ret;
+ HSTMT hstmt = (HSTMT) self;
+ ret = SQLBindCol(hstmt, 1, self->parameters[0].CType, self->parameters[0].buffer, self->parameters[0].buflen, self->parameters[0].used);
+ if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO)
+ SC_fetch(hstmt);
+ else
+ {
+ self->errornumber = STMT_EXEC_ERROR;
+ self->errormsg = "BindCol to Procedure return failed.";
+ }
+ if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO)
+ SQLBindCol(hstmt, 1, self->parameters[0].CType, NULL, 0, NULL);
+ else
+ {
+ self->errornumber = STMT_EXEC_ERROR;
+ self->errormsg = "SC_fetch to get a Procedure return failed.";
+ }
+ }
if (self->errornumber == STMT_OK)
return SQL_SUCCESS;
else if (self->errornumber == STMT_INFO_ONLY)
diff --git a/src/interfaces/odbc/statement.h b/src/interfaces/odbc/statement.h
index 3f2fef5db7d..f27c4cc138d 100644
--- a/src/interfaces/odbc/statement.h
+++ b/src/interfaces/odbc/statement.h
@@ -98,6 +98,7 @@ enum
STMT_TYPE_DROP,
STMT_TYPE_GRANT,
STMT_TYPE_REVOKE,
+ STMT_TYPE_PROCCALL
};
#define STMT_UPDATE(stmt) (stmt->statement_type > STMT_TYPE_SELECT)