0001class IPlugin:
0002
0003    def __init__(**parse_uri_result):
0004        """
0005        Create an instance of the plugin, bound to connection
0006        parameters and options.
0007        """
0008
0009    def tables(cursor):
0010        """
0011        Return a list of table names, using the given cursor object
0012        """
0013
0014    def table_exists(tablename, cursor):
0015        """
0016        Does ``tablename`` exist in the database?
0017        """
0018
0019    def get_sequence_nextval(sequence_name, cursor):
0020        """
0021        Get the next value for the named sequence
0022        """
0023
0024    def guess_sequence_name(table_name, id_name):
0025        """
0026        Guess the name of the sequence for the given table and id name.
0027        """
0028
0029    #@classmethod
0030    def activate():
0031        """
0032        Called the first time this plugin is loaded.  Will not be
0033        called twice.
0034        """
0035
0036    #@classmethod
0037    def activate_exceptions():
0038        """
0039        Called after ``activate()``, and makes sure that the
0040        exceptions raised by the database inherit from the exceptions
0041        in ``sqlapi.exceptions``
0042        """
0043
0044    #@classmethod
0045    def parse_uri(uri):
0046        """
0047        Return a dictionary representation of the URI, as documented
0048        in ``sqlapi.uri.parse_uri``
0049        """
0050
0051    pool = """
0052    Instance that has .connection() method that returns pooled
0053    connections
0054    """
0055
0056    def raw_connection():
0057        """
0058        Return the DB-API connection.
0059        """
0060
0061    def sql_literal(value):
0062        """
0063        This will only be called rendering the expression to string,
0064        which shouldn't happen except for logging or debugging output
0065        (it should not be sent to the database).
0066        """
0067
0068    def sql_literal_param(value):
0069        """
0070        This can be used to convert a Python object to an object
0071        that is accepted as a parameter by the database driver.
0072
0073        Most object do not need modification, but some database
0074        drivers do not like some kinds of objects.
0075        """
0076
0077    def sql_table(tablename):
0078        """
0079        This returns a table name with any necessary quoting for a
0080        database.
0081        """
0082
0083    def sql_column(column):
0084        """
0085        This returns a column name with any necessary quoting for a
0086        database.
0087        """
0088
0089    def sql_quote_symbol(sym):
0090        """
0091        This is a generic implementation of quoting that applies to
0092        tables and columns (if those methods are overridden).
0093        """
0094
0095    def sql_operator(oper):
0096        """
0097        This takes as an argument a string operator, which should be
0098        the ANSI SQL operator.  It then returns the operator to
0099        actually be used.
0100        """
0101
0102    def sql_unary_operator(oper):
0103        """
0104        This takes a unary operator, like - meaning negation
0105        """
0106
0107    def sql_postfix_operator(oper):
0108        """
0109        Takes an operator (-like thing), like 'IS NULL'
0110        """
0111
0112    def sql_column_create(name, type, params, default):
0113        """
0114        Returns one line/column as you'd expect in a CREATE TABLE
0115        statement.  ``name`` is the column name.  ``type`` is a
0116        standard SQL string representing the type (e.g., ``'INT'``).
0117        ``params`` is a dictionary of arguments.  ``default`` is the
0118        caller's guess at the result.
0119
0120        Raise ``NotSupportedError`` if the database *specifically*
0121        does not support the column type.  Return ``default`` if you
0122        simply do not know about the column type (and then the caller
0123        can guess).
0124        """
0125
0126    def sql_function(function_name):
0127        """
0128        Takes a function name, like ``'COUNT'``
0129        """
0130
0131    def param_mark_generator():
0132        """
0133        Yield a sequence of (param_mark, param_name).  If positional
0134        parameters are used, then return None for param_name,
0135        otherwise return a name used in a dictionary.
0136        """
0137
0138    # threadsafety
0139    #
0140    # Integer constant stating the level of thread safety the
0141    # interface supports. Possible values are:
0142    #
0143    #   0     Threads may not share the module.
0144    #   1     Threads may share the module, but not connections.
0145    #   2     Threads may share the module and connections.
0146    #   3     Threads may share the module, connections and
0147    #         cursors.
0148    #
0149    # Sharing in the above context means that two threads may
0150    # use a resource without wrapping it using a mutex semaphore
0151    # to implement resource locking. Note that you cannot always
0152    # make external resources thread safe by managing access
0153    # using a mutex: the resource may rely on global variables
0154    # or other external sources that are beyond your control.
0155
0156    threadsafety = "according to DB-API"
0157
0158
0159    # The DB-API doesn't specify this as a thread safety level,
0160    # but some connections can only be used from the thread in
0161    # which they were created.  That means you can't use them
0162    # from multiple threads, even if you make sure they are used
0163    # only in a single thread at a time.
0164
0165    movethread = "can connections move threads?"
0166
0167
0168    # paramstyle
0169    #
0170    # String constant stating the type of parameter marker
0171    # formatting expected by the interface. Possible values are
0172    # [2]:
0173    #
0174    #   'qmark'         Question mark style, 
0175    #                   e.g. '...WHERE name=?'
0176    #   'numeric'       Numeric, positional style, 
0177    #                   e.g. '...WHERE name=:1'
0178    #   'named'         Named style, 
0179    #                   e.g. '...WHERE name=:name'
0180    #   'format'        ANSI C printf format codes, 
0181    #                   e.g. '...WHERE name=%s'
0182    #   'pyformat'      Python extended format codes, 
0183    #                   e.g. '...WHERE name=%(name)s'
0184
0185    paramstyle = "according to DB-API"
0186
0187
0188    # This is the module this plugin is based off of:
0189
0190    module = "the DB-API module"
0191
0192    auto_increment = "If the database uses AUTO_INCREMENT, this is true"