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
0030 def activate():
0031 """
0032 Called the first time this plugin is loaded. Will not be
0033 called twice.
0034 """
0035
0036
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
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
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156 threadsafety = "according to DB-API"
0157
0158
0159
0160
0161
0162
0163
0164
0165 movethread = "can connections move threads?"
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185 paramstyle = "according to DB-API"
0186
0187
0188
0189
0190 module = "the DB-API module"
0191
0192 auto_increment = "If the database uses AUTO_INCREMENT, this is true"