documentation for %typemap, preliminary Sybase driver
[DBIx-DBSchema.git] / DBSchema / DBD / Sybase.pm
1 package DBIx::DBSchema::DBD::Sybase;
2
3 use strict;
4 use vars qw($VERSION @ISA %typemap);
5 use DBIx::DBSchema::DBD;
6
7 $VERSION = '0.02';
8 @ISA = qw(DBIx::DBSchema::DBD);
9
10 %typemap = (
11 #  'empty' => 'empty'
12 );
13
14 #
15 # Return this from uncompleted driver calls.
16 #
17
18 =head1 NAME
19
20 DBIx::DBSchema::DBD::Sybase - Sybase database driver for DBIx::DBSchema
21
22 =head1 SYNOPSIS
23
24 use DBI;
25 use DBIx::DBSchema;
26
27 $dbh = DBI->connect('dbi:Sybase:dbname=database', 'user', 'pass');
28 $schema = new_native DBIx::DBSchema $dbh;
29
30 =head1 DESCRIPTION
31
32 This module implements a Sybase driver for DBIx::DBSchema. 
33
34 =cut
35
36 sub columns {
37
38   my($proto, $dbh, $table) = @_;
39
40   my $sth = $dbh->prepare("sp_columns \@table_name=$table") 
41   or die $dbh->errstr;
42
43   $sth->execute or die $sth->errstr;
44   map {
45     [
46       $_->{'COLUMN_NAME'},
47       $_->{'TYPE_NAME'},
48       ($_->{'NULLABLE'} ? 1 : ''),
49       $_->{'LENGTH'},
50       '', #default
51       ''  #local
52     ]
53   } @{ $sth->fetchall_arrayref({}) };
54
55 }
56
57 sub primary_key {
58     return("StubbedPrimaryKey");
59 }
60
61
62 sub unique {
63
64     my %stubList = (
65           'stubfirstUniqueIndex' => ['stubfirstUniqueIndex'],
66           'stubtwostUniqueIndex' => ['stubtwostUniqueIndex']
67                         );
68
69    return ( { %stubList } );
70
71 }
72
73 sub index {
74
75     my %stubList = (
76           'stubfirstIndex' => ['stubfirstUniqueIndex'],
77           'stubtwostIndex' => ['stubtwostUniqueIndex']
78                         );
79
80     return ( { %stubList } );
81
82 }
83
84 =head1 AUTHOR
85
86 Charles Shapiro <charles.shapiro@numethods.com>
87 (courtesy of Ivan Kohler <ivan-dbix-dbschema@420.am>)
88
89 Mitchell Friedman <mitchell.friedman@numethods.com>
90
91 =head1 COPYRIGHT
92
93 Copyright (c) 2001 Charles Shapiro, Mitchell J. Friedman
94 Copyright (c) 2001 nuMethods LLC.
95 All rights reserved.
96 This program is free software; you can redistribute it and/or modify it under
97 the same terms as Perl itself.
98
99 =head1 BUGS
100
101 Yes.
102
103 Most of this is not implemented.
104
105 the "columns" method works; primary key, unique and index do not yet.  Please
106 send any patches to all three addresses listed above.
107
108 =head1 SEE ALSO
109
110 L<DBIx::DBSchema>, L<DBIx::DBSchema::DBD>, L<DBI>, L<DBI::DBD>
111
112 =cut 
113
114 1;
115