I'm having a problem with defining inline functions.
The problem I'm having seems to be the same
as
https://groups.google.com/forum/#!searchin/h2-database/does$20not$20exist$20alias/h2-database/FGs-wM4f_fs/vFh-ZqjMSo0J
but that thread does not have an answer.
I can't copy and paste error messages or code but I'll do my best at
recreating them:
CREATE ALIAS GET_LATEST_STATS AS $$
import org.h2.tools.SimpleResultSet;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Connection;
@CODE
ResultSet getLatestStats(Connection conn, String source, String dataName,
Integer count, String key) throws SQLException {
SimpleResultSet result = new SimpleResultSet();
ResultSet queryResult = conn.createStatement().executeQuery("SELECT
STATISTICS_VALUE FROM DATA_STATISTICS WHERE SOURCE='"+ source +"' AND
DATA_NAME='"+ dataName +"' + AND STAT_KEY='" + key +"' ORDER BY CREATED
DESC");
ResultSetMetaData rsmd = queryResult.getMetaData();
result.addColumn("STATISTICS_VALUE", rsmd.getColumnType(1),
rsmd.getPrecision(1), rsmd.getScale(1));
for (int i=0;i < count; i++) {
if(!queryResult.next()){
break;
} else {
result.addRow(new Object[] { queryResult.getString(1) });
}
}
return result;
}
$$;
I run this through an application I am running and there are no errors, and
then when I call the stored function through my application, it works
correctly and the correct result is returned.
The problem is that I then cannot use the H2 Console. When I open it and
connect to my database, rather than a list of the tables on the left side,
I get a whole load of error messages that I'm not going to take the time to
type out. The errors themselves are
"error: package org.h2.tools does not exist"
"error: cannot find symbol
symbol: class SimpleResultSet"
This isn't a fatal error for me; I don't need to use the H2 console, but it
is a very useful debugging tool for me and I'm also concerned that I might
be messing up some database internals
Thanks
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.