Hello,
How about doing this:
my @cols = qw(firstname lastname title phone email age location address
address2 city state zip zip2 inst school_type grades_taught subjectarea_1
subjectarea_2 subjectarea_3 subjectarea_4 subjectarea_5 subjectarea_6
how_heard Occupation);
my $dbh = DBI->connect(.
I recently had a similar problem, but I took the lazy man's way out and
substituted user-typed apostrophes with back quotes, using the following
regexp:
$message =~ s/'/`/g;
Simple, but few people notice the difference between the two characters.
Steven Yarbrough
--
To unsubscribe, e-mail: [
On Wed, Jul 18, 2001 at 04:27:28PM +0100, David Wood wrote:
> Another point to mention is that DBI->quote looks not only at the value
> being inserted, but also to the data_type of the table/field it's going
> into, and replaces undef values with an unquoted NULL value, if
> appropriate. This is
es_taught,$subjectarea_1,$s
> ubjectarea_2,$subjectarea_3,$subjectarea_4,$subjectarea_5,$subjectarea_6,$ho
> w_heard,$Occupation)`;
>
> my $sth= "$SQL_UP";
> $str= $dbh->quote($sth);
> print $str;
> exit;
> - Original Message -
> From: "David
ovej" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 18, 2001 7:23 AM
Subject: Re: Think there is something DBI
> DBI has a built in method, DBI->quote;
>
> eg:
>
> my $dbh = DBI->connect(...);
>
> my $str = "Haven't I got
20 odd question marks is not too bad ;)
>
> Somehow I've had more problems with the $dbh->quote($str) which very well
> may be because of my own errors.
>
> J
>
> -Original Message-
> From: borakovej [mailto:[EMAIL PROTECTED]]
> Sent: 18 July 2001 1
om: borakovej [mailto:[EMAIL PROTECTED]]
Sent: 18 July 2001 18:04
To: PURMONEN, Joni; [EMAIL PROTECTED]
Subject: Re: Think there is something DBI
that would work if it where a little insert but this is what the insert
looks like
$SQL_UP = qq`
Insert into $DB_Table
(firstname,lastname,title,ph
DBI has a built in method, DBI->quote;
eg:
my $dbh = DBI->connect(...);
my $str = "Haven't I got lot's of badl'y used apostrophy's";
$str = $dbh->quote($str);
# $str is now "Haven\'t I got lot\'s of badl\'y used apostrophy\'s"
# But it won't sort out intentionally bad English : )
Whi
27;,'$zip2','$inst','$school_type','$
grades_taught','$subjectarea_1','$subjectarea_2','$subjectarea_3','$subjecta
rea_4','$subjectarea_5','$subjectarea_6','$how_heard','$Occupation'
about apostrophes in the strings $this or
$id.
Joni
-Original Message-
From: borakovej [mailto:[EMAIL PROTECTED]]
Sent: 18 July 2001 17:31
To: [EMAIL PROTECTED]
Subject: Think there is something DBI
OK here is an overview of my problem, I am running a script to take a pipe
delimited flat fi
OK here is an overview of my problem, I am running a script to take a pipe delimited
flat file and pump the data into a database. Due to the users putting extraneous
apostrophes I am getting errors that there are unclosed apostrophes in the fields. I
am looking for a way to escape these apostro
11 matches
Mail list logo