Monday, August 5, 2013

Re: Save url containing special characters into mysql database using cursor object

On Sat, Aug 3, 2013 at 8:04 PM, fanchyna <fanchyna@gmail.com> wrote:
>
>
>
> I am about to save the url below to my mysql database (innodb) using the
> cursor object:
>
>
> http://www-i6.informatik.rwth-aachen.de/publications/download/367/l{o}{o}fjonasbisanimaximiliangollanchrisianheigoldgeorghoffmeisterbj{o}rnplahlchristianschl{u}terralfneyhermann--the2006{rwth}parliamentaryspeechestranscriptionsystem--2006.pdf
>

What special characters are in that string?

> the insert statement is
>
> dbquery = "INSERT INTO maintable (url,state) VALUES (%s,%s)"
> dbqueryvalue = (url,'0')
>
> The cursor.execute(dbquery,dbqueryvalue)

So, not using django?

>
> error:
>
> _mysql_exceptions.Warning: Data truncated for column 'url' at row 1
>
> Other urls seem to be OK, but on this one cannot be saved.The url field
> can save up to 255 characters so the string length is not the problem.

That error message from mysql indicates that the data supplied is too
large for the column specified and has been truncated. Either your
table structure does not allow for 242 characters in that column, or
that's not the URL you are trying to insert. This WFM when I attempt
to reproduce your issue.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment