Class: TestIngresEnvionmentDateFormat

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/tests/tc_env_date_format.rb

Instance Method Summary collapse

Instance Method Details

#test_connect_env_date_finlandObject



13
14
15
16
17
# File 'ext/tests/tc_env_date_format.rb', line 13

def test_connect_env_date_finland
  @@ing = Ingres.new()
  @@ing.connect(:database => @@database, :date_format => Ingres::DATE_FORMAT_FINLAND)
  assert_equal "2009-11-09 15:14:00", @@ing.execute("select date('2009-11-09 15:14:00')").flatten[0]
end

#test_connect_env_date_iso4Object



7
8
9
10
11
# File 'ext/tests/tc_env_date_format.rb', line 7

def test_connect_env_date_iso4
  @@ing = Ingres.new()
  @@ing.connect(:database => @@database, :date_format => Ingres::DATE_FORMAT_ISO4)
  assert_equal "20091109 15:14:00", @@ing.execute("select date('20091109 15:14:00')").flatten[0]
end

#test_connect_env_date_multinational4Object



19
20
21
22
23
# File 'ext/tests/tc_env_date_format.rb', line 19

def test_connect_env_date_multinational4
  @@ing = Ingres.new()
  @@ing.connect(:database => @@database, :date_format => Ingres::DATE_FORMAT_MULTINATIONAL4)
  assert_equal "09/11/2009 15:14:00", @@ing.execute("select date('09/11/2009 15:14:00')").flatten[0]
end

#test_set_env_date_finlandObject



33
34
35
36
37
38
# File 'ext/tests/tc_env_date_format.rb', line 33

def test_set_env_date_finland
  @@ing = Ingres.new()
  @@ing.connect(:database => @@database)
  @@ing.set_environment(:date_format => Ingres::DATE_FORMAT_FINLAND)
  assert_equal "2006-10-11 20:26:00", @@ing.execute("select rt_arrive_at, rt_depart_at from route where rt_depart_from = 'VLL' and rt_arrive_to = 'LHR'")[0][1]
end

#test_set_env_date_iso4Object

Same as above but using Ingres.set_environment()



26
27
28
29
30
31
# File 'ext/tests/tc_env_date_format.rb', line 26

def test_set_env_date_iso4
  @@ing = Ingres.new()
  @@ing.connect(:database => @@database)
  @@ing.set_environment(:date_format => Ingres::DATE_FORMAT_ISO4)
  assert_equal "20061012 01:09:00", @@ing.execute("select rt_arrive_at, rt_depart_at from route where rt_depart_from = 'VLL' and rt_arrive_to = 'LHR'")[0][0]
end

#test_set_env_date_multinational4Object



40
41
42
43
44
45
# File 'ext/tests/tc_env_date_format.rb', line 40

def test_set_env_date_multinational4
  @@ing = Ingres.new()
  @@ing.connect(:database => @@database)
  @@ing.set_environment(:date_format => Ingres::DATE_FORMAT_MULTINATIONAL4)
  assert_equal "11/10/2006 23:40:00", @@ing.execute("select rt_arrive_at, rt_depart_at from route where rt_depart_from = 'VLL' and rt_arrive_to = 'LHR'")[1][0]
end