summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3a4f031)
raw | patch | inline | side by side (parent: 3a4f031)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Mar 2009 10:44:09 +0000 (10:44 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Mar 2009 10:44:09 +0000 (10:44 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13535 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-si/modules/DBsqlite.pm | patch | blob | history |
index 60f864a713430e989412fe26a849d4a0b806031c..d88f0e547ab7b027c60c90f77fc6d4c3ba48ffdf 100644 (file)
}
my $table_name = shift;
my $col_names_ref = shift;
+ my $index_names_ref = shift || undef;
my @col_names;
my @col_names_creation;
foreach my $col_name (@$col_names_ref) {
my $col_names_string = join(", ", @col_names_creation);
my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( $col_names_string )";
my $res = $self->exec_statement($sql_statement);
+
+ # Add indices
+ if(defined($index_names_ref) and ref($index_names_ref) eq 'ARRAY') {
+ foreach my $index_name (@$index_names_ref) {
+ $self->exec_statement("CREATE ".(($index_name eq 'id')?'UNIQUE':'')." INDEX IF NOT EXISTS $index_name on $table_name ($index_name);");
+ }
+ }
+
return 0;
}