Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 30th, 2008, 04:55 PM
Newbie
 
Join Date: Sep 2008
Posts: 2
Default pySqlite cur.executescript problem

Hello
I'm using pySqlite and can return data using SELECT statement in SQLite
ie
Expand|Select|Wrap|Line Numbers
  1. cursor.execute ('select * from work order by name,ext')
which works!

but you get an error if you try another SELECT - 'Warning: You can only execute one statement at a time'

this causes the error:
Expand|Select|Wrap|Line Numbers
  1. cursor.executescript ('select * from work where nkey <=9;select * from work where nkey>94 and nkey<100;')

so I've tried using cursor.executescript with the 2 SELECTS - I don't get an error but I don't get any data either!!! (The cursor is empty?)

The 2 select statements work fine in SQLite3 as does using just one select from the above.

Can anyone help please?
Many thanks
Ogg
:)
Reply
  #2  
Old September 30th, 2008, 08:19 PM
Strider1066's Avatar
Newbie
 
Join Date: Aug 2007
Posts: 11
Default

Perhaps you could try an 'OR' statement in your WHERE clause.
eg "WHERE columnName == y OR columnName==z"
Reply
  #3  
Old October 1st, 2008, 10:00 AM
Newbie
 
Join Date: Sep 2008
Posts: 2
Default

Ha! Many thanks Strider!

I followed your suggestion and changed it to OR statements - but it still didn't work! until of course I realised that that made it a SINGLE statement again and just used cursor.execute instead of cursor.executescript.

If you have any handy links to cursor/cursor.execute docs - I'd be grateful - all I seem to find is the python docs reformatted - but word for word on various different sites!

Thanks again

Ogg
:)
Reply
  #4  
Old October 3rd, 2008, 01:05 AM
Strider1066's Avatar
Newbie
 
Join Date: Aug 2007
Posts: 11
Default

I can't find much else online. I found The Definitive Guide to SqLite, (Michael Owens, Apress) very useful. It has only a few pages on Pysqlite, but the general discussion on sqlite good.
s
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles