1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.jumpmind.symmetric.db.firebird;
22
23 import org.apache.commons.logging.Log;
24 import org.apache.commons.logging.LogFactory;
25 import org.jumpmind.symmetric.db.AbstractDbDialect;
26 import org.jumpmind.symmetric.db.IDbDialect;
27 import org.jumpmind.symmetric.model.Trigger;
28 import org.jumpmind.symmetric.model.TriggerHistory;
29
30 public class FirebirdDbDialect extends AbstractDbDialect implements IDbDialect {
31
32 static final Log logger = LogFactory.getLog(FirebirdDbDialect.class);
33
34 static final String TRANSACTION_ID_FUNCTION_NAME = "fn_transaction_id";
35
36 static final String SYNC_TRIGGERS_DISABLED_USER_VARIABLE = "explain_pretty_print";
37
38 protected void initForSpecificDialect() {
39
40
41
42
43
44
45
46
47 }
48
49 @Override
50 protected boolean doesTriggerExistOnPlatform(String catalogName, String schema, String tableName, String triggerName) {
51 return jdbcTemplate.queryForInt("select count(*) from rdb$triggers where rdb$trigger_name = ?",
52 new Object[] { triggerName }) > 0;
53 }
54
55 public void removeTrigger(String schemaName, String triggerName) {
56 throw new RuntimeException("Not implemented. Use removeTrigger(schema, trigger, table) instead.");
57 }
58
59 public void removeTrigger(String catalogName, String schemaName, String triggerName, String tableName, TriggerHistory oldHistory) {
60 schemaName = schemaName == null ? "" : (schemaName + ".");
61 try {
62 jdbcTemplate.update("drop trigger " + schemaName + triggerName);
63 } catch (Exception e) {
64 logger.warn("Trigger does not exist");
65 }
66 }
67
68 public void disableSyncTriggers() {
69
70
71 }
72
73 public void disableSyncTriggers(String nodeId) {
74 }
75
76 public void enableSyncTriggers() {
77
78
79 }
80
81 public String getSyncTriggersExpression() {
82
83
84 return "1 = 1";
85 }
86
87 public String getTransactionTriggerExpression(Trigger trigger) {
88 return "null";
89 }
90
91 public String getSelectLastInsertIdSql(String sequenceName) {
92 return "select gen_id(gen_" + sequenceName + ", 1) from rdb$database";
93 }
94
95 public boolean isCharSpacePadded() {
96 return true;
97 }
98
99 public boolean isCharSpaceTrimmed() {
100 return false;
101 }
102
103 public boolean isEmptyStringNulled() {
104 return false;
105 }
106
107 public boolean storesUpperCaseNamesInCatalog() {
108 return true;
109 }
110
111 protected boolean allowsNullForIdentityColumn() {
112 return false;
113 }
114
115 public void purge() {
116 }
117
118 public String getName() {
119 return super.getName().substring(0, 49);
120 }
121
122 public String getDefaultCatalog() {
123 return null;
124 }
125
126 public String getDefaultSchema() {
127 return null;
128 }
129
130 }