Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
a564fecb
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a564fecb
编写于
3月 30, 2016
作者:
S
Sean Griffin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #24368 from kamipo/make_to_private_the_visibility
Make to private the visibility of `_quote` and `_type_cast`
上级
e3056bc9
c5131b62
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
32 deletion
+54
-32
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
...tive_record/connection_adapters/abstract_mysql_adapter.rb
+2
-8
activerecord/lib/active_record/connection_adapters/mysql/quoting.rb
...rd/lib/active_record/connection_adapters/mysql/quoting.rb
+17
-0
activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb
.../lib/active_record/connection_adapters/sqlite3/quoting.rb
+32
-0
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
.../lib/active_record/connection_adapters/sqlite3_adapter.rb
+3
-24
未找到文件。
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
浏览文件 @
a564fecb
require
'active_record/connection_adapters/abstract_adapter'
require
'active_record/connection_adapters/mysql/column'
require
'active_record/connection_adapters/mysql/explain_pretty_printer'
require
'active_record/connection_adapters/mysql/quoting'
require
'active_record/connection_adapters/mysql/schema_creation'
require
'active_record/connection_adapters/mysql/schema_definitions'
require
'active_record/connection_adapters/mysql/schema_dumper'
...
...
@@ -11,6 +12,7 @@
module
ActiveRecord
module
ConnectionAdapters
class
AbstractMysqlAdapter
<
AbstractAdapter
include
MySQL
::
Quoting
include
MySQL
::
ColumnDumper
include
Savepoints
...
...
@@ -165,14 +167,6 @@ def error_number(exception) # :nodoc:
# QUOTING ==================================================
def
_quote
(
value
)
# :nodoc:
if
value
.
is_a?
(
Type
::
Binary
::
Data
)
"x'
#{
value
.
hex
}
'"
else
super
end
end
def
quote_column_name
(
name
)
#:nodoc:
@quoted_column_names
[
name
]
||=
"`
#{
name
.
to_s
.
gsub
(
'`'
,
'``'
)
}
`"
end
...
...
activerecord/lib/active_record/connection_adapters/mysql/quoting.rb
0 → 100644
浏览文件 @
a564fecb
module
ActiveRecord
module
ConnectionAdapters
module
MySQL
module
Quoting
# :nodoc:
private
def
_quote
(
value
)
if
value
.
is_a?
(
Type
::
Binary
::
Data
)
"x'
#{
value
.
hex
}
'"
else
super
end
end
end
end
end
end
activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb
0 → 100644
浏览文件 @
a564fecb
module
ActiveRecord
module
ConnectionAdapters
module
SQLite3
module
Quoting
# :nodoc:
private
def
_quote
(
value
)
if
value
.
is_a?
(
Type
::
Binary
::
Data
)
"x'
#{
value
.
hex
}
'"
else
super
end
end
def
_type_cast
(
value
)
case
value
when
BigDecimal
value
.
to_f
when
String
if
value
.
encoding
==
Encoding
::
ASCII_8BIT
super
(
value
.
encode
(
Encoding
::
UTF_8
))
else
super
end
else
super
end
end
end
end
end
end
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
浏览文件 @
a564fecb
require
'active_record/connection_adapters/abstract_adapter'
require
'active_record/connection_adapters/statement_pool'
require
'active_record/connection_adapters/sqlite3/explain_pretty_printer'
require
'active_record/connection_adapters/sqlite3/quoting'
require
'active_record/connection_adapters/sqlite3/schema_creation'
gem
'sqlite3'
,
'~> 1.3.6'
...
...
@@ -49,6 +50,8 @@ module ConnectionAdapters #:nodoc:
# * <tt>:database</tt> - Path to the database file.
class
SQLite3Adapter
<
AbstractAdapter
ADAPTER_NAME
=
'SQLite'
.
freeze
include
SQLite3
::
Quoting
include
Savepoints
NATIVE_DATABASE_TYPES
=
{
...
...
@@ -176,30 +179,6 @@ def supports_explain?
# QUOTING ==================================================
def
_quote
(
value
)
# :nodoc:
case
value
when
Type
::
Binary
::
Data
"x'
#{
value
.
hex
}
'"
else
super
end
end
def
_type_cast
(
value
)
# :nodoc:
case
value
when
BigDecimal
value
.
to_f
when
String
if
value
.
encoding
==
Encoding
::
ASCII_8BIT
super
(
value
.
encode
(
Encoding
::
UTF_8
))
else
super
end
else
super
end
end
def
quote_string
(
s
)
#:nodoc:
@connection
.
class
.
quote
(
s
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录