Re: [sqlite] qmark style updates

2005-11-12 Thread Jay Sprenkle
> I tried this to and got some strange behavior, like if
> I entered a value like "333" it would give me a

All text constants are entered with single quotes.
 insert into mytable(five) values( 'data' )


Re: [sqlite] qmark style updates

2005-11-12 Thread Alexander Kozlovsky
The second parameter of cursor.execute() accept **sequence** of
bindings. Try this:

 c.execute(toDo, [s1])
 

> from pysqlite2 import dbapi2 as sqlite
> 
> con = sqlite.connect("mydb.db")
> c = con.cursor()
> 
> s1 =3
> toDo ="Update ex set amount = ? where ex_id = 1"
> c.execute(toDo,s1)
> con.commit()
> c.close()
> 
> 
> Can anyone help?
  

Best regards,
 Alexandermailto:[EMAIL PROTECTED]



Re: [sqlite] qmark style updates

2005-11-11 Thread Dan McDaniel
Thanks for the suggestion. It did not help however.
My code is modified from the code that I found at the
following web site:
http://initd.org/tracker/pysqlite/wiki/basicintro
The difference is that the examples on the above
website use the x =raw_input =('enter a value) syntax

I tried this to and got some strange behavior, like if
I entered a value like "333" it would give me a
similar error message, counting out the number
individual tokens as the number of values supplied in
the error message. Only when I entered a single
character at the raw input prompt could I get it to
work.

What I am really trying to do is find a
straightforward way to update a datetime.date field of
a data base.

I will continue to search for an  answer. Any help
will be appreciated.

again thanks for your response.
Dan

--- Jay Sprenkle <[EMAIL PROTECTED]> wrote:

> the question mark is the indicator for a bound
> value.
> Escape it, I think like this
> > toDo ="Update ex set amount = '?' where ex_id = 1"
> or
> > toDo ="Update ex set amount = '\?' where ex_id =
> 1"
> 
> On 11/11/05, Dan McDaniel <[EMAIL PROTECTED]>
> wrote:
> > I am trying following a simple example shown in
> one of
> > the online tutorials on pysqlite.
> > The example shows how to input a value using
> qmarks in
> > the statement. I am getting an error message
> > like"Incorrect number of bindings supplied. The
> > current statement uses 1, and there are -1
> supplied."
> > my code is:
> >
> > from pysqlite2 import dbapi2 as sqlite
> >
> > con = sqlite.connect("mydb.db")
> > c = con.cursor()
> >
> > s1 =3
> > toDo ="Update ex set amount = ? where ex_id = 1"
> > c.execute(toDo,s1)
> > con.commit()
> > c.close()
> >
> >
> > Can anyone help?
> >
> > Dan
> >
> >
> >
> >
> > __
> > Yahoo! Mail - PC Magazine Editors' Choice 2005
> > http://mail.yahoo.com
> >
> 
> 
> --
> ---
> The Castles of Dereth Calendar: a tour of the art
> and architecture of
> Asheron's Call
> http://www.lulu.com/content/77264
> 




__ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com


Re: [sqlite] qmark style updates

2005-11-11 Thread Jay Sprenkle
the question mark is the indicator for a bound value.
Escape it, I think like this
> toDo ="Update ex set amount = '?' where ex_id = 1"
or
> toDo ="Update ex set amount = '\?' where ex_id = 1"

On 11/11/05, Dan McDaniel <[EMAIL PROTECTED]> wrote:
> I am trying following a simple example shown in one of
> the online tutorials on pysqlite.
> The example shows how to input a value using qmarks in
> the statement. I am getting an error message
> like"Incorrect number of bindings supplied. The
> current statement uses 1, and there are -1 supplied."
> my code is:
>
> from pysqlite2 import dbapi2 as sqlite
>
> con = sqlite.connect("mydb.db")
> c = con.cursor()
>
> s1 =3
> toDo ="Update ex set amount = ? where ex_id = 1"
> c.execute(toDo,s1)
> con.commit()
> c.close()
>
>
> Can anyone help?
>
> Dan
>
>
>
>
> __
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>


--
---
The Castles of Dereth Calendar: a tour of the art and architecture of
Asheron's Call
http://www.lulu.com/content/77264


[sqlite] qmark style updates

2005-11-11 Thread Dan McDaniel
I am trying following a simple example shown in one of
the online tutorials on pysqlite. 
The example shows how to input a value using qmarks in
the statement. I am getting an error message
like"Incorrect number of bindings supplied. The
current statement uses 1, and there are -1 supplied."
my code is:

from pysqlite2 import dbapi2 as sqlite

con = sqlite.connect("mydb.db")
c = con.cursor()

s1 =3
toDo ="Update ex set amount = ? where ex_id = 1"
c.execute(toDo,s1)
con.commit()
c.close()


Can anyone help?

Dan




__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com