[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 #!/usr/bin/perl 2 #example of inserting 3 4 use strict; 5 use Search::OpenFTS::Index; 6 use DBI(); 7 use DBD::Pg(); 8 9 if ( $#ARGV <1 ) { 10 print "Usage:\n$0 DATABASE file1 [ file2 [...] ]\n"; 11 exit; 12 } 13 14 my $dbi=DBI->connect('DBI:Pg:dbname='.shift( @ARGV ).';host=sp',"sp"); 15 $dbi||die; 16 my $STID=shift( @ARGV ); 17 18 my $idx=Search::OpenFTS::Index->new( $dbi ); 19 die "QQQ: $@" if ! $idx; 20 21 my $sth = $dbi->prepare( "insert into txt ( tid, txt ) values ( ? , ? );" ); 22 23 foreach my $file ( @ARGV ) { 24 open(INFILE, $file) ||die; 25 my $text=join('', <INFILE>); 26 close INFILE; 27 28 $sth->execute( $STID, $text ) || die; 29 30 $idx->index($STID, \$text); 31 32 print "$STID done\n"; 33 $STID++; 34 } 35 36 37 $dbi->disconnect; 38
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |