summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 34c7dd9)
raw | patch | inline | side by side (parent: 34c7dd9)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Apr 2008 10:02:46 +0000 (10:02 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Apr 2008 10:02:46 +0000 (10:02 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10227 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/DBsqlite.pm | patch | blob | history | |
gosa-si/modules/GosaSupportDaemon.pm | patch | blob | history | |
gosa-si/tests/client.php | patch | blob | history |
index aef43265d366aff3845d9862a0c2eb858f4eb3da..0264a9011584f24405e8bce0f644973b95ebaeb8 100644 (file)
my ($self, $sql)= @_;
my $error= 0;
my $answer= {};
-
my $db_answer= &exec_statement($self, $sql);
+ my @column_list;
# fetch column list of db and create a hash with column_name->column_value of the select query
- $sql =~ /FROM ([\S]*?)( |$)/g;
- my $table = $1;
- my $column_list = &get_table_columns($self, $table);
- my $list_len = @{ $column_list } ;
+ $sql =~ /SELECT ([\S\s]*?) FROM ([\S]*?)( |$)/g;
+ my $selected_cols = $1;
+ my $table = $2;
+
+ # all columns are used for creating answer
+ if ($selected_cols eq '*') {
+ @column_list = @{ &get_table_columns($self, $table) };
+
+ # specific columns are used for creating answer
+ } else {
+ # remove all blanks and split string to list of column names
+ $selected_cols =~ s/ //g;
+ @column_list = split(/,/, $selected_cols);
+ }
+
+ # create answer
my $hit_counter = 0;
- foreach my $hit ( @{ $db_answer }) {
+ my $list_len = @column_list;
+ foreach my $hit ( @{$db_answer} ){
$hit_counter++;
for ( my $i = 0; $i < $list_len; $i++) {
- $answer->{ $hit_counter }->{ @{ $column_list }[$i] } = @{ $hit }[$i];
+ $answer->{ $hit_counter }->{ $column_list[$i] } = @{ $hit }[$i];
}
}
-
+
return $answer;
}
index fe027fe173ff61e95ad0b95d0287839e65dd0f26..bd929597b7acecbb7ce65041bd66f59bb840d389 100644 (file)
use Digest::MD5 qw(md5 md5_hex md5_base64);
use MIME::Base64;
use XML::Simple;
+use Data::Dumper;
my $op_hash = {
'eq' => '=',
my $select = "*";
if( exists $msg_hash->{'select'} ) {
my $select_l = \@{$msg_hash->{'select'}};
- $select = join(' AND ', @{$select_l});
+ $select = join(', ', @{$select_l});
}
return $select;
}
index 07b6af72c468f0881a895078277eac393c43ff57..4fa3eb402f7d45b5c9d0604456c9522503906b10 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
+
$sock->write($data);
$answer = "nothing";
$answer = $sock->read();