On Mon, May 26, 2008 at 06:23:01PM -0400,
 Oscar Luis Garcell Martinez <[EMAIL PROTECTED]> wrote 
 a message of 361 lines which said:

> How can i get a well formed output, i means something like this:
> 
> Select * from [usuarios] 

This is certainly not well-formed SQL.

> where = ([usuarios].[passwords] = ¨1a2b¨) AND ([usuarios].[usuario]
> = ¨Pepe¨ OR [usuarios]. [nombre] = ¨Pepe¨)

The obvious, but wrong, solution, is to use print(). The reason why it
is wrong and what you should do is well explained in the attached
message.
--- Begin Message ---
On Jan 10, 2008, at 20:58 , johnf wrote:

> tempCursor.execute("Select pg_get_serial_sequence('%s','%s') as seq  
> " %
> ('public.arcust','pkid'))
>
> rs = tempCursor.fetchall()
> rs
> [(None,)]
>
> it should return 'public.arcust_pkid_seq'

This many not make a difference to your problem, but you're using the  
API incorrectly. Do this, instead:

tempCursor.execute ( "Select pg_get_serial_sequence ( %s, %s ) as  
seq", ( 'public.arcust', 'pkid' ) )


Notice how I'm NOT enclosing the %s in quotes, nor am I using the  
python % operator.

If you don't do this across your entire application, you're opening  
your application to SQL-injection attacks. Very bad :)



-- 
Chris Cogdon       <[EMAIL PROTECTED]>                         
Chris:  650 242 3518
Truviso Inc.           http:// 
www.truviso.com                              Switch: 650 242 3500
1065 E Hillsdale Blvd Suite 230 Foster City CA 94404     Fax:    650  
242 3501




_______________________________________________
Psycopg mailing list
[EMAIL PROTECTED]
http://lists.initd.org/mailman/listinfo/psycopg

--- End Message ---
_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig

Reply via email to