class ActiveFacts::Generators::Traits::SQL::Oracle::OracleDataTypeContext

Public Instance Methods

boolean_expr(safe_column_name) click to toggle source

Ugly, but safe (Oracle's internal schema tables use 'Y' and 'N'):

# File lib/activefacts/generator/traits/sql/oracle.rb, line 240
def boolean_expr safe_column_name
  "(#{safe_column_name} = '1' OR #{safe_column_name} = 'Y')"
end
boolean_type() click to toggle source

PL/SQL has a BOOLEAN type, but Oracle databases do not, see docs.oracle.com/database/121/LNPLS/datatypes.htm#LNPLS348

# File lib/activefacts/generator/traits/sql/oracle.rb, line 235
def boolean_type
  'CHAR(1)'   # Probably should put a CHECK '0' or '1' here
end
date_time_type() click to toggle source
# File lib/activefacts/generator/traits/sql/oracle.rb, line 256
def date_time_type
  'TIMESTAMP'
end
default_char_type() click to toggle source

There is no performance benefit in using fixed-length CHAR fields, and an added burden of trimming the implicitly added white-space

# File lib/activefacts/generator/traits/sql/oracle.rb, line 246
def default_char_type
  (@unicode ? 'N' : '') +
  'VARCHAR'
end
default_varchar_type() click to toggle source
# File lib/activefacts/generator/traits/sql/oracle.rb, line 251
def default_varchar_type
  (@unicode ? 'N' : '') +
  'VARCHAR'
end
integer_ranges() click to toggle source
# File lib/activefacts/generator/traits/sql/oracle.rb, line 225
def integer_ranges
  [
    ['SHORTINTEGER', -2**15, 2**15-1],  # The standard says -10^5..10^5 (less than 16 bits)
    ['INTEGER', -2**31, 2**31-1],   # The standard says -10^10..10^10 (more than 32 bits!)
    ['LONGINTEGER', -2**63, 2**63-1],    # The standard says -10^19..10^19 (less than 64 bits)
  ]
end