Re: Which ODBC ?

Поиск
Список
Период
Сортировка
От jcmd@acer.com.mx
Тема Re: Which ODBC ?
Дата
Msg-id Pine.LNX.4.30.0111121015420.6428-100000@cofradia.corp.mex
обсуждение исходный текст
Ответ на Which ODBC ?  (Fabio Serra <faser@faser.net>)
Список pgsql-admin

like this...

create table article(
  id_article serial,
  article text not null,
  num_of_part_of_article int not null
);

i use this script in perl, :) very, very pig

use CGI qw/:standard/;
use DBI;
use File::Find();

my ($graba, $handDb, $archivo, $contenido, $sth, $query, $name);

$graba  = undef;
$handDb = DBI->connect("dbi:Pg:dbname=XhoxXohaxX","Pi%fazes","Ley@sa") ||
die
"I cannot open the web_acer database";

@ARGV = qw (/var/www/html/acer/sp/)unless @ARGV;

sub find(&@){
    &File::Find::find;
}

sub ver(){
    $archivo =  shift @_;
    open(FILE,"<$archivo") || die "I can't open >> $archivo <<";
    $contenido  = ''; $parte = 20;
    while (<FILE>) {
    next if /^\n/;
    if(/THIS IS THE TABLE HOLDING THE MAIN CONTENT OF ALL THE/g){
        $graba=1;
        next;
    }
    if(/AND THIS IS WHERE THE MAIN CONTENT TABLE ENDS/g){
        $graba=undef;
        last;
    }
    s/\'/\\'/g;
        s/\"/\\"/g; #'
    s/^\s//g;
#    s/ +\s$//g;
#    s/\t+//g;
    if (defined $graba){
        if(length $contenido < 7000){
        $contenido.=$_;
        }else{
        $parte--;
        $archivo =~ s%/var/www/html/acer%%;
        $query = "insert into pages(path,content,partes) values
('$archivo','$contenido','$parte')";
        $sth = $handDb->prepare("$query") || die "No pude preparar
la consulta: $DBI::errstr";
        $sth->execute || die "No pude ejecutar la consulta:
$DBI::errstr";
        $contenido = '';
        }
    }
    }
    $parte--;
    $archivo =~s%/var/www/html/acer/%%;
    $query = "insert into pages(path,content,partes) values
('$archivo','$contenido','$parte')";
    $sth = $handDb->prepare("$query") || die "No pude preparar la
consulta: $DBI::errstr";
    $sth->execute || die "No pude ejecutar la consulta: $DBI::errstr";
    print "$archivo\n";

}

In this script i looking for all .html files in a directory ( recursive )
and the content of that files, I cut the content of each file, in 7Kb for
row, and save the order whit the field "partes" with a Max of 20. :)

Very very pig.

Regards!



On Mon, 12 Nov 2001, Fabio Serra wrote:

{At 16.12 12/11/2001, you wrote:
{
{
{>This behaviour, not its for th ODBC, the instalation of PG becomes with
{>that definition of TEXT_FIELD_SIZE, to repair this "ploblem" just compile
{>the PG with the Option TEXT_FILE_SIZE with more K.
{
{Yes, I can try to recompile PG, but now I have no problems to insert and
{select long text directly from the database.
{The problem arise only using unixODBC.
{What do you mean saying "Defines, more TEXT fields, for the same data. :) " ?
{Ex:
{
{create table article (
{article text not null,
{article text not null,
{);
{
{?!??
{Bye.
{
{--------------------------------------------------
{FABIO SERRA - faser(at)faser.net
{PGP available
{--------------------------------------------------
{
{



В списке pgsql-admin по дате отправления:

Предыдущее
От: Chris Ruprecht
Дата:
Сообщение: Re: [Solution] PG 7.1.3 & MacOS X (10.1)
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [Solution] PG 7.1.3 & MacOS X (10.1)