I am looking for a simple Database application framework that has code
for Insert, Update, Delete and navigation of rows. I have been using
Boa and PythonCard to create the simple GUIs but am stuck in the
learning curve of implementing the underlying SQL and don't want to
"over code". Does anyone have samples?
В Птн, 27.02.2004, в 17:20, Heimburger, Ralph P пишет:
I am looking for a simple Database application framework that has code
for Insert, Update, Delete and navigation of rows. I have been using
Boa and PythonCard to create the simple GUIs but am stuck in the
learning curve of implementing the underlying SQL and don't want to
"over code". Does anyone have samples?
You could just import a desired Python DBMS-specific binding (or, say,
an ODBC binding, if any) and then, if the GUI and the application is
really simple, make database queries in response to certain events like
this:
def someInitMethod(self):
#...
#EVT_BUTTON(blabla, self.OnSomeButtonClick)
#...
def OnSomeButtonClick(self, evt):
some_data = self.text_ctrl.GetValue();
self.db_conn.execute("UPDATE table_name SET (some_data = '%s');" %
(some_data,))
But this way application gets tricky to maintain, because the different
code logics get a little bit messed and mixed up...
It seems to me that it would be a little bit better (from my point of
view, at least) to implement a certain application-specific database
access API and use _it_ from within the GUI code. This will make the
application much more flexible to requirements changes etc. But this is
only durable, if the application is in any little way complex. Apps do
tend to become complicated after some time... Sometimes making a bit
"over coding" helps you avoid "over-maintaining"...
All the best,
···
--
Andrei Sosnin
http://tomato.dyn.ee