Class: String
Direct Known Subclasses
Instance Method Summary collapse
- #_chomp_null ⇒ Object
- #double_quote ⇒ Object (also: #dquote)
- #single_quote ⇒ Object (also: #squote)
- #sql_escape ⇒ Object
- #sql_quote ⇒ Object
Instance Method Details
#_chomp_null ⇒ Object
522 523 524 |
# File 'lib/mylibs.rb', line 522 def _chomp_null gsub(/\0.*/, '') end |
#double_quote ⇒ Object Also known as: dquote
512 513 514 |
# File 'lib/mylibs.rb', line 512 def double_quote '"' + self + '"' end |
#single_quote ⇒ Object Also known as: squote
517 518 519 |
# File 'lib/mylibs.rb', line 517 def single_quote "'" + self + "'" end |
#sql_escape ⇒ Object
532 533 534 535 |
# File 'lib/mylibs.rb', line 532 def sql_escape str = _chomp_null str.gsub(/\\/, '\&\&').gsub(/'/, "''") #' end |
#sql_quote ⇒ Object
526 527 528 529 530 |
# File 'lib/mylibs.rb', line 526 def sql_quote str = _chomp_null return 'NULL' if str.empty? "'#{str.sql_escape}'" end |