[ic] Re: MySQL complex search specs in cat table problem

dzhang-msi interchange-users@icdevgroup.org
Sun Aug 25 21:00:00 2002


Ok, below is the script. To use, give specific variables as indicated.


###### script starts from the next line
#! /usr/bin/perl            #edit the path of perl exec if necessary

use DBI;
use DBD::mysql;

#MYSQL DATABASE INFORMATION
my $hostname = "localhost";
my $database = "your_database_name";
my $user = "your_user_name";
my $pass = "your_pass_word";
my $table = "your_mysql_table_name";

my $dbh = DBI->connect("DBI:mysql:$database", "$user", "$pass")
                || die "Couldn't connect to database: " . DBI->errstr;

my $sql = qq|LOAD DATA LOCAL INFILE
"your_source_text_file_name_with_abslute_path" REPLACE INTO TABLE $table
IGNORE 1 LINES|;

# the above "IGNORE 1 LINES" is for the line of field name in the text file.

$dbh->do($sql) or die "Can't load $table table".$dbh->errstr;

$dbh->disconnect;

###############################


David
msihosting.com
Mount Spring International


----- Original Message -----
From: "Richard Eddy" <reddy@iinet.net.au>
To: <interchange-users@icdevgroup.org>
Sent: Sunday, August 25, 2002 6:30 PM
Subject: [ic] Re: MySQL complex search specs in cat table problem


>
> >>InterChange with a MySQL database does not seem to like complex search
field
> >>entries in the CAT table entered like:
> >>
> >>mp=0/sf=comment/tf=title/su=yes/sp=eloqresults/se=Eloquence
> >>
> >>which it outputs in the browser address line as:
> >>
> >>mp=0::sf=comment::tf=title::su=yes::sp=eloqresults::se=Eloquence
> >>
> >>Instead, it seems to need complex search field entries to be broken out
into
> >>separate lines such as:
> >>
> >>mp=0
> >>sf=comment
> >>tf=title
> >>su=yes
> >>sp=eloqresults
> >>se=Eloquence
> >>
> >>which it translates in the browser command line to:
> >>
> >>mp=0/sf=comment/tf=title/su=yes/sp=eloqresults/se=Eloquence
> >>
> >>and then works just fine.
> >>
> >>However, when I use Administration / Tables / Import in the Admin
> >>environment to upload a replacement CAT table in which complex search
field
> >>entries have been broken out as above, only the first line -- mp=0 -- is
> >>placed in the MySQL cat table field.
> >
> >From: "D Zhang - msi" <dzhang@mtspring.com>
> >To: <interchange-users@icdevgroup.org>
> >Subject: Re: [ic] MySQL complex search specs in cat table problem
> >Date: Sat, 24 Aug 2002 11:29:17 -0400
> >Reply-To: interchange-users@icdevgroup.org
> >
> >There seems to be a discussion recently on the topic. And it was
suggested
> >that a perl script should do a better job. If you like to work this way,
I
> >can post a script that works for me.
> >
> >David Zhang
> >msihosting.com
>
> I would appreciate that please David. Thank you.
>
> Richard Eddy.
>
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
>
>