On Apr 27, 2006, at 8:15 PM, [EMAIL PROTECTED] wrote:
> my question is, is there a way i can set up a global connection so
> that
> when the program loads, it connects once, then stays connected ? maybe
> i could assign instances of the cursor ?
We do something like this in Dabo. We def
way cool, i think that this will work.
thanks very much
-sk
--
http://mail.python.org/mailman/listinfo/python-list
So this opens and closes the connection every time i run the query?
thats cool. i think that would fit in well. so when i need to run the
query, i pass something like
query = "SELECT * FROM `Table` WHERE `foo` = 'bar'"
result = DB_Connector.Execute(query)
and the result would be the same as if i
On 04/28/2006 08:35 AM, *binarystar* wrote:
Looking better at the """ Humble Database Connection Class """: if I am
not mistaken, it seems to mix up connections and cursors.
MySQLdb has a thread safety level of '1', meaning: "Threads may share
the module, but not connections". So you have to giv
I suppose that is possible because you are calling the one instance of a cursor
object ... maybe you have to create a copy of the cursor object, rather than
passing a reference to the one object? or set up the db_connection objects
inside each of the threads? ..
Winfried Tilanus wrote:
> On 0
On 04/28/2006 07:54 AM, *binarystar* wrote:
Just wondering: is there any risk of two threads accessing the Execute
function at the same time and getting something like this on the same
cursor object:
thread_1: self.cursor.Execute( sql_statement )
thread_2: self.cursor.Execute( sql_statement )
thr
Oops .. slight edit
now when you pass the db_connection instance to other classes, a reference will
be passed automagically
--
http://mail.python.org/mailman/listinfo/python-list
your on the right track ... create something like this ( hope the formatting
doesn't go to hay wire )
class DB_Connector(object):
""" Humble Database Connection Class """
def __init__(self, host="localhost", user="MyUser",passwd="MyPassword",
**other_db_arguments):
This is great !
ok, i dont really have a lot of time to get into the ORMS (before your
post, this is the first i have heard of it) and my stuff is due on
Monday. he he.
but, if i am able to make a global db connection, and multiple cursors
pointing to the same connection object, how do i pull tha
that's definitely the way to go ..
-create a database_object
-initialise at start up
-then pass the database object to other classes as needed ...
If you want to get really fancy have a look at some ORM's ... I think
there is a Python one called SQLObject?
[EMAIL PROTECTED] wrote:
> hey there,
hey there,
i have a huge app that connects to MySQL. There are three threads that
are continually connecting and disconnecting to the db. The problem is,
if there is an error, it faults out sometimes without closing the
connection. i connect like this.
db = MySQLdb.connect(host="localhost", user="M
11 matches
Mail list logo