Class: String

Inherits:
Object show all
Defined in:
lib/mylibs.rb

Direct Known Subclasses

DetailWin::HtmlStr

Instance Method Summary collapse

Instance Method Details

#_chomp_nullObject



522
523
524
# File 'lib/mylibs.rb', line 522

def _chomp_null
    gsub(/\0.*/, '')
end

#double_quoteObject Also known as: dquote



512
513
514
# File 'lib/mylibs.rb', line 512

def double_quote
    '"' + self + '"'
end

#single_quoteObject Also known as: squote



517
518
519
# File 'lib/mylibs.rb', line 517

def single_quote
    "'" + self + "'"
end

#sql_escapeObject



532
533
534
535
# File 'lib/mylibs.rb', line 532

def sql_escape
    str = _chomp_null
    str.gsub(/\\/, '\&\&').gsub(/'/, "''")    #'
end

#sql_quoteObject



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