I have the following code to perform a database level operation through our active record ORM layer.
public static void Vacuum() {
Execute(
delegate(ISession session, object instance) {
ISQLQuery query =
session.CreateSQLQuery(@"
VACUUM billableaddresses;
")
query.List();
return null;
}, null);
}
Normally when I need to do a non-query like this (its very rare I admit) I simple put a select '1'; after the query which appeases Active Record enough to execute the query asa nonquery.
However, the postgres 'vacuum' command, must be run on its own and cannot be part of a multi statement query.
looking ISQLQuery interface, there doesnt seem to be a method to execute a nonquery, so I was wondering how this can be done?