vertica 0.12.0 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -20
  3. data/lib/vertica.rb +15 -8
  4. data/lib/vertica/column.rb +32 -13
  5. data/lib/vertica/connection.rb +143 -119
  6. data/lib/vertica/{messages/backend_messages → protocol/backend}/authentication.rb +1 -1
  7. data/lib/vertica/{messages/backend_messages → protocol/backend}/backend_key_data.rb +1 -1
  8. data/lib/vertica/{messages/backend_messages → protocol/backend}/bind_complete.rb +1 -1
  9. data/lib/vertica/{messages/backend_messages → protocol/backend}/close_complete.rb +1 -1
  10. data/lib/vertica/{messages/backend_messages → protocol/backend}/command_complete.rb +1 -1
  11. data/lib/vertica/{messages/backend_messages → protocol/backend}/copy_in_response.rb +2 -2
  12. data/lib/vertica/{messages/backend_messages → protocol/backend}/data_row.rb +1 -1
  13. data/lib/vertica/{messages/backend_messages → protocol/backend}/empty_query_response.rb +1 -1
  14. data/lib/vertica/{messages/backend_messages → protocol/backend}/error_response.rb +1 -1
  15. data/lib/vertica/{messages/backend_messages → protocol/backend}/no_data.rb +1 -1
  16. data/lib/vertica/{messages/backend_messages → protocol/backend}/notice_response.rb +6 -6
  17. data/lib/vertica/{messages/backend_messages → protocol/backend}/parameter_description.rb +2 -2
  18. data/lib/vertica/{messages/backend_messages → protocol/backend}/parameter_status.rb +3 -3
  19. data/lib/vertica/{messages/backend_messages → protocol/backend}/parse_complete.rb +1 -1
  20. data/lib/vertica/{messages/backend_messages → protocol/backend}/portal_suspended.rb +1 -1
  21. data/lib/vertica/{messages/backend_messages → protocol/backend}/ready_for_query.rb +2 -2
  22. data/lib/vertica/{messages/backend_messages → protocol/backend}/row_description.rb +9 -9
  23. data/lib/vertica/{messages/backend_messages → protocol/backend}/unknown.rb +1 -1
  24. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/bind.rb +2 -3
  25. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/cancel_request.rb +3 -4
  26. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/close.rb +3 -3
  27. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/copy_data.rb +6 -6
  28. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/copy_done.rb +1 -1
  29. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/copy_fail.rb +5 -5
  30. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/describe.rb +3 -3
  31. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/execute.rb +3 -3
  32. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/flush.rb +1 -1
  33. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/parse.rb +3 -3
  34. data/lib/vertica/protocol/frontend/password.rb +32 -0
  35. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/query.rb +3 -4
  36. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/ssl_request.rb +2 -2
  37. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/startup.rb +2 -3
  38. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/sync.rb +1 -1
  39. data/lib/vertica/{messages/frontend_messages → protocol/frontend}/terminate.rb +1 -1
  40. data/lib/vertica/protocol/message.rb +86 -0
  41. data/lib/vertica/query.rb +63 -44
  42. data/lib/vertica/result.rb +25 -47
  43. data/lib/vertica/row.rb +44 -0
  44. data/lib/vertica/row_description.rb +102 -0
  45. data/lib/vertica/version.rb +1 -1
  46. data/test/connection.yml.example +8 -8
  47. data/test/functional/functional_connection_test.rb +178 -0
  48. data/test/functional/{query_test.rb → functional_query_test.rb} +64 -67
  49. data/test/functional/functional_value_conversion_test.rb +117 -0
  50. data/test/test_helper.rb +1 -1
  51. data/test/unit/backend_message_test.rb +57 -57
  52. data/test/unit/column_test.rb +23 -23
  53. data/test/unit/frontend_message_test.rb +5 -5
  54. data/test/unit/quoting_test.rb +16 -5
  55. data/test/unit/result_test.rb +61 -0
  56. data/test/unit/row_description_test.rb +56 -0
  57. data/test/unit/row_test.rb +31 -0
  58. data/vertica.gemspec +1 -0
  59. metadata +67 -45
  60. data/lib/vertica/messages/frontend_messages/password.rb +0 -34
  61. data/lib/vertica/messages/message.rb +0 -79
  62. data/test/functional/connection_test.rb +0 -128
  63. data/test/functional/value_conversion_test.rb +0 -88
@@ -1,88 +0,0 @@
1
- # encoding : UTF-8
2
- require 'test_helper'
3
-
4
- class ValueConversionTest < Minitest::Test
5
-
6
- def setup
7
- @connection = Vertica::Connection.new(TEST_CONNECTION_HASH.merge(:row_style => :array))
8
-
9
- @connection.query <<-SQL
10
- CREATE TABLE IF NOT EXISTS conversions_table (
11
- "int_field" int,
12
- "string_field" varchar(100),
13
- "date_field" date,
14
- "timestamp_field" timestamp,
15
- "time_field" time,
16
- "interval_field" interval,
17
- "boolean_field" boolean,
18
- "float_field" float,
19
- "float_zero" float,
20
- "binary_field" varbinary,
21
- "long_varchar_field" long varchar
22
- )
23
- SQL
24
- end
25
-
26
-
27
- def teardown
28
- @connection.query("DROP TABLE IF EXISTS conversions_table CASCADE;")
29
- @connection.close
30
- end
31
-
32
- def test_value_conversions
33
- @connection.query <<-SQL
34
- INSERT INTO conversions_table VALUES (
35
- 123,
36
- 'hello world',
37
- '2010-01-01',
38
- '2010-01-01 12:00:00',
39
- '12:00:00',
40
- INTERVAL '1 DAY',
41
- TRUE,
42
- 1.0,
43
- 0.0,
44
- HEX_TO_BINARY('d09fd180d0b8d0b2d0b5d1822c2068656c6c6f21'),
45
- 'hello world'
46
- )
47
- SQL
48
-
49
- result = @connection.query <<-SQL
50
- SELECT *,
51
- float_field / float_zero as infinity,
52
- float_field / float_zero - float_field / float_zero as nan
53
- FROM conversions_table LIMIT 1
54
- SQL
55
-
56
- assert_equal result.rows.length, 1
57
- assert_equal [
58
- 123,
59
- 'hello world',
60
- Date.parse('2010-01-01'),
61
- DateTime.parse('2010-01-01 12:00:00'),
62
- "12:00:00",
63
- "1",
64
- true,
65
- 1.0,
66
- 0.0,
67
- ['d09fd180d0b8d0b2d0b5d1822c2068656c6c6f21'].pack('H*'),
68
- 'hello world',
69
- Float::INFINITY,
70
- Float::NAN], result.rows.first
71
- end
72
-
73
- def test_nil_conversions
74
- @connection.query "INSERT INTO conversions_table VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
75
- result = @connection.query "SELECT * FROM conversions_table LIMIT 1"
76
- assert_equal result.rows.length, 1
77
- assert_equal [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], result.rows.first
78
- end
79
-
80
- def test_string_encoding
81
- assert_equal 'åßç∂ë', @connection.query("SELECT 'åßç∂ë'").the_value
82
- end
83
-
84
- def test_binary_encoding
85
- assert_equal ['d09fd180d0b8d0b2d0b5d1822c2068656c6c6f21'].pack('H*'), @connection.query("SELECT HEX_TO_BINARY('d09fd180d0b8d0b2d0b5d1822c2068656c6c6f21')").the_value
86
- assert_equal Encoding::BINARY, @connection.query("SELECT HEX_TO_BINARY('d09fd180d0b8d0b2d0b5d1822c2068656c6c6f21')").the_value.encoding
87
- end
88
- end