#9719: Strings which look like numbers are not quoted, MySQL
------------------------------------------+---------------------------------
 Reporter:  anonymous                     |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.0       
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 Create a simple model with a CharField.[[BR]]
 Create a ModelForm for that model.

 The model can be created successfully and saved to the database using
 CharField data which looks like a number (e.g. IP address), but updating
 that model using the same ModelForm fails if the data already existing in
 the database looks like a number.


 {{{
         form = Config(request.POST, instance=mymodel) # A form bound to
 the POST data
         if form.is_valid(): # All validation rules pass
             try:
                 form.save()  # Throws blank exception
 }}}


 The SQL query that fails (from db.connection.queries) is:


 {{{
 SELECT .... FROM `service_config` WHERE (`service_config`.`customer_id` =
 1  AND `service_config`.`hostname` = 192.168.1.20
 }}}

 The last item should be in quotes. MySQL will fail on this statement, and
 the Exception returned from ModelFormInstance.save() is blank (printing
 the exception results in a null string).

 Change the data to 'X192.168.1.20' and it works as expected.

 This occurs in at least 1.0.1 and 1.0.2.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9719>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to