Fernando,
hello all
I would like to create a navigator to see my registers in the form, I use mysqldb.
example.
<<first <previous next> last>>
I see the method nextset() in mysqldb, but this not work.
anybody how to I make it ???
thanks !!!
Fernando Paiva - Brasil/Brazil
Desenvolvedor - Developer
Python/wxPython
MySQL
You need to write the stuff yourself. So you keep track of where you're at in your data or the rows of your database. Then depending on which button you press, it makes a call to the database to retrieve the next or previous set of data. Then you update the form. Here's some psuedo-code:
def onNext(self, event):
data = sqlMethodCall()
# let's assume it returns a dict
self.fieldOne.SetValue(data["valueOne"])
.
self.fieldTen.SetValue(["valueTen"])
Hopefully that will give you the idea.
···
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Yep, I understand...But which the method that returns the last register ??? I need this method to work with the navigation !!!
I'm looking for on the MySQLdb user guide, and there is a method nextset() but does not work.
thanks
···
----- Original Message ----- From: "Mike Driscoll" <mike@pythonlibrary.org>
To: <wxpython-users@lists.wxwidgets.org>
Sent: Wednesday, April 01, 2009 12:16 PM
Subject: Re: [wxpython-users] Navigator ???
Fernando,
hello all
I would like to create a navigator to see my registers in the form, I use mysqldb.
example.
<<first <previous next> last>>
I see the method nextset() in mysqldb, but this not work.
anybody how to I make it ???
thanks !!!
-------------------------------------------------------
Fernando Paiva - Brasil/Brazil
Desenvolvedor - Developer
Python/wxPython
MySQL
You need to write the stuff yourself. So you keep track of where you're at in your data or the rows of your database. Then depending on which button you press, it makes a call to the database to retrieve the next or previous set of data. Then you update the form. Here's some psuedo-code:
def onNext(self, event):
data = sqlMethodCall()
# let's assume it returns a dict
self.fieldOne.SetValue(data["valueOne"])
.
self.fieldTen.SetValue(["valueTen"])
Hopefully that will give you the idea.
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Fernando Paiva wrote:
Yep, I understand...But which the method that returns the last register ??? I need this method to work with the navigation !!!
I'm looking for on the MySQLdb user guide, and there is a method nextset() but does not work.
thanks
I've never used this library, but it depends on your database's keys. If you have an autonumber key, then you should be able to use fetch_row() or some such and pass the key.
Or you could use real SQL, like SELECT:
select * from myDb where (key=SomeVal)
If you don't have an ascending autonum as your key, then you'll have to keep track of that list of keys some other way.
- Mike
···
----- Original Message ----- From: "Mike Driscoll" <mike@pythonlibrary.org>
To: <wxpython-users@lists.wxwidgets.org>
Sent: Wednesday, April 01, 2009 12:16 PM
Subject: Re: [wxpython-users] Navigator ???
Fernando,
hello all
I would like to create a navigator to see my registers in the form, I use mysqldb.
example.
<<first <previous next> last>>
I see the method nextset() in mysqldb, but this not work.
anybody how to I make it ???
thanks !!!
-------------------------------------------------------
Fernando Paiva - Brasil/Brazil
Desenvolvedor - Developer
Python/wxPython
MySQL
You need to write the stuff yourself. So you keep track of where you're at in your data or the rows of your database. Then depending on which button you press, it makes a call to the database to retrieve the next or previous set of data. Then you update the form. Here's some psuedo-code:
def onNext(self, event):
data = sqlMethodCall()
# let's assume it returns a dict
self.fieldOne.SetValue(data["valueOne"])
.
self.fieldTen.SetValue(["valueTen"])
Hopefully that will give you the idea.
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org