* only eg impl/load/import.java specifies property insertMode=replace/bulkInsert
* in the insert statement. This same property will not be acceptable from an
* insert statement from a user sql.
*/
final public Properties propertyList(boolean propertiesUseAllowed) throws ParseException, StandardException {
Properties properties = new FormatableProperties();
StringTokenizer commaSeparatedProperties;
StringTokenizer equalOperatorSeparatedProperty;
jj_consume_token(DERBYDASHPROPERTIES);
//first use StringTokenizer to get tokens which are delimited by ,s
commaSeparatedProperties = new StringTokenizer(getToken(1).image,",");
while (commaSeparatedProperties.hasMoreTokens()) {
//Now verify that tokens delimited by ,s follow propertyName=value pattern
String currentProperty = commaSeparatedProperties.nextToken();
equalOperatorSeparatedProperty = new StringTokenizer(currentProperty,"=", true);
if (equalOperatorSeparatedProperty.countTokens() != 3)
{if (true) throw StandardException.newException(SQLState.PROPERTY_SYNTAX_INVALID);}
else {
String key = equalOperatorSeparatedProperty.nextToken().trim();
if (!equalOperatorSeparatedProperty.nextToken().equals("="))
{if (true) throw StandardException.newException(SQLState.PROPERTY_SYNTAX_INVALID);}
String value = equalOperatorSeparatedProperty.nextToken().trim();
verifyImageLength(value);
/* Trim off the leading and trailing ', and compress all '' to ' */
if (value.startsWith("'") && value.endsWith("'"))
value = StringUtil.compressQuotes(value.substring(1, value.length() - 1), SINGLEQUOTES);
/* Trim off the leading and trailing ", and compress all "" to " */
else if (value.startsWith("\"") && value.endsWith("\""))
value = StringUtil.compressQuotes(value.substring(1, value.length() - 1), DOUBLEQUOTES);
else
value = value.toUpperCase();
// Do not allow user to specify multiple values for the same key
if (properties.put(key, value) != null)
{
{if (true) throw StandardException.newException(SQLState.LANG_DUPLICATE_PROPERTY, key);}
}
}
}