01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 2008.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.sail.rdbms.mysql.alt;
07:
08: import java.sql.PreparedStatement;
09: import java.sql.SQLException;
10: import java.sql.Types;
11:
12: import org.openrdf.sail.rdbms.schema.ValueTable;
13:
14: /**
15: *
16: * @author James Leigh
17: */
18: public class MySqlValueTable extends ValueTable {
19: private static final String FEILD_COLLATE = " CHARACTER SET utf8 COLLATE utf8_bin";
20:
21: @Override
22: public String sql(int type, int length) {
23: String declare = super .sql(type, length);
24: if (type == Types.VARCHAR) {
25: return declare + FEILD_COLLATE;
26: } else if (type == Types.LONGVARCHAR) {
27: return declare + FEILD_COLLATE;
28: } else {
29: return declare;
30: }
31: }
32:
33: @Override
34: protected PreparedStatement prepareInsert(String s)
35: throws SQLException {
36: String name = getInsertTable().getName();
37: String sql = BatchInsertStatement.prepareSql(name, "id",
38: "value");
39: PreparedStatement stmt = super .prepareInsert(sql);
40: return new BatchInsertStatement(stmt, name, "id", "value");
41: }
42:
43: }
|