package DBIx::DBSchema::DBD;
use strict;
-use vars qw($VERSION);
-$VERSION = '0.06';
+our $VERSION = '0.08';
=head1 NAME
sub default_db_schema { ''; }
+=item constraints CLASS DBI_DBH TABLE
+
+Given an active DBI database handle, return the constraints (currently, foreign
+keys) for the specified table, as a list of hash references.
+
+Each hash reference has the following keys:
+
+=over 8
+
+=item constraint - contraint name
+
+=item columns - List refrence of column names
+
+=item table - Foreign taable name
+
+=item references - List reference of column names in foreign table
+
+=item match -
+
+=item on_delete -
+
+=item on_update -
+
+=back
+
+=cut
+
+sub constraints { (); }
+
=item column_callback DBH TABLE_NAME COLUMN_OBJ
Optional callback for driver-specific overrides to SQL column definitions.
sub alter_column_callback { {}; }
+=item column_value_needs_quoting COLUMN_OBJ
+
+Optional callback for determining if a column's default value require quoting.
+Returns true if it does, false otherwise.
+
=cut
+sub column_value_needs_quoting {
+ my($proto, $col) = @_;
+ my $class = ref($proto) || $proto;
+
+ # type mapping
+ my %typemap = eval "\%${class}::typemap";
+ my $type = defined( $typemap{uc($col->type)} )
+ ? $typemap{uc($col->type)}
+ : $col->type;
+
+ # false laziness: nicked from FS::Record::_quote
+ $col->default !~ /^\-?\d+(\.\d+)?$/
+ || $type =~ /(char|binary|blob|text)$/i;
+
+}
+
=back
=head1 TYPE MAPPING
=head1 COPYRIGHT
Copyright (c) 2000-2005 Ivan Kohler
-Copyright (c) 2007 Freeside Internet Services, Inc.
+Copyright (c) 2007-2013 Freeside Internet Services, Inc.
All rights reserved.
This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.