mmm wrote:
> Oops I did make a mistake. The code I wanted to test should have been
>
> import copy
> print 'Test 1'
> pf= '?,?,?,?'
> sqlx1= 'INSERT INTO DTABLE2 VALUES ( %s ) ' % pf
> print sqlx1
>
> print
> print 'Test 2'
> sqlx2= copy.copy(sqlx1)
> sqlx3= sqlx1
> pf= '?,?,?, '
> print 'sq
Oops I did make a mistake. The code I wanted to test should have been
import copy
print 'Test 1'
pf= '?,?,?,?'
sqlx1= 'INSERT INTO DTABLE2 VALUES ( %s ) ' % pf
print sqlx1
print
print 'Test 2'
sqlx2= copy.copy(sqlx1)
sqlx3= sqlx1
pf= '?,?,?, '
print 'sqlx1= ', sqlx1
print 'sqlx2= ', sqlx2
pr
Peter Otten wrote:
> Steve Holden wrote:
>
>> What I will repeat, however, is that while there is a *slight*
>> difference is semantics between
>>
>> s = "some string"
>> s1 = s
>>
>> and
>>
>> s = "some string"
>> s1 = copy.copy(s)
>>
>> that difference is only to ensure that s and s1 point to di
Steve Holden wrote:
> What I will repeat, however, is that while there is a *slight*
> difference is semantics between
>
> s = "some string"
> s1 = s
>
> and
>
> s = "some string"
> s1 = copy.copy(s)
>
> that difference is only to ensure that s and s1 point to different
> copies of the same st
mmm wrote:
> Steve, I think you were right the first time is saying
>
>> it should really be this:
>> sqlxb= 'INSERT INTO DTABLE2 VALUES (?, ?, ?, ?)'
>
> my copy.copy() has the equivalent effect.
>
> Running this test code produces the output below
>
> import copy
>
> print 'Test 1'
> pf= '?
Steve, I think you were right the first time is saying
> it should really be this:
> sqlxb= 'INSERT INTO DTABLE2 VALUES (?, ?, ?, ?)'
my copy.copy() has the equivalent effect.
Running this test code produces the output below
import copy
print 'Test 1'
pf= '?,?,?,?'
sqlx1= 'INSERT INTO DTABLE
mmm wrote:
>>> Hence (if I understand python convention), this can be
>>> solved by adding
>>> sqlx= copy.copy(sqlx)
>>> before the looping. And in tests adding this step saved about 5-10% in
>>> time.
>> Now this I don;t really understand at all. What's the point of trying to
>> replace sqlx with
> > Hence (if I understand python convention), this can be
> > solved by adding
> > sqlx= copy.copy(sqlx)
> > before the looping. And in tests adding this step saved about 5-10% in
> > time.
>
> Now this I don;t really understand at all. What's the point of trying to
> replace sqlx with a copy of
[EMAIL PROTECTED] schrieb:
> I hav read on this forum that SQL coding (A) below is preferred over
> (B), but I find (B) is much faster (20-40% faster)
>
> (A)
>
> sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values
> curs.execute(sqla)
>
> (B)
> pf= '?, ?, ?, ?'
> sql
[EMAIL PROTECTED] wrote:
> Steve, I want to make sure I understand. My test code is below, where
> ph serves as a placeholder. I am preparing for a case where the number
> of ? will be driven by the length of the insert record (dx)
>
> dtable= 'DTABLE3'
> print 'Insert data into table %s, versio
Steve, I want to make sure I understand. My test code is below, where
ph serves as a placeholder. I am preparing for a case where the number
of ? will be driven by the length of the insert record (dx)
dtable= 'DTABLE3'
print 'Insert data into table %s, version #3' % dtable
ph= '?, ?, ?, ?'
sqlx=
[EMAIL PROTECTED] wrote:
>
>I hav read on this forum that SQL coding (A) below is preferred over
>(B), but I find (B) is much faster (20-40% faster)
>
>(A)
>
>sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values
>curs.execute(sqla)
>
>(B)
> pf= '?, ?, ?, ?'
>sqlxb= 'INSERT
[EMAIL PROTECTED] wrote:
>> (B) is better than (A). The parameter binding employed in (B)
>> is not only faster on many databases, but more secure.
> See, for example,http://informixdb.blogspot.com/2007/07/filling-in-
> blanks.html
>
> Thx. The link was helpful, and I think I have read similar th
> (B) is better than (A). The parameter binding employed in (B)
> is not only faster on many databases, but more secure.
See, for example,http://informixdb.blogspot.com/2007/07/filling-in-
blanks.html
Thx. The link was helpful, and I think I have read similar things
before-- that B is faster.
So
On Thu, 28 Feb 2008 19:35:03 -0800 (PST), mdboldin wrote
> I hav read on this forum that SQL coding (A) below is preferred over
> (B), but I find (B) is much faster (20-40% faster)
>
> (A)
>
> sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values
> curs.execute(sqla)
>
> (B)
>
I hav read on this forum that SQL coding (A) below is preferred over
(B), but I find (B) is much faster (20-40% faster)
(A)
sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values
curs.execute(sqla)
(B)
pf= '?, ?, ?, ?'
sqlxb= 'INSERT INTO DTABLE2 VALUES ( %s ) ' % pf
16 matches
Mail list logo