Re: Another MySQL Question

2010-06-05 Thread Victor Subervi
On Thu, Jun 3, 2010 at 4:09 PM, John Nagle wrote: > The real problem with this is not the Python. It's the approach > to SQL. What's going on here is that you have some collection of > named options that come in from some external source, and you're > trying to handle that by dynamically cons

Re: Another MySQL Question

2010-06-03 Thread John Nagle
MRAB wrote: Victor Subervi wrote: Hi; I have this code: options = '' our_options = [] our_options_string = '' for op in ops: options += '%s varchar(40) not null, ' % (op[0].upper() + op[1:]) our_options.append('%s' % form.getfirst('%s' % op)) our_options_string

Re: Another MySQL Question

2010-06-03 Thread Victor Subervi
On Thu, Jun 3, 2010 at 1:48 PM, Dennis Lee Bieber wrote: > On Thu, 3 Jun 2010 08:49:44 -0400, Victor Subervi > declaimed the following in > gmane.comp.python.general: > > > options += '%s varchar(40) not null, ' % (op[0].upper() + op[1:]) > > Please modernize... Python supports a .c

Re: Another MySQL Question

2010-06-03 Thread MRAB
Victor Subervi wrote: Hi; I have this code: options = '' our_options = [] our_options_string = '' for op in ops: options += '%s varchar(40) not null, ' % (op[0].upper() + op[1:]) our_options.append('%s' % form.getfirst('%s' % op)) our_options_string += '%s", "'

Re: Another MySQL Question

2010-06-03 Thread Victor Subervi
On Thu, Jun 3, 2010 at 12:25 PM, MRAB wrote: > So our_options is a list containing two values, which you're putting > into a tuple: > > >>> our_options = ["first", "second"] > >>> print len(our_options) > 2 > >>> value_tuple = (our_options,) > >>> print len(value_tuple) > 1 > >>> > > In other wo

Re: Another MySQL Question

2010-06-03 Thread MRAB
Victor Subervi wrote: Hi; I have this code: options = '' our_options = [] our_options_string = '' for op in ops: options += '%s varchar(40) not null, ' % (op[0].upper() + op[1:]) our_options.append('%s' % form.getfirst('%s' % op)) our_options_string += '%s", "'

Another MySQL Question

2010-06-03 Thread Victor Subervi
Hi; I have this code: options = '' our_options = [] our_options_string = '' for op in ops: options += '%s varchar(40) not null, ' % (op[0].upper() + op[1:]) our_options.append('%s' % form.getfirst('%s' % op)) our_options_string += '%s", "' % op cursor.execute(