This file is indexed.

/usr/share/perl5/DBIx/DBSchema/DBD.pm is in libdbix-dbschema-perl 0.44-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
package DBIx::DBSchema::DBD;

use strict;

our $VERSION = '0.08';

=head1 NAME

DBIx::DBSchema::DBD - DBIx::DBSchema Driver Writer's Guide and Base Class

=head1 SYNOPSIS

  perldoc DBIx::DBSchema::DBD

  package DBIx::DBSchema::DBD::FooBase
  use DBIx::DBSchema::DBD;
  @ISA = qw(DBIx::DBSchema::DBD);

=head1 DESCRIPTION

Drivers should be named DBIx::DBSchema::DBD::DatabaseName, where DatabaseName
is the same as the DBD:: driver for this database.  Drivers should implement the
following class methods:

=over 4

=item columns CLASS DBI_DBH TABLE

Given an active DBI database handle, return a listref of listrefs (see
L<perllol>), each containing six elements: column name, column type,
nullability, column length, column default, and a field reserved for
driver-specific use.

=item column CLASS DBI_DBH TABLE COLUMN

Same as B<columns> above, except return the listref for a single column.  You
can inherit from DBIx::DBSchema::DBD to provide this function.

=cut

sub column {
  my($proto, $dbh, $table, $column) = @_;
  #@a = grep { $_->[0] eq $column } @{ $proto->columns( $dbh, $table ) };
  #$a[0];
  @{ [
    grep { $_->[0] eq $column } @{ $proto->columns( $dbh, $table ) }
  ] }[0]; #force list context on grep, return scalar of first element
}

=item primary_key CLASS DBI_DBH TABLE

Given an active DBI database handle, return the primary key for the specified
table.

=item unique CLASS DBI_DBH TABLE

Deprecated method - see the B<indices> method for new drivers.

Given an active DBI database handle, return a hashref of unique indices.  The
keys of the hashref are index names, and the values are arrayrefs which point
a list of column names for each.  See L<perldsc/"HASHES OF LISTS"> and
L<DBIx::DBSchema::Index>.

=item index CLASS DBI_DBH TABLE

Deprecated method - see the B<indices> method for new drivers.

Given an active DBI database handle, return a hashref of (non-unique) indices.
The keys of the hashref are index names, and the values are arrayrefs which
point a list of column names for each.  See L<perldsc/"HASHES OF LISTS"> and
L<DBIx::DBSchema::Index>.

=item indices CLASS DBI_DBH TABLE

Given an active DBI database handle, return a hashref of all indices, both
unique and non-unique.  The keys of the hashref are index names, and the values
are again hashrefs with the following keys:

=over 8

=item name - Index name (redundant)

=item using - Optional index method

=item unique - Boolean indicating whether or not this is a unique index

=item columns - List reference of column names (or expressions)

=back

(See L<FS::DBIx::DBSchema::Index>)

New drivers are advised to implement this method, and existing drivers are
advised to (eventually) provide this method instead of B<index> and B<unique>.

For backwards-compatibility with current drivers, the base DBIx::DBSchema::DBD
class provides an B<indices> method which uses the old B<index> and B<unique>
methods to provide this data.

=cut

sub indices {
  #my($proto, $dbh, $table) = @_;
  my($proto, @param) = @_;

  my $unique_hr = $proto->unique( @param );
  my $index_hr  = $proto->index(  @param );

  scalar(
    {
  
      (
        map {
              $_ => { 'name'    => $_,
                      'unique'  => 1,
                      'columns' => $unique_hr->{$_},
                    },
            }
            keys %$unique_hr
      ),
  
      (
        map {
              $_ => { 'name'    => $_,
                      'unique'  => 0,
                      'columns' => $index_hr->{$_},
                    },
            }
            keys %$index_hr
      ),
  
    }
  );
}

=item default_db_catalog

Returns the default database catalog for the DBI table_info command.
Inheriting from DBIx::DBSchema::DBD will provide the default empty string.

=cut

sub default_db_catalog { ''; }

=item default_db_schema

Returns the default database schema for the DBI table_info command.
Inheriting from DBIx::DBSchema::DBD will provide the default empty string.

=cut

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.

Should return a hash reference, empty for no action, or with one or more of
the following keys defined:

effective_type - Optional type override used during column creation.

explicit_null - Set true to have the column definition declare NULL columns explicitly

effective_default - Optional default override used during column creation.

effective_local - Optional local override used during column creation.


=cut

sub column_callback { {}; }

=item add_column_callback DBH TABLE_NAME COLUMN_OBJ

Optional callback for additional SQL statments to be called when adding columns
to an existing table.

Should return a hash reference, empty for no action, or with one or more of
the following keys defined:

effective_type - Optional type override used during column creation.

effective_null - Optional nullability override used during column creation.

sql_after - Array reference of SQL statements to be executed after the column is added.

=cut

sub add_column_callback { {}; }

=item alter_column_callback DBH TABLE_NAME OLD_COLUMN_OBJ NEW_COLUMN_OBJ

Optional callback for overriding the SQL statments to be called when altering
columns to an existing table.

Should return a hash reference, empty for no action, or with one or more of
the following keys defined:

sql_alter - Alter SQL statement(s) for changing everything about a column.  Specifying this overrides processing of individual changes (type, nullability, default, etc.).

sql_alter_type - Alter SQL statement(s) for changing type and length (there is no default).

sql_alter_null - Alter SQL statement(s) for changing nullability to be used instead of the default.

=cut

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

You can define a %typemap array for your driver to map "standard" data    
types to database-specific types.  For example, the MySQL TIMESTAMP field
has non-standard auto-updating semantics; the MySQL DATETIME type is 
what other databases and the ODBC standard call TIMESTAMP, so one of the   
entries in the MySQL %typemap is:

  'TIMESTAMP' => 'DATETIME',

Another example is the Pg %typemap which maps the standard types BLOB and
LONG VARBINARY to the Pg-specific BYTEA:

  'BLOB' => 'BYTEA',
  'LONG VARBINARY' => 'BYTEA',

Make sure you use all uppercase-keys.

=head1 AUTHOR

Ivan Kohler <ivan-dbix-dbschema@420.am>

=head1 COPYRIGHT

Copyright (c) 2000-2005 Ivan Kohler
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.

=head1 BUGS

=head1 SEE ALSO

L<DBIx::DBSchema>, L<DBIx::DBSchema::DBD::mysql>, L<DBIx::DBSchema::DBD::Pg>,
L<DBIx::DBSchema::Index>, L<DBI>, L<DBI::DBD>, L<perllol>,
L<perldsc/"HASHES OF LISTS">

=cut 

1;