« blib/lib/DB/Introspector/Base/ForeignKey.pm
↑ Summary
blib/lib/DB/Introspector/ForeignKeyPath.pm »
| 1 | package DB::Introspector::SQLGen::Oracle::TypeMapper; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use base qw( DB::Introspector::SQLGen::TypeMapper ); | ||
| 5 | |||
| 6 | |||
| 7 | sub stringify_integer { | ||
| 8 | my $self = shift; | ||
| 9 | my $column = shift; | ||
| 10 | |||
| 11 | |||
| 12 | # oracle integers can be limited by the number of characters in its decimal | ||
| 13 | # representation. | ||
| 14 | my $max_length = $column->max; | ||
| 15 | |||
| 16 | # TODO: add support for providing further limitations on the acceptable | ||
| 17 | # integers | ||
| 18 | |||
| 19 | return 'NUMBER'. (defined($max_length) ? '('.length($max_length).')' : ''); | ||
| 20 | } | ||
| 21 | |||
| 22 | sub stringify_string { | ||
| 23 | my $self = shift; | ||
| 24 | my $column = shift; | ||
| 25 | |||
| 26 | my $max_length = $column->max_length; | ||
| 27 | |||
| 28 | # TODO: add support for providing further limitations on the acceptable | ||
| 29 | # integers | ||
| 30 | |||
| 31 | return 'VARCHAR2'. (defined($max_length) ? "($max_length)" : ''); | ||
| 32 | } | ||
| 33 | |||
| 34 | sub stringify_date { | ||
| 35 | my $self = shift; | ||
| 36 | my $column = shift; | ||
| 37 | |||
| 38 | return 'DATE'; | ||
| 39 | } | ||
| 40 | |||
| 41 | sub stringify_clob { | ||
| 42 | my $self = shift; | ||
| 43 | my $column = shift; | ||
| 44 | |||
| 45 | return 'CLOB'; | ||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | sub stringify_char { | ||
| 50 | my $self = shift; | ||
| 51 | my $column = shift; | ||
| 52 | |||
| 53 | # TODO: add support for a specific set of characters | ||
| 54 | return 'CHAR'; | ||
| 55 | } | ||
| 56 | |||
| 57 | sub stringify_boolean { | ||
| 58 | my $self = shift; | ||
| 59 | my $column = shift; | ||
| 60 | |||
| 61 | # TODO: add support for better boolean simulation | ||
| 62 | return 'CHAR'; | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | 1; |