ruby-mysql 2.9.14 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # coding: ascii-8bit
2
- # Copyright (C) 2003-2008 TOMITA Masahiro
2
+ # Copyright (C) 2003 TOMITA Masahiro
3
3
  # mailto:tommy@tmtm.org
4
4
 
5
5
  class Mysql
@@ -36,6 +36,7 @@ class Mysql
36
36
  COM_DAEMON = 29
37
37
  COM_BINLOG_DUMP_GTID = 30
38
38
  COM_RESET_CONNECTION = 31
39
+ COM_CLONE = 32
39
40
 
40
41
  # Client flag
41
42
  CLIENT_LONG_PASSWORD = 1 # new more secure passwords
@@ -63,32 +64,64 @@ class Mysql
63
64
  CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS = 1 << 22 # Don't close the connection for a connection with expired password.
64
65
  CLIENT_SESSION_TRACK = 1 << 23 # Capable of handling server state change information. Its a hint to the server to include the state change information in Ok packet.
65
66
  CLIENT_DEPRECATE_EOF = 1 << 24 # Client no longer needs EOF packet
66
- CLIENT_SSL_VERIFY_SERVER_CERT = 1 << 30
67
- CLIENT_REMEMBER_OPTIONS = 1 << 31
67
+ CLIENT_OPTIONAL_RESULTSET_METADATA = 1 << 25 # The client can handle optional metadata information in the resultset.
68
+ CLIENT_ZSTD_COMPRESSION_ALGORITHM = 1 << 26 # Compression protocol extended to support zstd compression method
69
+ CLIENT_CAPABILITY_EXTENSION = 1 << 29 # This flag will be reserved to extend the 32bit capabilities structure to 64bits.
70
+ CLIENT_SSL_VERIFY_SERVER_CERT = 1 << 30 # Verify server certificate.
71
+ CLIENT_REMEMBER_OPTIONS = 1 << 31 # Don't reset the options after an unsuccessful connect
68
72
 
69
73
  # Connection Option
70
- OPT_CONNECT_TIMEOUT = 0
71
- OPT_COMPRESS = 1
72
- OPT_NAMED_PIPE = 2
73
- INIT_COMMAND = 3
74
- READ_DEFAULT_FILE = 4
75
- READ_DEFAULT_GROUP = 5
76
- SET_CHARSET_DIR = 6
77
- SET_CHARSET_NAME = 7
78
- OPT_LOCAL_INFILE = 8
79
- OPT_PROTOCOL = 9
80
- SHARED_MEMORY_BASE_NAME = 10
81
- OPT_READ_TIMEOUT = 11
82
- OPT_WRITE_TIMEOUT = 12
83
- OPT_USE_RESULT = 13
84
- OPT_USE_REMOTE_CONNECTION = 14
85
- OPT_USE_EMBEDDED_CONNECTION = 15
86
- OPT_GUESS_CONNECTION = 16
87
- SET_CLIENT_IP = 17
88
- SECURE_AUTH = 18
89
- REPORT_DATA_TRUNCATION = 19
90
- OPT_RECONNECT = 20
91
- OPT_SSL_VERIFY_SERVER_CERT = 21
74
+ OPT_CONNECT_TIMEOUT = 0
75
+ OPT_COMPRESS = 1
76
+ OPT_NAMED_PIPE = 2
77
+ INIT_COMMAND = 3
78
+ READ_DEFAULT_FILE = 4
79
+ READ_DEFAULT_GROUP = 5
80
+ SET_CHARSET_DIR = 6
81
+ SET_CHARSET_NAME = 7
82
+ OPT_LOCAL_INFILE = 8
83
+ OPT_PROTOCOL = 9
84
+ SHARED_MEMORY_BASE_NAME = 10
85
+ OPT_READ_TIMEOUT = 11
86
+ OPT_WRITE_TIMEOUT = 12
87
+ OPT_USE_RESULT = 13
88
+ REPORT_DATA_TRUNCATION = 14
89
+ OPT_RECONNECT = 15
90
+ PLUGIN_DIR = 16
91
+ DEFAULT_AUTH = 17
92
+ OPT_BIND = 18
93
+ OPT_SSL_KEY = 19
94
+ OPT_SSL_CERT = 20
95
+ OPT_SSL_CA = 21
96
+ OPT_SSL_CAPATH = 22
97
+ OPT_SSL_CIPHER = 23
98
+ OPT_SSL_CRL = 24
99
+ OPT_SSL_CRLPATH = 25
100
+ OPT_CONNECT_ATTR_RESET = 26
101
+ OPT_CONNECT_ATTR_ADD = 27
102
+ OPT_CONNECT_ATTR_DELETE = 28
103
+ SERVER_PUBLIC_KEY = 29
104
+ ENABLE_CLEARTEXT_PLUGIN = 30
105
+ OPT_CAN_HANDLE_EXPIRED_PASSWORDS = 31
106
+ OPT_MAX_ALLOWED_PACKET = 32
107
+ OPT_NET_BUFFER_LENGTH = 33
108
+ OPT_TLS_VERSION = 34
109
+ OPT_SSL_MODE = 35
110
+ OPT_GET_SERVER_PUBLIC_KEY = 36
111
+ OPT_RETRY_COUNT = 37
112
+ OPT_OPTIONAL_RESULTSET_METADATA = 38
113
+ OPT_SSL_FIPS_MODE = 39
114
+ OPT_TLS_CIPHERSUITES = 40
115
+ OPT_COMPRESSION_ALGORITHMS = 41
116
+ OPT_ZSTD_COMPRESSION_LEVEL = 42
117
+ OPT_LOAD_DATA_LOCAL_DIR = 43
118
+
119
+ # SSL Mode
120
+ SSL_MODE_DISABLED = 1
121
+ SSL_MODE_PREFERRED = 2
122
+ SSL_MODE_REQUIRED = 3
123
+ SSL_MODE_VERIFY_CA = 4
124
+ SSL_MODE_VERIFY_IDENTITY = 5
92
125
 
93
126
  # Server Option
94
127
  OPTION_MULTI_STATEMENTS_ON = 0
@@ -133,6 +166,7 @@ class Mysql
133
166
  REFRESH_USER_RESOURCES = 1 << 19
134
167
  REFRESH_FOR_EXPORT = 1 << 20
135
168
  REFRESH_OPTIMIZER_COSTS = 1 << 21
169
+ REFRESH_PERSIST = 1 << 22
136
170
 
137
171
  class Field
138
172
  # Field type
@@ -156,6 +190,9 @@ class Mysql
156
190
  TYPE_TIMESTAMP2 = 17
157
191
  TYPE_DATETIME2 = 18
158
192
  TYPE_TIME2 = 19
193
+ TYPE_TYPED_ARRAY = 20
194
+ TYPE_INVALID = 243
195
+ TYPE_BOOL = 244
159
196
  TYPE_JSON = 245
160
197
  TYPE_NEWDECIMAL = 246
161
198
  TYPE_ENUM = 247
@@ -171,25 +208,35 @@ class Mysql
171
208
  TYPE_INTERVAL = TYPE_ENUM
172
209
 
173
210
  # Flag
174
- NOT_NULL_FLAG = 1
175
- PRI_KEY_FLAG = 2
176
- UNIQUE_KEY_FLAG = 4
177
- MULTIPLE_KEY_FLAG = 8
178
- BLOB_FLAG = 16
179
- UNSIGNED_FLAG = 32
180
- ZEROFILL_FLAG = 64
181
- BINARY_FLAG = 128
182
- ENUM_FLAG = 256
183
- AUTO_INCREMENT_FLAG = 512
184
- TIMESTAMP_FLAG = 1024
185
- SET_FLAG = 2048
186
- NO_DEFAULT_VALUE_FLAG = 4096
187
- ON_UPDATE_NOW_FLAG = 8192
188
- NUM_FLAG = 32768
189
- PART_KEY_FLAG = 16384
190
- GROUP_FLAG = 32768
191
- UNIQUE_FLAG = 65536
192
- BINCMP_FLAG = 131072
211
+ NOT_NULL_FLAG = 1
212
+ PRI_KEY_FLAG = 2
213
+ UNIQUE_KEY_FLAG = 4
214
+ MULTIPLE_KEY_FLAG = 8
215
+ BLOB_FLAG = 16
216
+ UNSIGNED_FLAG = 32
217
+ ZEROFILL_FLAG = 64
218
+ BINARY_FLAG = 128
219
+ ENUM_FLAG = 256
220
+ AUTO_INCREMENT_FLAG = 512
221
+ TIMESTAMP_FLAG = 1024
222
+ SET_FLAG = 2048
223
+ NO_DEFAULT_VALUE_FLAG = 4096
224
+ ON_UPDATE_NOW_FLAG = 8192
225
+ NUM_FLAG = 32768
226
+ PART_KEY_FLAG = 16384
227
+ GROUP_FLAG = 32768
228
+ UNIQUE_FLAG = 65536
229
+ BINCMP_FLAG = 131072
230
+ GET_FIXED_FIELDS_FLAG = 1 << 18
231
+ FIELD_IN_PART_FUNC_FLAG = 1 << 19
232
+ FIELD_IN_ADD_INDEX = 1 << 20
233
+ FIELD_IS_RENAMED = 1 << 21
234
+ FIELD_FLAGS_STORAGE_MEDIA_MASK = 3 << 22
235
+ FIELD_FLAGS_COLUMN_FORMAT_MASK = 3 << 24
236
+ FIELD_IS_DROPPED = 1 << 26
237
+ EXPLICIT_NULL_FLAG = 1 << 27
238
+ FIELD_IS_MARKED = 1 << 28
239
+ NOT_SECONDARY_FLAG = 1 << 29
193
240
  end
194
241
 
195
242
  class Stmt
data/lib/mysql/error.rb CHANGED
@@ -20,17 +20,14 @@ class Mysql
20
20
  end
21
21
  end
22
22
 
23
- attr_reader :sqlstate, :error
23
+ attr_reader :sqlstate, :error, :errno
24
24
 
25
- def initialize(message, sqlstate='HY000')
25
+ def initialize(message, sqlstate='HY000', errno=nil)
26
26
  @sqlstate = sqlstate
27
27
  @error = message
28
+ @errno = errno || self.class::ERRNO
28
29
  super message
29
30
  end
30
-
31
- def errno
32
- self.class::ERRNO
33
- end
34
31
  end
35
32
 
36
33
  # server side error
@@ -977,7 +974,16 @@ class Mysql
977
974
  CR_AUTH_PLUGIN_CANNOT_LOAD = 2059
978
975
  CR_DUPLICATE_CONNECTION_ATTR = 2060
979
976
  CR_AUTH_PLUGIN_ERR = 2061
980
- CR_ERROR_LAST = 2061
977
+ CR_INSECURE_API_ERR = 2062
978
+ CR_FILE_NAME_TOO_LONG = 2063
979
+ CR_SSL_FIPS_MODE_ERR = 2064
980
+ CR_DEPRECATED_COMPRESSION_NOT_SUPPORTED = 2065
981
+ CR_COMPRESSION_WRONGLY_CONFIGURED = 2066
982
+ CR_KERBEROS_USER_NOT_FOUND = 2067
983
+ CR_LOAD_DATA_LOCAL_INFILE_REJECTED = 2068
984
+ CR_LOAD_DATA_LOCAL_INFILE_REALPATH_FAIL = 2069
985
+ CR_DNS_SRV_LOOKUP_FAILED = 2070
986
+ CR_ERROR_LAST = 2070
981
987
  end
982
988
 
983
989
  ClientError.define_error_class(/\ACR_/)