22 |
select ime,tel from imenik |
select ime,tel from imenik |
23 |
}, |
}, |
24 |
pk_col => 'tel', |
pk_col => 'tel', |
|
db_encoding => 'iso-8859-2', |
|
25 |
debug => 1, |
debug => 1, |
26 |
user => 'admin', |
user => 'admin', |
27 |
passwd => 'admin', |
passwd => 'admin', |
28 |
}; |
}; |
29 |
|
|
30 |
GetOptions($c, qw/node_url=s sql=s pk_col=s eb_encoding=s debug+ user=s passwd=s/); |
GetOptions($c, qw/node_url=s sql=s pk_col=s debug+ user=s passwd=s/); |
31 |
|
|
32 |
warn "# c: ", Dumper($c) if ($c->{debug}); |
warn "# c: ", Dumper($c) if ($c->{debug}); |
33 |
|
|
105 |
while (my ($col,$val) = each %{$row}) { |
while (my ($col,$val) = each %{$row}) { |
106 |
|
|
107 |
if ($val) { |
if ($val) { |
|
# change encoding? |
|
|
from_to($val, ($c->{db_encoding} || 'ISO-8859-1'), 'UTF-8'); |
|
|
|
|
108 |
# add attributes (make column usable from attribute search) |
# add attributes (make column usable from attribute search) |
109 |
$doc->add_attr($col, $val); |
$doc->add_attr($col, $val); |
110 |
|
|
153 |
my $col_names = join(', ', @cols); |
my $col_names = join(', ', @cols); |
154 |
my $col_def = join(', ', map { "$_ text" } @cols); |
my $col_def = join(', ', map { "$_ text" } @cols); |
155 |
|
|
156 |
print "example SQL search query: |
print " |
157 |
|
## example SQL search query: |
158 |
|
|
159 |
SELECT $col_names |
SELECT $col_names |
160 |
FROM pgest( |
FROM pgest( |
162 |
'$c->{node_url}', '$c->{user}', '$c->{passwd}', 0, |
'$c->{node_url}', '$c->{user}', '$c->{passwd}', 0, |
163 |
-- full text search |
-- full text search |
164 |
'foo bar', |
'foo bar', |
165 |
-- attribute filter, order by, limit, offset |
-- attribute filter, order, limit, offset |
166 |
null, null, null, null, |
null, null, null, null, |
167 |
-- return columns |
-- return columns |
168 |
array[$cols] |
array[$cols] |