Handle Procedure calls.
Now the version is 7.01.0006.
This commit is contained in:
parent
ef20f0ce25
commit
bbca11bf3b
@ -1056,7 +1056,30 @@ copy_statement_with_parameters(StatementClass *stmt)
|
|||||||
|
|
||||||
if (!end)
|
if (!end)
|
||||||
continue;
|
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';
|
*end = '\0';
|
||||||
|
|
||||||
esc = convert_escape(begin);
|
esc = convert_escape(begin);
|
||||||
@ -1075,6 +1098,9 @@ copy_statement_with_parameters(StatementClass *stmt)
|
|||||||
*end = '}';
|
*end = '}';
|
||||||
continue;
|
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
|
* Can you have parameter markers inside of quotes? I dont think
|
||||||
|
@ -802,7 +802,7 @@ SQLGetFunctions(
|
|||||||
{
|
{
|
||||||
static char *func = "SQLGetFunctions";
|
static char *func = "SQLGetFunctions";
|
||||||
|
|
||||||
mylog("%s: entering...\n", func);
|
mylog("%s: entering...%u\n", func);
|
||||||
|
|
||||||
if (fFunction == SQL_API_ALL_FUNCTIONS)
|
if (fFunction == SQL_API_ALL_FUNCTIONS)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Comments: See "notice.txt" for copyright and license information.
|
* 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 DRIVERNAME "PostgreSQL ODBC"
|
||||||
#define DBMS_NAME "PostgreSQL"
|
#define DBMS_NAME "PostgreSQL"
|
||||||
|
|
||||||
#define POSTGRESDRIVERVERSION "07.01.0005"
|
#define POSTGRESDRIVERVERSION "07.01.0006"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
|
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
|
||||||
|
@ -342,8 +342,8 @@ END
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 7,1,0,5
|
FILEVERSION 7,1,0,6
|
||||||
PRODUCTVERSION 7,1,0,5
|
PRODUCTVERSION 7,1,0,6
|
||||||
FILEFLAGSMASK 0x3L
|
FILEFLAGSMASK 0x3L
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@ -365,14 +365,14 @@ BEGIN
|
|||||||
VALUE "CompanyName", "Insight Distribution Systems\0"
|
VALUE "CompanyName", "Insight Distribution Systems\0"
|
||||||
#endif
|
#endif
|
||||||
VALUE "FileDescription", "PostgreSQL Driver\0"
|
VALUE "FileDescription", "PostgreSQL Driver\0"
|
||||||
VALUE "FileVersion", " 07.01.0005\0"
|
VALUE "FileVersion", " 07.01.0006\0"
|
||||||
VALUE "InternalName", "psqlodbc\0"
|
VALUE "InternalName", "psqlodbc\0"
|
||||||
VALUE "LegalCopyright", "\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 "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 "OriginalFilename", "psqlodbc.dll\0"
|
||||||
VALUE "PrivateBuild", "\0"
|
VALUE "PrivateBuild", "\0"
|
||||||
VALUE "ProductName", "Microsoft Open Database Connectivity\0"
|
VALUE "ProductName", "Microsoft Open Database Connectivity\0"
|
||||||
VALUE "ProductVersion", " 07.01.0005\0"
|
VALUE "ProductVersion", " 07.01.0006\0"
|
||||||
VALUE "SpecialBuild", "\0"
|
VALUE "SpecialBuild", "\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -81,6 +81,9 @@ static struct
|
|||||||
{
|
{
|
||||||
STMT_TYPE_REVOKE, "REVOKE"
|
STMT_TYPE_REVOKE, "REVOKE"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
STMT_TYPE_PROCCALL, "{"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
0, NULL
|
0, NULL
|
||||||
}
|
}
|
||||||
@ -1054,6 +1057,31 @@ SC_execute(StatementClass *self)
|
|||||||
CC_abort(conn);
|
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)
|
if (self->errornumber == STMT_OK)
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
else if (self->errornumber == STMT_INFO_ONLY)
|
else if (self->errornumber == STMT_INFO_ONLY)
|
||||||
|
@ -98,6 +98,7 @@ enum
|
|||||||
STMT_TYPE_DROP,
|
STMT_TYPE_DROP,
|
||||||
STMT_TYPE_GRANT,
|
STMT_TYPE_GRANT,
|
||||||
STMT_TYPE_REVOKE,
|
STMT_TYPE_REVOKE,
|
||||||
|
STMT_TYPE_PROCCALL
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STMT_UPDATE(stmt) (stmt->statement_type > STMT_TYPE_SELECT)
|
#define STMT_UPDATE(stmt) (stmt->statement_type > STMT_TYPE_SELECT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user