Re: [Tutor] MySQL Connection Function (Solution)

2005-06-23 Thread Don Parris
On Wed, 22 Jun 2005 15:06:22 -0400 Python <[EMAIL PROTECTED]> wrote: > On Wed, 2005-06-22 at 14:20 -0400, Don Parris wrote: > > On Tue, 21 Jun 2005 19:13:43 -0400 > > Python <[EMAIL PROTECTED]> wrote: > > > > Here's my solution, using the code Lloyd provided in a previous post: The script that

Re: [Tutor] MySQL Connection Function

2005-06-22 Thread Don Parris
On Tue, 21 Jun 2005 19:13:43 -0400 Python <[EMAIL PROTECTED]> wrote: Alright, I've had time to play with this and wanted to be sure I understand this well. It works, so I understand enough to make it work. However, I see a difference between your code and mine that makes me think I've missed so

Re: [Tutor] MySQL Connection Function

2005-06-21 Thread Don Parris
On Tue, 21 Jun 2005 19:13:43 -0400 Python <[EMAIL PROTECTED]> wrote: > I like to use the following style of code. Since there will be > passwords, the connection strings should be somewhat protected. Put > them in a separate file that can be controlled. Here's my sample code. > >>

[Tutor] MySQL Connection Function

2005-06-21 Thread Python
As a newbie developer, the easiest way for me to connect to MySQL is to > just copy & paste the connection commands into each funtion I write. > However, I know that's far from ideal, and consumes more time than its > worth. I would like to create a MySQL connection function that I can just > cal

Re: [Tutor] MySQL Connection Function

2005-06-21 Thread Alan G
> worth. I would like to create a MySQL connection function that I can just > call up whenever I need it from within an other function. Good idea! > ### The Connection Definition ### > # def mysql_Conn(): > # Create a connection object and create a cursor. > # Con = MySQLdb.Connect(host=

Re: [Tutor] MySQL Connection Function

2005-06-21 Thread Pujo Aji
This a very simple connection using mysql. 1. connect to mysql: db = mySQLdb.connect(user='root',passwd='something') 2. To execute and get the result: c = db.cursor() c.execute(sql comment) result = c.fetchall() you can wrap it in a class object. pujo On 6/21/05, Don Parris <[EMAIL PROTECTED]>

[Tutor] MySQL Connection Function

2005-06-21 Thread Don Parris
As a newbie developer, the easiest way for me to connect to MySQL is to just copy & paste the connection commands into each funtion I write. However, I know that's far from ideal, and consumes more time than its worth. I would like to create a MySQL connection function that I can just call up whe