summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 09da8a9)
raw | patch | inline | side by side (parent: 09da8a9)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 09:47:45 +0000 (09:47 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 09:47:45 +0000 (09:47 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13490 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-si/gosa-si-server | patch | blob | history | |
trunk/gosa-si/modules/DBsqlite.pm | patch | blob | history |
index 514e8b1bde1f54442d4e053c6c7d3d9025959613..0b00e52bcbfedbf579ae4dbdc19c6da77edc9ed1 100755 (executable)
our $incoming_db;
our $incoming_tn = 'incoming';
my $incoming_file_name;
-my @incoming_col_names = ("id INTEGER PRIMARY KEY auto_increment",
+my @incoming_col_names = ("id INTEGER PRIMARY KEY",
"timestamp VARCHAR(14) DEFAULT 'none'",
"headertag VARCHAR(255) DEFAULT 'none'",
"targettag VARCHAR(255) DEFAULT 'none'",
our $job_db;
our $job_queue_tn = 'jobs';
my $job_queue_file_name;
-my @job_queue_col_names = ("id INTEGER PRIMARY KEY auto_increment",
+my @job_queue_col_names = ("id INTEGER PRIMARY KEY",
"timestamp VARCHAR(14) DEFAULT 'none'",
"status VARCHAR(255) DEFAULT 'none'",
"result TEXT",
index cba1df5048b68f11099f541e3e5034c0287ef031..65d2896155e2878c0e0c3b7e01b56f9a68fea991 100644 (file)
my $table_name = shift;
my $col_names_ref = shift;
my @col_names;
+ my @col_names_creation;
foreach my $col_name (@$col_names_ref) {
+ # Save full column description for creation of database
+ push(@col_names_creation, $col_name);
my @t = split(" ", $col_name);
$col_name = $t[0];
+ # Save column name internally for select_dbentry
push(@col_names, $col_name);
}
-
+
$col_names->{ $table_name } = $col_names_ref;
- my $col_names_string = join("', '", @col_names);
- my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( '$col_names_string' )";
+ my $col_names_string = join(", ", @col_names_creation);
+ my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( $col_names_string )";
$self->lock();
eval {
my $res = $self->{dbh}->do($sql_statement);
my $sql_statement;
if($create_id==1) {
- $sql_statement = "INSERT INTO $table ('id', ".join(", ", @col_list).") VALUES ((select coalesce(max(id), 0)+1 from $table), ".join(", ", @val_list).")";
+ $sql_statement = "INSERT INTO $table (id, ".join(", ", @col_list).") VALUES (null, ".join(", ", @val_list).")";
} else {
$sql_statement = "INSERT INTO $table (".join(", ", @col_list).") VALUES (".join(", ", @val_list).")";
}