Click here to get back home

Perl DBI Module: SQL query where there is space in field name

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Perl DBI Module: SQL query where there is space in field name ambarish.mitra 05-08-2008
Get Chitika Premium
Posted by Jens Thoms Toerring on May 8, 2008, 1:12 pm
Please log in for more thread options
ambarish.mitra@gmail.com wrote:
> Using the DBI module, I have connected to a CSV file, and am trying to
> execute SQL queries on the CSV file. I am stuck when there is a space
> in the field name and I cannot proceed.

> The CSV file col heading:
> "Attribute","Display Name","Semantic Type","Display Type". (ie, space
> in the heading)

> I am trying to "prepare" only those lines for which 'Display Type' is
> given.

> The error line is given:

> my $sth = $dbh->prepare("select * from report where [Display Type]
> =MultiLineText");


> SQL ERROR: Bad table or column name '[Display Type]' has chars not
> alphanumeric or underscore!
> SQL ERROR: Couldn't find predicate!

> I have tried some googling and also tried multiple combination of
> brackets/qoutes/escapes with a hope that one of them will work, but
> without luck.

> Question: What is the way to fire this command in PERL where the field
> name (and value as well) can have spaces?

I guess you're out of luck. While the documentation of DBI::CVS only
explicitely says that table names can't contain spaces (due to SQL
not allowing any) if I remember correctly also spaces in column
names aren't allowed in SQL. Thus I wouldn't expect DBI to accept
them even with some kinds of quotation/escape characters (which
probably would have an extra meaning in an SQL statement).

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de

Posted by Ted Zlatanov on May 9, 2008, 10:34 am
Please log in for more thread options

AD> Jürgen Exner wrote:
>> And you honestly believe your 120+ lines long signature (quoted in
>> full below)
AD> Looks like somebody needs to learn what a signature is...

Yes, please do.

Ted

Posted by Jürgen Exner on May 9, 2008, 12:57 pm
Please log in for more thread options
>Jürgen Exner wrote:
>> And you honestly believe your 120+ lines long signature (quoted in
>> full below)
>Looks like somebody needs to learn what a signature is...

Isn't it the part of a posting that is following the dash-dash-blank
line? And that is supposed to be 4 lines max?

Well, your's over 120+ lines and contained pretty much no information at
all.

jue

Posted by Waylen Gumbal on May 10, 2008, 3:28 am
Please log in for more thread options
Jürgen Exner wrote:
>> Jürgen Exner wrote:
>>> And you honestly believe your 120+ lines long signature (quoted in
>>> full below)
>> Looks like somebody needs to learn what a signature is...
>
> Isn't it the part of a posting that is following the dash-dash-blank
> line? And that is supposed to be 4 lines max?
>
> Well, your's over 120+ lines and contained pretty much no information
> at all.

What are you talking about? His sig is only 2 lines long. Looks like
your reader is not setup correctly. If you don't want the text/html
portion then tell your reader you only want the text/plain only when it
encounters a multipart message.


--
wg



Posted by Jürgen Exner on May 10, 2008, 8:17 am
Please log in for more thread options
>Jürgen Exner wrote:
>>> Looks like somebody needs to learn what a signature is...
>>
>> Isn't it the part of a posting that is following the dash-dash-blank
>> line? And that is supposed to be 4 lines max?
>>
>> Well, your's over 120+ lines and contained pretty much no information
>> at all.
>
>What are you talking about? His sig is only 2 lines long. Looks like
>your reader is not setup correctly. If you don't want the text/html
>portion then tell your reader you only want the text/plain only when it
>encounters a multipart message.

Multipart is a feature of EMail. This here is Usenet. There is no such
thing as multipart in Usenet. Therefore anything following his signature
delimiter line must be his signature.

jue

Similar ThreadsPosted
Re: Perl DBI Module: SQL query where there is space in field name June 12, 2008, 4:21 am
query regarding perl module installation in local directory July 28, 2007, 4:08 pm
Simplest way (or module) to tweak query in CGI server-side validation June 12, 2008, 9:10 pm
matching a pattern with a space or no space?? November 9, 2005, 7:45 am
SNMP module to query net-snmp August 31, 2006, 7:08 am
CGI - How to use upload_hook and query the query string ? February 7, 2006, 1:00 pm
how to check whether the field is filled or empty in perl TK November 14, 2007, 9:40 am
How to check a form's field and exit Perl program if it has a value? July 7, 2007, 2:08 pm
Simple (!) HTML/PERL code fpr uploading files through web pages entyr field ?? November 18, 2004, 11:12 pm
Perl Regex Query November 9, 2006, 11:14 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap