"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hsqldb/src/org/hsqldb/StatementSession.java" between
hsqldb-2.7.1.zip and hsqldb-2.7.2.zip

About: HSQLDB (HyperSQL DataBase) is a SQL relational database engine written in Java. It supports nearly full ANSI-92 SQL (BNF format) and full core SQL:2008.

StatementSession.java  (hsqldb-2.7.1):StatementSession.java  (hsqldb-2.7.2)
/* Copyright (c) 2001-2022, The HSQL Development Group /* Copyright (c) 2001-2023, The HSQL Development Group
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* *
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
* *
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
skipping to change at line 54 skipping to change at line 54
import org.hsqldb.types.DateTimeType; import org.hsqldb.types.DateTimeType;
import org.hsqldb.types.DTIType; import org.hsqldb.types.DTIType;
import org.hsqldb.types.IntervalSecondData; import org.hsqldb.types.IntervalSecondData;
import org.hsqldb.types.Type; import org.hsqldb.types.Type;
import org.hsqldb.types.Types; import org.hsqldb.types.Types;
/** /**
* Implementation of Statement for SQL session statements.<p> * Implementation of Statement for SQL session statements.<p>
* *
* @author Fred Toussi (fredt@users dot sourceforge.net) * @author Fred Toussi (fredt@users dot sourceforge.net)
* @version 2.7.0 * @version 2.7.2
* @since 1.9.0 * @since 1.9.0
*/ */
public class StatementSession extends Statement { public class StatementSession extends Statement {
public static final StatementSession commitNoChainStatement = public static final StatementSession commitNoChainStatement =
new StatementSession(StatementTypes.COMMIT_WORK, new StatementSession(StatementTypes.COMMIT_WORK,
new Object[]{ Boolean.FALSE }); new Object[]{ Boolean.FALSE });
public static final StatementSession rollbackNoChainStatement = public static final StatementSession rollbackNoChainStatement =
new StatementSession(StatementTypes.ROLLBACK_WORK, new StatementSession(StatementTypes.ROLLBACK_WORK,
new Object[]{ Boolean.FALSE }); new Object[]{ Boolean.FALSE });
skipping to change at line 136 skipping to change at line 136
case StatementTypes.SET_SESSION_AUTHORIZATION : case StatementTypes.SET_SESSION_AUTHORIZATION :
case StatementTypes.SET_COLLATION : case StatementTypes.SET_COLLATION :
group = StatementTypes.X_SQL_SESSION; group = StatementTypes.X_SQL_SESSION;
break; break;
default : default :
throw Error.runtimeError(ErrorCode.U_S0500, throw Error.runtimeError(ErrorCode.U_S0500,
"StatementSession"); "StatementSession");
} }
e.resolveTypes(session, null); // e is null for SET ROLE NONE
if (e != null) {
e.resolveTypes(session, null);
switch (e.getType()) { switch (e.getType()) {
case OpTypes.VALUE : case OpTypes.VALUE:
break; break;
case OpTypes.DYNAMIC_PARAM :
e.setDataType(session, Type.SQL_VARCHAR_DEFAULT);
break;
case OpTypes.SQL_FUNCTION : case OpTypes.DYNAMIC_PARAM:
if (((FunctionSQL) e).isValueFunction()) { e.setDataType(session, Type.SQL_VARCHAR_DEFAULT);
break; break;
}
throw Error.error(ErrorCode.X_0P000); case OpTypes.SQL_FUNCTION:
default : if (((FunctionSQL) e).isValueFunction()) {
throw Error.error(ErrorCode.X_0P000); break;
} }
if (!e.getDataType().isCharacterType()) { throw Error.error(ErrorCode.X_0P000);
throw Error.error(ErrorCode.X_0P000); default:
throw Error.error(ErrorCode.X_0P000);
}
if (!e.getDataType().isCharacterType()) {
throw Error.error(ErrorCode.X_0P000);
}
} }
setDatabaseObjects(session, context); setDatabaseObjects(session, context);
} }
StatementSession(int type, Object[] args) { StatementSession(int type, Object[] args) {
super(type); super(type);
this.arguments = args; this.arguments = args;
skipping to change at line 537 skipping to change at line 540
return Result.updateZeroResult; return Result.updateZeroResult;
case StatementTypes.SET_PATH : case StatementTypes.SET_PATH :
return Result.updateZeroResult; return Result.updateZeroResult;
case StatementTypes.SET_ROLE : { case StatementTypes.SET_ROLE : {
String name; String name;
Grantee role = null; Grantee role = null;
try { try {
name = (String) expressions[0].getValue(session); if (expressions[0] != null) {
name = (String) expressions[0].getValue(session);
if (name != null) { if (name == null) {
name = (String) Type.SQL_VARCHAR.trim(session, name, return Result.newErrorResult(
' ', true, true); Error.error(ErrorCode.X_0P000), sql);
}
name = (String) Type.SQL_VARCHAR.trim(session, name,
' ', true, true);
role = session.database.granteeManager.getRole(name); role = session.database.granteeManager.getRole(name);
} }
} catch (HsqlException e) { } catch (HsqlException e) {
return Result.newErrorResult( return Result.newErrorResult(
Error.error(ErrorCode.X_0P000), sql); Error.error(ErrorCode.X_0P000), sql);
} }
if (session.isInMidTransaction()) { if (session.isInMidTransaction()) {
return Result.newErrorResult( return Result.newErrorResult(
Error.error(ErrorCode.X_25001), sql); Error.error(ErrorCode.X_25001), sql);
} }
if (role == null) { if (role == null || session.getGrantee().hasRole(role)) {
session.setRole(null);
}
if (session.getGrantee().hasRole(role)) {
session.setRole(role); session.setRole(role);
return Result.updateZeroResult; return Result.updateZeroResult;
} else { } else {
return Result.newErrorResult( return Result.newErrorResult(
Error.error(ErrorCode.X_0P000), sql); Error.error(ErrorCode.X_0P000), sql);
} }
} }
case StatementTypes.SET_SCHEMA : { case StatementTypes.SET_SCHEMA : {
String name; String name;
 End of changes. 12 change blocks. 
28 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)