Skip to content

Commit b1f94f2

Browse files
committed
[bugfix] Function signatures used xs:long for SQL handles, but this was not enforced in eXist-db, and so accidentally internally xs:integer was being used. This has now been corrected
1 parent 7840a02 commit b1f94f2

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

extensions/modules/sql/src/main/java/org/exist/xquery/modules/sql/ExecuteFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public class ExecuteFunction extends BasicFunction {
106106
),
107107
arity(
108108
FS_PARAM_CONNECTION_HANDLE,
109-
param("statement-handle", Type.INTEGER, "The prepared statement handle"),
109+
param("statement-handle", Type.LONG, "The prepared statement handle"),
110110
optParam("parameters", Type.ELEMENT, "Parameters for the prepared statement. e.g. <sql:parameters><sql:param sql:type=\"long\">1234</sql:param><sql:param sql:type=\"varchar\"><sql:null/></sql:param></sql:parameters>"),
111111
FS_PARAM_MAKE_NODE_FROM_COLUMN_NAME
112112
)

extensions/modules/sql/src/main/java/org/exist/xquery/modules/sql/GetConnectionFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
130130
}
131131

132132
// store the Connection and return the uid handle of the Connection
133-
return new IntegerValue(SQLModule.storeConnection(context, connection));
133+
return new IntegerValue(SQLModule.storeConnection(context, connection), Type.LONG);
134134
}
135135

136136
private Connection getConnection(final Sequence[] args) throws XPathException {

extensions/modules/sql/src/main/java/org/exist/xquery/modules/sql/GetJNDIConnectionFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathExce
126126
}
127127

128128
// store the connection and return the uid handle of the connection
129-
return (new IntegerValue(SQLModule.storeConnection(context, con)));
129+
return (new IntegerValue(SQLModule.storeConnection(context, con), Type.LONG));
130130
} catch (Exception e) {
131131
throw (new XPathException(this, e.getMessage()));
132132
}

extensions/modules/sql/src/main/java/org/exist/xquery/modules/sql/PrepareFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathExce
112112
stmt = con.prepareStatement(sql);
113113

114114
// store the PreparedStatement and return the uid handle of the PreparedStatement
115-
return (new IntegerValue(SQLModule.storePreparedStatement(context, new PreparedStatementWithSQL(sql, stmt))));
115+
return (new IntegerValue(SQLModule.storePreparedStatement(context, new PreparedStatementWithSQL(sql, stmt)), Type.LONG));
116116
} catch (SQLException sqle) {
117117
LOG.error("sql:prepare() Caught SQLException \"{}\" for SQL: \"{}\"", sqle.getMessage(), sql, sqle);
118118

0 commit comments

Comments
 (0)