A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/apache/openjpa/commit/dd9bce0cc909bd96d706a9438bdc2a58111c481f below:

OPENJPA-2816 Add HerdDB DBDictionary - more fixes · apache/openjpa@dd9bce0 · GitHub

File tree Expand file treeCollapse file tree 5 files changed

+31

-7

lines changed

Filter options

Expand file treeCollapse file tree 5 files changed

+31

-7

lines changed Original file line number Diff line number Diff line change

@@ -26,6 +26,7 @@

26 26 27 27

import org.apache.openjpa.jdbc.conf.JDBCConfiguration;

28 28

import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;

29 +

import org.apache.openjpa.jdbc.identifier.DBIdentifier;

29 30

import org.apache.openjpa.jdbc.meta.ClassMapping;

30 31

import org.apache.openjpa.jdbc.meta.MappingRepository;

31 32

import org.apache.openjpa.jdbc.schema.Column;

@@ -115,8 +116,9 @@ protected synchronized Status getStatus(ClassMapping mapping) {

115 116

@Override

116 117

protected Column addPrimaryKeyColumn(Table table) {

117 118

DBDictionary dict = getConfiguration().getDBDictionaryInstance();

118 -

Column pkColumn = table.addColumn(dict.getValidColumnName(

119 -

getPrimaryKeyColumnIdentifier(), table));

119 +

DBIdentifier delimitedColumnName = dict.fromDBName(getPrimaryKeyColumn(), DBIdentifier.DBIdentifierType.COLUMN);

120 +

Column pkColumn = table.addColumn(dict.getValidColumnName

121 +

(delimitedColumnName, table));

120 122

pkColumn.setType(dict.getPreferredType(Types.VARCHAR));

121 123

pkColumn.setJavaType(JavaTypes.STRING);

122 124

pkColumn.setSize(dict.characterColumnSize);

Original file line number Diff line number Diff line change

@@ -375,8 +375,9 @@ protected Status getStatus(ClassMapping mapping) {

375 375

*/

376 376

protected Column addPrimaryKeyColumn(Table table) {

377 377

DBDictionary dict = _conf.getDBDictionaryInstance();

378 +

DBIdentifier delimitedColumnName = dict.fromDBName(getPrimaryKeyColumn(), DBIdentifier.DBIdentifierType.COLUMN);

378 379

Column pkColumn = table.addColumn(dict.getValidColumnName

379 -

(getPrimaryKeyColumnIdentifier(), table));

380 +

(delimitedColumnName, table));

380 381

pkColumn.setType(dict.getPreferredType(Types.TINYINT));

381 382

pkColumn.setJavaType(JavaTypes.INT);

382 383

return pkColumn;

@@ -417,8 +418,10 @@ private void buildTable() {

417 418

pk.addColumn(_pkColumn);

418 419 419 420

DBDictionary dict = _conf.getDBDictionaryInstance();

421 +

DBIdentifier _delimitedSeqColumnName = dict.delimitAll() ?

422 +

DBIdentifier.newColumn(this._seqColumnName.getName(), true) : this._seqColumnName;

420 423

_seqColumn = table.addColumn(dict.getValidColumnName

421 -

(_seqColumnName, table));

424 +

(_delimitedSeqColumnName, table));

422 425

_seqColumn.setType(dict.getPreferredType(Types.BIGINT));

423 426

_seqColumn.setJavaType(JavaTypes.LONG);

424 427 Original file line number Diff line number Diff line change

@@ -24,6 +24,7 @@

24 24 25 25

import org.apache.openjpa.jdbc.conf.JDBCConfiguration;

26 26

import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;

27 +

import org.apache.openjpa.jdbc.identifier.DBIdentifier;

27 28

import org.apache.openjpa.jdbc.meta.ClassMapping;

28 29

import org.apache.openjpa.jdbc.meta.MappingRepository;

29 30

import org.apache.openjpa.jdbc.schema.Column;

@@ -78,8 +79,9 @@ public void setPrimaryKeyValue(String value) {

78 79

@Override

79 80

protected Column addPrimaryKeyColumn(Table table) {

80 81

DBDictionary dict = getConfiguration().getDBDictionaryInstance();

82 +

DBIdentifier delimitedColumnName = dict.fromDBName(getPrimaryKeyColumn(), DBIdentifier.DBIdentifierType.COLUMN);

81 83

Column pkColumn = table.addColumn(dict.getValidColumnName

82 -

(getPrimaryKeyColumnIdentifier(), table));

84 +

(delimitedColumnName, table));

83 85

pkColumn.setType(dict.getPreferredType(Types.VARCHAR));

84 86

pkColumn.setJavaType(JavaTypes.STRING);

85 87

pkColumn.setSize(dict.characterColumnSize);

Original file line number Diff line number Diff line change

@@ -4462,7 +4462,7 @@ protected Column newColumn(ResultSet colMeta)

4462 4462

c.setSchemaIdentifier(fromDBName(colMeta.getString("TABLE_SCHEM"), DBIdentifierType.SCHEMA));

4463 4463

c.setTableIdentifier(fromDBName(colMeta.getString("TABLE_NAME"), DBIdentifierType.TABLE));

4464 4464

c.setIdentifier(fromDBName(colMeta.getString("COLUMN_NAME"), DBIdentifierType.COLUMN));

4465 -

c.setType(colMeta.getInt("DATA_TYPE"));

4465 +

c.setType(fromDBType(colMeta.getInt("DATA_TYPE")));

4466 4466

c.setTypeIdentifier(fromDBName(colMeta.getString("TYPE_NAME"), DBIdentifierType.COLUMN_DEFINITION));

4467 4467

c.setSize(colMeta.getInt("COLUMN_SIZE"));

4468 4468

c.setDecimalDigits(colMeta.getInt("DECIMAL_DIGITS"));

@@ -5900,7 +5900,14 @@ public String toDBName(DBIdentifier name, boolean delimit) {

5900 5900

return getNamingUtil().toDBName(name, delimit);

5901 5901

}

5902 5902 5903 +

public int fromDBType(int type) {

5904 +

return type;

5905 +

}

5906 + 5903 5907

public DBIdentifier fromDBName(String name, DBIdentifierType id) {

5908 +

if (delimitAll()) {

5909 +

name = Normalizer.delimit(name, true);

5910 +

}

5904 5911

return getNamingUtil().fromDBName(name, id);

5905 5912

}

5906 5913 Original file line number Diff line number Diff line change

@@ -18,6 +18,8 @@

18 18

*/

19 19

package org.apache.openjpa.jdbc.sql;

20 20 21 +

import java.sql.Types;

22 + 21 23

/**

22 24

* Dictionary for HerdDB.

23 25

*/

@@ -33,7 +35,7 @@ public HerdDBDictionary() {

33 35

supportsUniqueConstraints = false;

34 36

supportsCascadeDeleteAction = false;

35 37

schemaCase = SCHEMA_CASE_LOWER;

36 -

delimitedCase = SCHEMA_CASE_PRESERVE;

38 +

delimitedCase = SCHEMA_CASE_LOWER;

37 39 38 40

// make OpenJPA escape everything, because Apache Calcite has a lot of reserved words, like 'User', 'Value'...

39 41

setDelimitIdentifiers(true);

@@ -42,5 +44,13 @@ public HerdDBDictionary() {

42 44

setTrailingDelimiter(DELIMITER_BACK_TICK);

43 45

}

44 46 47 +

@Override

48 +

public int fromDBType(int i) {

49 +

if (i == Types.DOUBLE) {

50 +

return Types.REAL;

51 +

}

52 +

return i;

53 +

}

54 + 45 55

}

46 56

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4