Army wrote:

Since a parameter maker does not have a "defined" schema, does "current schema" mean the schema when the statement is prepared, or the schema when it is executed?

For example I can do the following in JDBC:

// Default schema ("APP").

PreparedStatement ps = conn.prepareStatement(
  "select tablename, tabletype from sys.systables where tablename = ?");

<snip>

If "current schema" means the "schema when the statement is *prepared*" then both of the above statements would fail (because there's no CAST on the syscol). That consistency would probably be a good thing (less confusing for users).

On the other hand, if the statement is changed to:

   // Default schema APP.

   PreparedStatement ps = conn.prepareStatement(
       "select tablename, tabletype from sys.systables where " +
       "CAST (tablename as varchar(128)) = ?");

then it might be better to take "current schema" to mean the time of *execution.* That way the the above statement will run correctly regardless of the current schema. If "current schema" was determined at compile time, the above statement would only work if "current schema" was a non-system schema.

Since I think we are going to encourage users to CAST system columns when doing comparisons (at least that's what I gathered from the various discussion threads), maybe it would be better to take the "current schema" for a parameter marker at execution time, after all...?

Army

Reply via email to