01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc.sql.conv;
12:
13: import com.versant.core.jdbc.JdbcConverter;
14: import com.versant.core.jdbc.JdbcConverterFactory;
15: import com.versant.core.jdbc.JdbcTypeRegistry;
16: import com.versant.core.jdbc.metadata.JdbcColumn;
17: import com.versant.core.jdbc.metadata.JdbcTypes;
18:
19: import javax.jdo.JDOFatalDataStoreException; //todo: appears only in throws clause
20: import java.sql.PreparedStatement;
21: import java.sql.SQLException;
22: import java.sql.ResultSet;
23: import java.io.File;
24: import java.util.HashMap;
25: import java.lang.reflect.Constructor;
26: import java.lang.reflect.InvocationTargetException;
27:
28: /**
29: * This a dummy converter that just uses ResultSet.getString and
30: * PreparedStatement.setString to read and write Strings.
31: *
32: * @keep-all
33: */
34: public class DummyStringConverter extends JdbcConverterBase {
35:
36: public static final DummyStringConverter INSTANCE = new DummyStringConverter();
37:
38: public Object get(ResultSet rs, int index, JdbcColumn col)
39: throws SQLException, JDOFatalDataStoreException {
40: return rs.getString(index);
41: }
42:
43: public void set(PreparedStatement ps, int index, JdbcColumn col,
44: Object value) throws SQLException,
45: JDOFatalDataStoreException {
46: ps.setString(index, (String) value);
47: }
48:
49: public Class getValueType() {
50: return String.class;
51: }
52:
53: }
|