activerecord-mysql2-adapter 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -378,9 +378,13 @@ module ActiveRecord
|
|
378
378
|
show_variable 'collation_database'
|
379
379
|
end
|
380
380
|
|
381
|
-
def tables(name = nil)
|
381
|
+
def tables(name = nil, database = nil)
|
382
382
|
tables = []
|
383
|
-
|
383
|
+
|
384
|
+
sql = "SHOW TABLES "
|
385
|
+
sql << "IN #{quote_table_name(database)} " if database
|
386
|
+
|
387
|
+
execute(sql, 'SCHEMA').each do |field|
|
384
388
|
tables << field.first
|
385
389
|
end
|
386
390
|
tables
|
@@ -494,15 +498,26 @@ module ActiveRecord
|
|
494
498
|
|
495
499
|
# Maps logical Rails types to MySQL-specific data types.
|
496
500
|
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
501
|
+
case type.to_s
|
502
|
+
when 'integer'
|
503
|
+
case limit
|
504
|
+
when 1; 'tinyint'
|
505
|
+
when 2; 'smallint'
|
506
|
+
when 3; 'mediumint'
|
507
|
+
when nil, 4, 11; 'int(11)' # compatibility with MySQL default
|
508
|
+
when 5..8; 'bigint'
|
509
|
+
else raise(ActiveRecordError, "No integer type has byte size #{limit}")
|
510
|
+
end
|
511
|
+
when 'text'
|
512
|
+
case limit
|
513
|
+
when 0..0xff; 'tinytext'
|
514
|
+
when nil, 0x100..0xffff; 'text'
|
515
|
+
when 0x10000..0xffffff; 'mediumtext'
|
516
|
+
when 0x1000000..0xffffffff; 'longtext'
|
517
|
+
else raise(ActiveRecordError, "No text type has character length #{limit}")
|
518
|
+
end
|
519
|
+
else
|
520
|
+
super
|
506
521
|
end
|
507
522
|
end
|
508
523
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-mysql2-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mysql2
|