ibm_db 0.4.0 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  add : ADD
2
2
  after : AFTER
3
- alias : ALIAS # I-5 Reserved Word
3
+ alias : ALIAS
4
4
  all : ALL
5
5
  allocate : ALLOCATE
6
6
  allow : ALLOW
@@ -12,19 +12,19 @@
12
12
  associate : ASSOCIATE
13
13
  asutime : ASUTIME
14
14
  audit : AUDIT
15
- authorization : AUTHORIZATION # I-5 Reserved Word
15
+ authorization : AUTHORIZATION
16
16
  aux : AUX
17
17
  auxiliary : AUXILIARY
18
18
  before : BEFORE
19
19
  begin : BEGIN
20
20
  between : BETWEEN
21
- binary : BINARY # I-5 Reserved Word
21
+ binary : BINARY
22
22
  bufferpool : BUFFERPOOL
23
23
  by : BY
24
- cache : CACHE # I-5 Reserved Word
24
+ cache : CACHE
25
25
  call : CALL
26
- called : CALLED # I-5 Reserved Word
27
- cardinality : CARDINALITY # I-5 Reserved Word
26
+ called : CALLED
27
+ cardinality : CARDINALITY
28
28
  capture : CAPTURE
29
29
  cascaded : CASCADED
30
30
  case : CASE
@@ -47,31 +47,31 @@
47
47
  constraint : CONSTRAINT
48
48
  contains : CONTAINS
49
49
  continue : CONTINUE
50
- count : COUNT # I-5 Reserved Word
51
- count_big : COUNT_BIG # I-5 Reserved Word
50
+ count : COUNT
51
+ count_big : COUNT_BIG
52
52
  create : CREATE
53
- cross : CROSS # I-5 Reserved Word
53
+ cross : CROSS
54
54
  current : CURRENT
55
55
  current_date : CURRENT_DATE
56
56
  current_lc_ctype : CURRENT_LC_CTYPE
57
57
  current_path : CURRENT_PATH
58
58
  current_time : CURRENT_TIME
59
59
  current_timestamp : CURRENT_TIMESTAMP
60
- current_timezone : CURRENT_TIMEZONE # I-5 Reserved Word
61
- current_user : CURRENT_USER # I-5 Reserved Word
60
+ current_timezone : CURRENT_TIMEZONE
61
+ current_user : CURRENT_USER
62
62
  cursor : CURSOR
63
- cycle : CYCLE # I-5 Reserved Word
63
+ cycle : CYCLE
64
64
  data : DATA
65
65
  database : DATABASE
66
66
  day : DAY
67
67
  days : DAYS
68
68
  dbinfo : DBINFO
69
- db2genrl : DB2GENRL # I-5 Reserved Word
70
- db2sql : DB2SQL # I-5 Reserved Word
69
+ db2genrl : DB2GENRL
70
+ db2sql : DB2SQL
71
71
  declare : DECLARE
72
72
  default : DEFAULT
73
- defaults : DEFAULTS # I-5 Reserved Word
74
- definition : DEFINITION # I-5 Reserved Word
73
+ defaults : DEFAULTS
74
+ definition : DEFINITION
75
75
  delete : DELETE
76
76
  descriptor : DESCRIPTOR
77
77
  deterministic : DETERMINISTIC
@@ -83,7 +83,7 @@
83
83
  drop : DROP
84
84
  dssize : DSSIZE
85
85
  dynamic : DYNAMIC
86
- each : EACH # I-5 Reserved Word
86
+ each : EACH
87
87
  editproc : EDITPROC
88
88
  else : ELSE
89
89
  elseif : ELSEIF
@@ -95,7 +95,7 @@
95
95
  erase : ERASE
96
96
  escape : ESCAPE
97
97
  except : EXCEPT
98
- excluding : EXCLUDING # I-5 Reserved Word
98
+ excluding : EXCLUDING
99
99
  exception : EXCEPTION
100
100
  execute : EXECUTE
101
101
  exists : EXISTS
@@ -105,50 +105,50 @@
105
105
  fenced : FENCED
106
106
  fetch : FETCH
107
107
  fieldproc : FIELDPROC
108
- file : FILE # I-5 Reserved Word
108
+ file : FILE
109
109
  final : FINAL
110
110
  for : FOR
111
- foreign : FOREIGN # I-5 Reserved Word
111
+ foreign : FOREIGN
112
112
  free : FREE
113
113
  from : FROM
114
114
  full : FULL
115
115
  function : FUNCTION
116
- general : GENERAL # I-5 Reserved Word
116
+ general : GENERAL
117
117
  generated : GENERATED
118
118
  get : GET
119
119
  global : GLOBAL
120
120
  go : GO
121
121
  goto : GOTO
122
122
  grant : GRANT
123
- graphic : GRAPHIC # I-5 Reserved Word
123
+ graphic : GRAPHIC
124
124
  group : GROUP
125
125
  handler : HANDLER
126
126
  having : HAVING
127
127
  hold : HOLD
128
128
  hour : HOUR
129
129
  hours : HOURS
130
- identity : IDENTITY # I-5 Reserved Word
130
+ identity : IDENTITY
131
131
  if : IF
132
132
  immediate : IMMEDIATE
133
133
  in : IN
134
- including : INCLUDING # I-5 Reserved Word
134
+ including : INCLUDING
135
135
  inclusive : INCLUSIVE
136
- increment : INCREMENT # I-5 Reserved Word
136
+ increment : INCREMENT
137
137
  index : INDEX
138
- indicator : INDICATOR # I-5 Reserved Word
138
+ indicator : INDICATOR
139
139
  inherit : INHERIT
140
140
  inner : INNER
141
141
  inout : INOUT
142
142
  insensitive : INSENSITIVE
143
143
  insert : INSERT
144
- integrity : INTEGRITY # I-5 Reserved Word
144
+ integrity : INTEGRITY
145
145
  into : INTO
146
146
  is : IS
147
147
  isobid : ISOBID
148
- isolation : ISOLATION # I-5 Reserved Word
148
+ isolation : ISOLATION
149
149
  iterate : ITERATE
150
150
  jar : JAR
151
- java : JAVA # I-5 Reserved Word
151
+ java : JAVA
152
152
  join : JOIN
153
153
  key : KEY
154
154
  label : LABEL
@@ -157,7 +157,7 @@
157
157
  leave : LEAVE
158
158
  left : LEFT
159
159
  like : LIKE
160
- linktype : LINKTYPE # I-5 Reserved Word
160
+ linktype : LINKTYPE
161
161
  local : LOCAL
162
162
  locale : LOCALE
163
163
  locator : LOCATOR
@@ -169,46 +169,46 @@
169
169
  loop : LOOP
170
170
  maintained : MAINTAINED
171
171
  materialized : MATERIALIZED
172
- maxvalue : MAXVALUE # I-5 Reserved Word
172
+ maxvalue : MAXVALUE
173
173
  microsecond : MICROSECOND
174
174
  microseconds : MICROSECONDS
175
175
  minute : MINUTE
176
176
  minutes : MINUTES
177
- minvalue : MINVALUE # I-5 Reserved Word
178
- mode : MODE # I-5 Reserved Word
177
+ minvalue : MINVALUE
178
+ mode : MODE
179
179
  modifies : MODIFIES
180
180
  month : MONTH
181
181
  months : MONTHS
182
- new : NEW # I-5 Reserved Word
183
- new_table : NEW_TABLE # I-5 Reserved Word
182
+ new : NEW
183
+ new_table : NEW_TABLE
184
184
  nextval : NEXTVAL
185
185
  no : NO
186
- nocache : NOCACHE # I-5 Reserved Word
187
- nocycle : NOCYCLE # I-5 Reserved Word
188
- nodename : NODENAME # I-5 Reserved Word
189
- nodenumber : NODENUMBER # I-5 Reserved Word
190
- nomaxvalue : NOMAXVALUE # I-5 Reserved Word
191
- nominvalue : NOMINVALUE # I-5 Reserved Word
186
+ nocache : NOCACHE
187
+ nocycle : NOCYCLE
188
+ nodename : NODENAME
189
+ nodenumber : NODENUMBER
190
+ nomaxvalue : NOMAXVALUE
191
+ nominvalue : NOMINVALUE
192
192
  none : NONE
193
- noorder : NOORDER # I-5 Reserved Word
193
+ noorder : NOORDER
194
194
  not : NOT
195
195
  null : NULL
196
196
  nulls : NULLS
197
197
  numparts : NUMPARTS
198
198
  obid : OBID
199
199
  of : OF
200
- old : OLD # I-5 Reserved Word
201
- old_table : OLD_TABLE # I-5 Reserved Word
200
+ old : OLD
201
+ old_table : OLD_TABLE
202
202
  on : ON
203
203
  open : OPEN
204
204
  optimization : OPTIMIZATION
205
205
  optimize : OPTIMIZE
206
- option : OPTION # I-5 Reserved Word
206
+ option : OPTION
207
207
  or : OR
208
208
  order : ORDER
209
209
  out : OUT
210
210
  outer : OUTER
211
- overriding : OVERRIDING # I-5 Reserved Word
211
+ overriding : OVERRIDING
212
212
  package : PACKAGE
213
213
  parameter : PARAMETER
214
214
  part : PART
@@ -219,11 +219,11 @@
219
219
  path : PATH
220
220
  piecesize : PIECESIZE
221
221
  plan : PLAN
222
- position : POSITION # I-5 Reserved Word
222
+ position : POSITION
223
223
  precision : PRECISION
224
224
  prepare : PREPARE
225
225
  prevval : PREVVAL
226
- primary : PRIMARY # I-5 Reserved Word
226
+ primary : PRIMARY
227
227
  priqty : PRIQTY
228
228
  privileges : PRIVILEGES
229
229
  procedure : PROCEDURE
@@ -231,19 +231,19 @@
231
231
  psid : PSID
232
232
  query : QUERY
233
233
  queryno : QUERYNO
234
- read : READ # I-5 Reserved Word
234
+ read : READ
235
235
  reads : READS
236
- recovery : RECOVERY # I-5 Reserved Word
236
+ recovery : RECOVERY
237
237
  references : REFERENCES
238
- referencing : REFERENCING # I-5 Reserved Word
238
+ referencing : REFERENCING
239
239
  refresh : REFRESH
240
240
  resignal : RESIGNAL
241
241
  release : RELEASE
242
242
  rename : RENAME
243
243
  repeat : REPEAT
244
- reset : RESET # I-5 Reserved Word
245
- resignal : RESIGNAL # I-5 Reserved Word
246
- restart : RESTART # I-5 Reserved Word
244
+ reset : RESET
245
+ resignal : RESIGNAL
246
+ restart : RESTART
247
247
  restrict : RESTRICT
248
248
  result : RESULT
249
249
  result_set_locator : RESULT_SET_LOCATOR
@@ -252,11 +252,11 @@
252
252
  revoke : REVOKE
253
253
  right : RIGHT
254
254
  rollback : ROLLBACK
255
- routine : ROUTINE # I-5 Reserved Word
256
- row : ROW # I-5 Reserved Word
257
- rows : ROWS # I-5 Reserved Word
255
+ routine : ROUTINE
256
+ row : ROW
257
+ rows : ROWS
258
258
  rowset : ROWSET
259
- rrn : RRN # I-5 Reserved Word
259
+ rrn : RRN
260
260
  run : RUN
261
261
  savepoint : SAVEPOINT
262
262
  schema : SCHEMA
@@ -274,16 +274,16 @@
274
274
  some : SOME
275
275
  source : SOURCE
276
276
  specific : SPECIFIC
277
- sql : SQL # I-5 Reserved Word
278
- sqlid : SQLID # I-5 Reserved Word
277
+ sql : SQL
278
+ sqlid : SQLID
279
279
  standard : STANDARD
280
- start : START # I-5 Reserved Word
280
+ start : START
281
281
  static : STATIC
282
282
  stay : STAY
283
283
  stogroup : STOGROUP
284
284
  stores : STORES
285
285
  style : STYLE
286
- substring : SUBSTRING # I-5 Reserved Word
286
+ substring : SUBSTRING
287
287
  summary : SUMMARY
288
288
  synonym : SYNONYM
289
289
  sysfun : SYSFUN
@@ -294,18 +294,18 @@
294
294
  tablespace : TABLESPACE
295
295
  then : THEN
296
296
  to : TO
297
- transaction : TRANSACTION # I-5 Reserved Word
297
+ transaction : TRANSACTION
298
298
  trigger : TRIGGER
299
- trim : TRIM # I-5 Reserved Word
300
- type : TYPE # I-5 Reserved Word
299
+ trim : TRIM
300
+ type : TYPE
301
301
  undo : UNDO
302
302
  union : UNION
303
303
  unique : UNIQUE
304
304
  until : UNTIL
305
305
  update : UPDATE
306
306
  user : USER
307
- usage : USAGE # I-5 Reserved Word
308
- user : USER # I-5 Reserved Word
307
+ usage : USAGE
308
+ user : USER
309
309
  using : USING
310
310
  validproc : VALIDPROC
311
311
  value : VALUE
@@ -322,7 +322,7 @@
322
322
  while : WHILE
323
323
  with : WITH
324
324
  wlm : WLM
325
- write : WRITE # I-5 Reserved Word
325
+ write : WRITE
326
326
  xmlelement : XMLELEMENT
327
327
  year : YEAR
328
328
  years : YEARS
Binary file
@@ -0,0 +1,128 @@
1
+ require 'abstract_unit'
2
+
3
+ class AdapterTest < Test::Unit::TestCase
4
+ def setup
5
+ @connection = ActiveRecord::Base.connection
6
+ end
7
+
8
+ if current_adapter?(:IBM_DBAdapter)
9
+ def test_a_connection_attributes
10
+ if @connection.respond_to?(:schema)
11
+ previous_schema = ActiveRecord::Base.connection.schema
12
+ ActiveRecord::Base.connection.schema = 'SYSCAT'
13
+ assert_equal 'SYSCAT', ActiveRecord::Base.connection.schema
14
+ ActiveRecord::Base.connection.schema = previous_schema
15
+ else
16
+ warn "#{@connection.class} does not support client connection attribute schema_name"
17
+ end
18
+
19
+ if @connection.respond_to?(:app_user)
20
+ ActiveRecord::Base.connection.app_user = 'new_user'
21
+ assert_equal 'new_user', ActiveRecord::Base.connection.app_user
22
+ else
23
+ warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_USER"
24
+ end
25
+
26
+ if @connection.respond_to?(:account)
27
+ ActiveRecord::Base.connection.account = 'new_acct'
28
+ assert_equal 'new_acct', ActiveRecord::Base.connection.account
29
+ else
30
+ warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_ACCTSTR"
31
+ end
32
+
33
+ if @connection.respond_to?(:application)
34
+ ActiveRecord::Base.connection.application = 'new_app'
35
+ assert_equal 'new_app', ActiveRecord::Base.connection.application
36
+ else
37
+ warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_APPLNAME"
38
+ end
39
+
40
+ if @connection.respond_to?(:workstation)
41
+ ActiveRecord::Base.connection.workstation = 'new_wrkst'
42
+ assert_equal 'new_wrkst', ActiveRecord::Base.connection.workstation
43
+ else
44
+ warn "#{@connection.class} does not support client connection attribute SQL_ATTR_INFO_WRKSTNNAME"
45
+ end
46
+ end
47
+ end
48
+
49
+ def test_tables
50
+ if @connection.respond_to?(:tables)
51
+ tables = @connection.tables
52
+ assert tables.include?("accounts")
53
+ assert tables.include?("authors")
54
+ assert tables.include?("tasks")
55
+ assert tables.include?("topics")
56
+ else
57
+ warn "#{@connection.class} does not respond to #tables"
58
+ end
59
+ end
60
+
61
+ def test_indexes
62
+ idx_name = "accounts_idx"
63
+
64
+ if @connection.respond_to?(:indexes)
65
+ indexes = @connection.indexes("accounts")
66
+ assert indexes.empty?
67
+
68
+ @connection.add_index :accounts, :firm_id, :name => idx_name
69
+ indexes = @connection.indexes("accounts")
70
+ assert_equal "accounts", indexes.first.table
71
+ # OpenBase does not have the concept of a named index
72
+ # Indexes are merely properties of columns.
73
+ assert_equal idx_name, indexes.first.name unless current_adapter?(:OpenBaseAdapter)
74
+ assert !indexes.first.unique
75
+ assert_equal ["firm_id"], indexes.first.columns
76
+ else
77
+ warn "#{@connection.class} does not respond to #indexes"
78
+ end
79
+
80
+ ensure
81
+ @connection.remove_index(:accounts, :name => idx_name) rescue nil
82
+ end
83
+
84
+ def test_current_database
85
+ if @connection.respond_to?(:current_database)
86
+ assert_equal ENV['ARUNIT_DB_NAME'] || "activerecord_unittest", @connection.current_database
87
+ end
88
+ end
89
+
90
+ def test_table_alias
91
+ def @connection.test_table_alias_length() 10; end
92
+ class << @connection
93
+ alias_method :old_table_alias_length, :table_alias_length
94
+ alias_method :table_alias_length, :test_table_alias_length
95
+ end
96
+
97
+ assert_equal 'posts', @connection.table_alias_for('posts')
98
+ assert_equal 'posts_comm', @connection.table_alias_for('posts_comments')
99
+ assert_equal 'dbo_posts', @connection.table_alias_for('dbo.posts')
100
+
101
+ class << @connection
102
+ alias_method :table_alias_length, :old_table_alias_length
103
+ end
104
+ end
105
+
106
+ # test resetting sequences in odd tables in postgreSQL
107
+ if ActiveRecord::Base.connection.respond_to?(:reset_pk_sequence!)
108
+ require 'fixtures/movie'
109
+ require 'fixtures/subscriber'
110
+
111
+ def test_reset_empty_table_with_custom_pk
112
+ Movie.delete_all
113
+ Movie.connection.reset_pk_sequence! 'movies'
114
+ assert_equal 1, Movie.create(:name => 'fight club').id
115
+ end
116
+
117
+ if ActiveRecord::Base.connection.adapter_name != "FrontBase"
118
+ def test_reset_table_with_non_integer_pk
119
+ Subscriber.delete_all
120
+ Subscriber.connection.reset_pk_sequence! 'subscribers'
121
+ sub = Subscriber.new(:name => 'robert drake')
122
+ sub.id = 'bob drake'
123
+ assert_nothing_raised { sub.save! }
124
+ end
125
+ end
126
+ end
127
+
128
+ end