1 package DBIx::DBSchema::DBD::Sybase;
4 use vars qw($VERSION @ISA %typemap);
5 use DBIx::DBSchema::DBD;
8 @ISA = qw(DBIx::DBSchema::DBD);
16 DBIx::DBSchema::DBD::Sybase - Sybase database driver for DBIx::DBSchema
23 $dbh = DBI->connect('dbi:Sybase:dbname=database', 'user', 'pass');
24 $schema = new_native DBIx::DBSchema $dbh;
28 This module implements a Sybase driver for DBIx::DBSchema.
33 my($proto, $dbh, $table) = @_;
35 my $sth = $dbh->prepare("sp_columns \@table_name=$table")
38 $sth->execute or die $sth->errstr;
43 ($_->{'nullable'} ? 1 : ''),
48 } @{ $sth->fetchall_arrayref({}) };
55 return("StubbedPrimaryKey");
60 my($proto, $dbh, $table) = @_;
61 my $gratuitous = { map { $_ => [ $proto->_index_fields($dbh, $table, $_ ) ] }
62 grep { $proto->_is_unique($dbh, $_ ) }
63 $proto->_all_indices($dbh, $table)
68 my($proto, $dbh, $table) = @_;
69 my $gratuitous = { map { $_ => [ $proto->_index_fields($dbh, $table, $_ ) ] }
70 grep { ! $proto->_is_unique($dbh, $_ ) }
71 $proto->_all_indices($dbh, $table)
76 my($proto, $dbh, $table) = @_;
78 my $sth = $dbh->prepare_cached(<<END) or die $dbh->errstr;
81 WHERE id = object_id('$table') and indid between 1 and 254
83 $sth->execute or die $sth->errstr;
84 my @indices = map { $_->[0] } @{ $sth->fetchall_arrayref() };
91 my($proto, $dbh, $table, $index) = @_;
95 my ($indid) = $dbh->selectrow_array("select indid from sysindexes where id = object_id('$table') and name = '$index'");
97 push @keys, $dbh->selectrow_array("select index_col('$table', $indid, $_)") || ();
104 my($proto, $dbh, $table, $index) = @_;
106 my ($isunique) = $dbh->selectrow_array("select status & 2 from sysindexes where id = object_id('$table') and name = '$index'");
113 Charles Shapiro <charles.shapiro@numethods.com>
114 (courtesy of Ivan Kohler <ivan-dbix-dbschema@420.am>)
116 Mitchell Friedman <mitchell.friedman@numethods.com>
118 Bernd Dulfer <bernd@widd.de>
122 Copyright (c) 2001 Charles Shapiro, Mitchell J. Friedman
123 Copyright (c) 2001 nuMethods LLC.
125 This program is free software; you can redistribute it and/or modify it under
126 the same terms as Perl itself.
132 The B<primary_key> method does not yet work.
136 L<DBIx::DBSchema>, L<DBIx::DBSchema::DBD>, L<DBI>, L<DBI::DBD>