mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2026-03-13 08:00:02 +08:00
New initialization, help.
This commit is contained in:
@@ -1 +1 @@
|
||||
ZMySQLDA 2.0.7b2
|
||||
ZMySQLDA 2.0.8a1
|
||||
|
||||
@@ -95,3 +95,16 @@ meta_types=DA.meta_types
|
||||
methods=DA.folder_methods
|
||||
misc_=DA.misc_
|
||||
__ac_permissions__=DA.__ac_permissions__
|
||||
|
||||
def initialize(context):
|
||||
|
||||
context.registerClass(
|
||||
DA.Connection,
|
||||
permission='Add Z MySQL Database Connections',
|
||||
constructors=(DA.manage_addZMySQLConnectionForm,),
|
||||
icon='misc_/ZMySQLDA/conn',
|
||||
)
|
||||
|
||||
context.registerHelp()
|
||||
context.registerHelpTitle('ZMySQLDA')
|
||||
|
||||
|
||||
40
ZMySQLDA/lib/python/Products/ZMySQLDA/help/DA.py
Normal file
40
ZMySQLDA/lib/python/Products/ZMySQLDA/help/DA.py
Normal file
@@ -0,0 +1,40 @@
|
||||
def manage_addZMySQLConnection(self, id, title,
|
||||
connection_string,
|
||||
check=None, REQUEST=None):
|
||||
"""Add a MySQL connection to a folder.
|
||||
|
||||
Arguments:
|
||||
|
||||
REQUEST -- The current request
|
||||
|
||||
title -- The title of the ZMySQLDA Connection (string)
|
||||
|
||||
id -- The id of the ZMySQLDA Connection (string)
|
||||
|
||||
connection_string -- The connection string is of the form:
|
||||
|
||||
'[+/-]database[@host[:port]] [user [password [unix_socket]]]'
|
||||
|
||||
or typically:
|
||||
|
||||
'database user password'
|
||||
|
||||
to use a MySQL server on localhost via the standard UNIX socket.
|
||||
Only specify host if the server is on a remote system. You can
|
||||
use a non-standard port, if necessary. If the UNIX socket is in
|
||||
a non-standard location, you can specify the full path to it
|
||||
after the password. Transactions will be used if the server
|
||||
supports them. If you are using non-transaction-safe tables,
|
||||
a '-' at the beginning will disable transactions. If you want to
|
||||
be sure transactions are used, a '+' at the beginning will
|
||||
forcibly enable transactions; an exception will be raised if
|
||||
the server does not support transactions.
|
||||
|
||||
"""
|
||||
|
||||
class Connection:
|
||||
"""MySQL Connection Object"""
|
||||
|
||||
__constructor__ = manage_addZMySQLConnection
|
||||
|
||||
|
||||
28
ZMySQLDA/lib/python/Products/ZMySQLDA/help/db.py
Normal file
28
ZMySQLDA/lib/python/Products/ZMySQLDA/help/db.py
Normal file
@@ -0,0 +1,28 @@
|
||||
class DB:
|
||||
|
||||
"""This is the ZMySQLDA Database Connection Object."""
|
||||
|
||||
def __init__(self,connection):
|
||||
"""
|
||||
connection
|
||||
blah blah
|
||||
"""
|
||||
|
||||
def tables(self, rdb=0,
|
||||
_care=('TABLE', 'VIEW')):
|
||||
"""Returns a list of tables in the current database."""
|
||||
|
||||
def columns(self, table_name):
|
||||
"""Returns a list of column descriptions for 'table_name'."""
|
||||
|
||||
def query(self,query_string, max_rows=1000):
|
||||
"""Execute 'query_string' and return at most 'max_rows'."""
|
||||
|
||||
def _begin(self, *ignored):
|
||||
"""Begin a transaction (when TM is enabled)."""
|
||||
|
||||
def _finish(self, *ignored):
|
||||
"""Commit a transaction (when TM is enabled)."""
|
||||
|
||||
def _abort(self, *ignored):
|
||||
"""Rollback a transaction (when TM is enabled)."""
|
||||
Reference in New Issue
Block a user