Re: [Zope] external method database connection

2000-10-06 Thread knight

Also, you could always import the specific module for your database, and
create a db connection, then execute() and fetch() directly. Although, if
you are putting this in an external method, it would be wiser to use your
existing ZSQL methods ;]

Knight
[EMAIL PROTECTED]

On Fri, 6 Oct 2000, knight wrote:

> 
> > How do I get  a zope database connection from an enternal method? 
> 
> You can access your db using your existing ZSQL Methods by calling them
> from the namespace passed in, specifically self.
> 
> Example:
> 
> def myextmethod(self):
>   mfl_id = 3
>   results = self.sqlCountUsers(mfl_id=mfl_id)
>   for result in results:
> print result[0], result[3]
> 
> 
> 
> Keep in mind that a list is returned, not a dictionary.
> 
> Knight
> [EMAIL PROTECTED]
> 
> 
> 
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> 


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] external method database connection

2000-10-06 Thread knight


> How do I get  a zope database connection from an enternal method? 

You can access your db using your existing ZSQL Methods by calling them
from the namespace passed in, specifically self.

Example:

def myextmethod(self):
  mfl_id = 3
  results = self.sqlCountUsers(mfl_id=mfl_id)
  for result in results:
print result[0], result[3]



Keep in mind that a list is returned, not a dictionary.

Knight
[EMAIL PROTECTED]



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] external method database connection

2000-10-05 Thread Mark Twiddy

Hi ya

Another newbe question sorry.

How do I get  a zope database connection from an enternal method? 


Thanks Mark


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )