List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:December 23 1999 10:09pm
Subject:Re: MAY DAY! MAY DAY!! Clarify :datatype TEXT/BLOB
View as plain text  
Willy Gielen wrote:

> I think the problem is simply that your text contains a single quote ('),
> which tells mysql that your text is finished ad this point. Everything after
> that he can't decipher. A simple way to prevent this from happening is
> before writing your SQL statement, you can replace all quotes with another
> character or string (for example §§). When you read back the record, you
> replace the chosen string with the original quote.

Horrible! :-)

You need no replacements or something similar. All you need is
quoting the special characters with a backslash. As in

	insert into foo values ('Tim o\'Reilly')

With DBD::mysql use either of

	$name = "Tim o'Reilly";
	$dbh->do("insert into foo values (" . $dbh->quote($name) . ")");

or

	$dbh->do("insert into foo values (?)",
		 undef, $name);


Bye,

Jochen


> 
> Willy
> 
> Quintessence Consulting GmbH, Willy Gielen - wgielen@stripped
> Kopernikusstrasse 26, 30853 Langenhagen
> Tel. +49 (511) 7245 666 - Fax: +49 (511) 7245 667
> 
> -----Original Message-----
> From: Mehdi Ali Khan [mailto:mamehdi@stripped]
> Sent: Mittwoch, 22. Dezember 1999 12:45
> To: java@stripped
> Cc: developer@stripped; msql-mysql-modules@stripped
> Subject: MAY DAY! MAY DAY!! Clarify :datatype TEXT/BLOB
> 
> Hi Everybody,
> 
> We want a clarify from you
> 
> 1)
> 
> We created a table xx  as follows
> 
> create table xx(
> x1 char(10),
> x2 text)
> 
> Supose we want to insert a text of size containing 500 characters into that
> table with a query statement
> 
> "insert into xx values('123456789x','The Brooklyn Tabernacle has become
> world famous as a church of miracles a church that has flourished amidst the
> poverty and crime of one of Brooklyn's harshest most unforgiving
> neighborhoods. A place where professional men and women former prostitutes
> pimps drug addicts homeless people and transvestites gather to worship their
> powerful and merciful God. Fall on Your Knees is a book that will lead you
> on a journey to spiritual awakening. In it Jim Cymbala pastor of he Brooklyn
> Tabernacle shares')"
> 
> it shows error as follows
> 
> parse error near 's harshest most unforgiving neighborhoods. A place where
> professional men and wo' at line 1
> 
> But from your manual data type TEXT supports maximum of 655535 characters
> TEXT and BLOB A `TEXT'/`BLOB' with max length of L+2 65535 characters.
> 
> Why it won't support here.
> 
> we also tested with change of TEXT datatype to BLOB. But same problem.
> 
> Is there any wrong in the query statement.
> 
> 2)
> 
> We faced problem for creating a database with password protection
> 
> WeI execute following query in mysql database
> 
> "insert into user
> values('localhost','mak',password('mak10'),'Y','Y','Y','Y','Y','Y','Y','Y','
> Y','Y')"
> 
> Also we executed mysqladmin reload at command prompt after executing the
> above query
> 
> But we are unable to enter to the user with mysql -u mak -p
> it asks password
> 
> But it shows the error "Access denied for User: 'mak@stripped'  (Using
> password:YES)"
> 
> we followed according to manual.
> 
> we are using mysql 3.21.29a-gamma for win32-3.21
> 
> Please reply with clear explanation.
> 
> Thanks
> KSatyanarayana
> 
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail msql-mysql-modules-thread499@stripped
> 
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@stripped instead.
Thread
Updates, replaces for DBD::mysql broken for parenthesized data?Rob McMillin22 Jan
  • RE: MAY DAY! MAY DAY!! Clarify :datatype TEXT/BLOBWilly Gielen22 Dec
  • Re: MAY DAY! MAY DAY!! Clarify :datatype TEXT/BLOBpriya22 Dec
  • Re: Updates, replaces for DBD::mysql broken for parenthesized data?sasha23 Jan
    • Re: MAY DAY! MAY DAY!! Clarify :datatype TEXT/BLOBJochen Wiedmann22 Dec
    • Re: MAY DAY! MAY DAY!! Clarify :datatype TEXT/BLOBJochen Wiedmann24 Dec