summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5dc9cfa)
raw | patch | inline | side by side (parent: 5dc9cfa)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Feb 2008 08:50:45 +0000 (08:50 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Feb 2008 08:50:45 +0000 (08:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8947 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/DBsqlite.pm | patch | blob | history |
index 95ac1b68bc04fa5251ae5808bfe52101eaf2a801..bce1e620cebb432b6325b374cf7dd7c6461d2415 100644 (file)
my $self = shift;
my $table_name = shift;
my $col_names_ref = shift;
+ my @col_names;
+ foreach my $col_name (@$col_names_ref) {
+ my @t = split(" ", $col_name);
+ $col_name = $t[0];
+ push(@col_names, $col_name);
+ }
+
$col_names->{ $table_name } = $col_names_ref;
- my $col_names_string = join(', ', @{$col_names_ref});
+ my $col_names_string = join(', ', @col_names);
my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( $col_names_string )";
&create_lock($self,'create_table');
$self->{dbh}->do($sql_statement);
# primekey is unique
# fetch column names of table
- my $col_names = &get_table_columns("",$table);
+ my $col_names = &get_table_columns($self, $table);
# assign values to column name variables
my @add_list;
foreach my $col_name (@{$col_names}) {
- # use function parameter for column values
+ # use function parameter for column values
+
if (exists $arg->{$col_name}) {
push(@add_list, $arg->{$col_name});
}
}
my $sql_statement = "INSERT INTO $table VALUES ('".join("', '", @add_list)."')";
-
&create_lock($self,'add_dbentry');
my $db_res = $self->{dbh}->do($sql_statement);
&remove_lock($self,'add_dbentry');
&create_lock($self,'get_table_columns');
my @res = @{$self->{dbh}->selectall_arrayref("pragma table_info('$table')")};
&remove_lock($self,'get_table_columns');
+
foreach my $column (@res) {
push(@column_names, @$column[1]);
}