| 1293 |
dpurdie |
1 |
###############################################################################
|
|
|
2 |
# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
|
|
|
3 |
# sits@users.sourceforge.net
|
|
|
4 |
#
|
|
|
5 |
# This program is free software; you can redistribute it and modify it under
|
|
|
6 |
# the terms of the GPL.
|
|
|
7 |
|
|
|
8 |
# Object which represents an index for a database table.
|
|
|
9 |
|
|
|
10 |
package Codestriker::DB::Index;
|
|
|
11 |
|
|
|
12 |
use strict;
|
|
|
13 |
|
|
|
14 |
# Create a new Index object.
|
|
|
15 |
# usage: Index->new({name=>"table_index1", column_names=>["col1", "col2"]});
|
|
|
16 |
sub new {
|
|
|
17 |
my $type = shift;
|
|
|
18 |
my %params = @_;
|
|
|
19 |
|
|
|
20 |
my $self = {};
|
|
|
21 |
$self->{name} = $params{name};
|
|
|
22 |
$self->{column_names} = $params{column_names};
|
|
|
23 |
|
|
|
24 |
return bless $self, $type;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
# Return the name of the index.
|
|
|
28 |
sub get_name {
|
|
|
29 |
my $self = shift;
|
|
|
30 |
return $self->{name};
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
# Return the column names used in the index as a string array.
|
|
|
34 |
sub get_column_names {
|
|
|
35 |
my $self = shift;
|
|
|
36 |
return $self->{column_names};
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
1;
|