返回对象时java中的无效游标异常
我无法找出代码中存在的一些小问题。我有一个从存储过程返回多个标志的方法 这是我的密码:返回对象时java中的无效游标异常,java,database,dataset,Java,Database,Dataset,我无法找出代码中存在的一些小问题。我有一个从存储过程返回多个标志的方法 这是我的密码: // QueryDataSet qds; Object[] flags = null; flags = (Call to a stored procedure that is returning multiple result sets) if(flags != null) { for(int i = 0; i < flags.length; i++) { qds = ((
// QueryDataSet qds;
Object[] flags = null;
flags = (Call to a stored procedure that is returning multiple result sets)
if(flags != null)
{
for(int i = 0; i < flags.length; i++)
{
qds = ((QueryDataSet)flags[i]);
if(qds != null)
{
int result = qds.getRecord(0).getValue(1).asInt();
if(result>0) booleanflags[i]=true;
}
}
}
// getValue implementation is returning type of Record and getValue takes in the columnIndex. The stored procedure is returning multiple records and only one column and I am trying to check the count. If greater that 1 then return true else false.
// I am using the debugger and see that the first time in the loop the value is returned fine but when i=1 then it returns Invalid cursor position.
//查询数据集qds;
对象[]标志=null;
flags=(对返回多个结果集的存储过程的调用)
如果(标志!=null)
{
对于(int i=0;i0)booleanflags[i]=true;
}
}
}
//getValue实现返回记录类型,getValue接受columnIndex。存储过程返回多条记录,只返回一列,我正在尝试检查计数。如果大于1,则返回true,否则返回false。
//我正在使用调试器,并看到在循环中第一次返回的值很好,但当I=1时,它返回无效的光标位置。
什么类型的对象是标志
?为什么要将其强制转换为QueryDataSet
?标志具有整数对象,但由于我存储的过程只能返回Object[]数组,因此我正在尝试转换对象数组,但什么是QueryDataSet?它是在我的项目中定义的类型。我想这是java.sql.ResultSet顶端的一个层。这有帮助吗?从select子句获取记录时,我们可以获得数据库中的单个记录和列