Revision 29123

View differences:

branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/store/jdbc/JDBCHelper.java
98 98
	private Boolean allowAutomaticValues = null;
99 99
	private Boolean supportsUnions = null;
100 100

  
101
	private String identifierQuoteString;
102

  
101 103
	protected JDBCHelper(JDBCHelperUser consumer,
102 104
			JDBCConnectionParameters params) throws InitializeException {
103 105

  
......
738 740
	}
739 741

  
740 742
	public String escapeFieldName(String field) {
741
		return field;
743
		if (field.matches("[a-z][a-z0-9_]*")) {
744
			return field;
745
		}
746
		String quote = getIdentifierQuoteString();
747
		return quote + field + quote;
742 748
	}
743 749

  
744 750
	public Object dalValueToJDBC(
......
1031 1037
		}
1032 1038
		return supportsUnions.booleanValue();
1033 1039
	}
1040

  
1041
	protected String getIdentifierQuoteString() {
1042
		if (identifierQuoteString == null) {
1043
		ConnectionAction action = new ConnectionAction() {
1044

  
1045
			public Object action(Connection conn) throws DataException {
1046

  
1047
				try {
1048
					DatabaseMetaData meta = conn.getMetaData();
1049
					return meta.getIdentifierQuoteString();
1050
				} catch (SQLException e) {
1051
					throw new JDBCSQLException(e);
1052
				}
1053
			}
1054

  
1055
		};
1056

  
1057
		try {
1058
			identifierQuoteString = (String) doConnectionAction(action);
1059
		} catch (Exception e) {
1060
			logger.error("Exception checking for unions support", e);
1061
			identifierQuoteString = " ";
1062
			}
1063
		}
1064
		return identifierQuoteString;
1065
	}
1066

  
1067
	protected boolean isReservedWord(String field) {
1068
		// TODO
1069
		return false;
1070
	}
1071

  
1034 1072
}

Also available in: Unified diff