On Fri, 2006-01-27 at 05:47, Fredrik Lundh wrote:
> (just curious, but from where do people get the idea that arbitrary data
> just have to be inserted into the the SQL statement text all the time? is
> this some PHP misfeature?)
Yes, the need to roll queries by inserting parameters directly into
[quote]
(just curious, but from where do people get the idea that arbitrary
data
just have to be inserted into the the SQL statement text all the time?
is
this some PHP misfeature?)
[/quote]
I've never seen it done in this way before, but I do come from a PHP
point of view.
I've only started with
Derick van Niekerk wrote:
> [quote]
> d = {"spam": "1", "egg": "2"}
>
> cols = d.keys()
> vals = d.values()
>
> stmt = "INSERT INTO table (%s) VALUES(%s)" % (
> ",".join(cols), ",".join(["?"]*len(vals))
> )
>
> cursor.execute(stmt, tuple(vals))
> [/quote]
>
> I will be using the python-mys
Derick van Niekerk wrote:
> [quote]
> d = {"spam": "1", "egg": "2"}
>
> cols = d.keys()
> vals = d.values()
>
> stmt = "INSERT INTO table (%s) VALUES(%s)" % (
> ",".join(cols), ",".join(["?"]*len(vals))
> )
>
> cursor.execute(stmt, tuple(vals))
> [/quote]
>
> I will be using the python-
[quote]
d = {"spam": "1", "egg": "2"}
cols = d.keys()
vals = d.values()
stmt = "INSERT INTO table (%s) VALUES(%s)" % (
",".join(cols), ",".join(["?"]*len(vals))
)
cursor.execute(stmt, tuple(vals))
[/quote]
I will be using the python-mysql API. This looks like what I am looking
for. I ju
Derick van Niekerk wrote:
> I have found many posts that deal with writing a dictionary to MySQL in
> a blob field - which I can't imagine why anybody would want to do it.
it might be useful if you have a bunch of unknown properties (e.g. configuration
parameters for some external parameters), an
On Fri, 27 Jan 2006 00:03:30 -0800, Derick van Niekerk wrote:
> I have found many posts that deal with writing a dictionary to MySQL in
> a blob field - which I can't imagine why anybody would want to do it.
>
> I want to write each element of a dictionary onto a db table. The keys
> would match
On Fri, 27 Jan 2006 00:03:30 -0800, Derick van Niekerk wrote:
> I have found many posts that deal with writing a dictionary to MySQL in
> a blob field - which I can't imagine why anybody would want to do it.
>
> I want to write each element of a dictionary onto a db table. The keys
> would match
I have found many posts that deal with writing a dictionary to MySQL in
a blob field - which I can't imagine why anybody would want to do it.
I want to write each element of a dictionary onto a db table. The keys
would match the fieldnames. Is there something that would make this job
easier? i.e.