|
@@ -231,10 +231,15 @@ public:
|
|
|
{
|
|
|
return columns;
|
|
|
}
|
|
|
- inline MYSQL_BIND &queryColumn(int colIdx) const
|
|
|
+ inline MYSQL_BIND &queryColumn(int colIdx, const char *name) const
|
|
|
{
|
|
|
if (colIdx >= columns)
|
|
|
- fail("Column index out of range");
|
|
|
+ {
|
|
|
+ VStringBuffer error("No matching bound column for parameter %d", colIdx);
|
|
|
+ if (name)
|
|
|
+ error.appendf(" (%s)", name);
|
|
|
+ fail(error);
|
|
|
+ }
|
|
|
return bindinfo[colIdx];
|
|
|
}
|
|
|
inline MYSQL_BIND *queryBindings() const
|
|
@@ -691,7 +696,7 @@ protected:
|
|
|
colIdx++;
|
|
|
else
|
|
|
fail("Too many fields in ECL output row");
|
|
|
- const MYSQL_BIND &column = resultInfo.queryColumn(colIdx);
|
|
|
+ const MYSQL_BIND &column = resultInfo.queryColumn(colIdx,field->name->queryStr());
|
|
|
if (*column.error)
|
|
|
failx("Error fetching column %s", field->name->queryStr());
|
|
|
return column;
|
|
@@ -846,7 +851,7 @@ public:
|
|
|
protected:
|
|
|
MYSQL_BIND &createBindBuffer(enum_field_types sqlType, unsigned size)
|
|
|
{
|
|
|
- MYSQL_BIND &bindInfo = bindings.queryColumn(thisParam++);
|
|
|
+ MYSQL_BIND &bindInfo = bindings.queryColumn(thisParam++, NULL);
|
|
|
mysqlembed::createBindBuffer(bindInfo, sqlType, size);
|
|
|
return bindInfo;
|
|
|
}
|
|
@@ -1198,7 +1203,7 @@ public:
|
|
|
virtual void callFunction()
|
|
|
{
|
|
|
if (nextParam != stmtInfo->queryInputBindings().numColumns())
|
|
|
- fail("Not enough parameters");
|
|
|
+ failx("Not enough parameters supplied (%d parameters supplied, but statement has %d bound columns)", nextParam, stmtInfo->queryInputBindings().numColumns());
|
|
|
if (!stmtInfo->hasResult())
|
|
|
lazyExecute();
|
|
|
}
|
|
@@ -1217,7 +1222,7 @@ protected:
|
|
|
lazyExecute(); // MORE this seems wrong to me - or at least needs to check not already executed
|
|
|
if (!stmtInfo->next())
|
|
|
typeError("scalar", NULL);
|
|
|
- return stmtInfo->queryResultBindings().queryColumn(0);
|
|
|
+ return stmtInfo->queryResultBindings().queryColumn(0, NULL);
|
|
|
}
|
|
|
void checkSingleRow()
|
|
|
{
|
|
@@ -1227,7 +1232,7 @@ protected:
|
|
|
inline MYSQL_BIND &findParameter(const char *name, enum_field_types sqlType, unsigned size)
|
|
|
{
|
|
|
// Everything is positional in MySQL
|
|
|
- MYSQL_BIND &bindInfo = stmtInfo->queryInputBindings().queryColumn(nextParam++);
|
|
|
+ MYSQL_BIND &bindInfo = stmtInfo->queryInputBindings().queryColumn(nextParam++, name);
|
|
|
createBindBuffer(bindInfo, sqlType, size);
|
|
|
return bindInfo;
|
|
|
}
|