ó ò6ÅRc@s¾dZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z ddlZddlZddlZd„ZejdƒZd„Zdejfd „ƒYZdS( s This module implements connections for MySQLdb. Presently there is only one class: Connection. Others are unlikely. However, you might want to make your own subclasses. In most cases, you will probably override Connection.default_cursor with a non-standard Cursor class. iÿÿÿÿ(tcursors( tWarningtErrortInterfaceErrort DataErrort DatabaseErrortOperationalErrortIntegrityErrort InternalErrortNotSupportedErrortProgrammingErrorNcCsH||f}|r%|jj|ƒn|jj|ƒ~~||‚dS(s, If cursor is not None, (errorclass, errorvalue) is appended to cursor.messages; otherwise it is appended to connection.messages. Then errorclass is raised with errorvalue as the value. You can override this with your own error handler by assigning it to the instance. N(tmessagestappend(t connectiontcursort errorclasst errorvalueterror((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pytdefaulterrorhandlers s^(\d+)cCs,tj|ƒ}|r(t|jdƒƒSdS(sšReturns the leading numeric part of a string. >>> numeric_part("20-alpha") 20 >>> numeric_part("foo") >>> numeric_part("16b") 16 iN(tre_numeric_parttmatchtinttgrouptNone(tstm((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyt numeric_part(s t ConnectioncBsÔeZdZejZd„Zd„Zd d„Z d„Z d„Z d„Z d„Z eejdƒsud „Znd „Zd „Zd „ZeZeZeZeZeZeZeZeZeZeZeZ RS(s MySQL Database Connection ObjectcsÞddlm}m}ddlm}ddlm}|jƒ}d|kr[|d}n|}i} xP|jƒD]B\} } t | t ƒr¬t | t ƒr¬| | | srY     8    *;       cCs8t|ƒ}|jƒ|kr4tjj||ƒndS(N(tbooltget_autocommitRCR R((R]ton((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyR(ðs cCs|p |j|ƒS(sÔ Create a cursor on which queries may be performed. The optional cursorclass parameter is used to create the Cursor. By default, self.cursorclass=cursors.Cursor is used. (R!(R]R!((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyRõs cCs&|jƒr|jdƒn|jƒS(NtBEGIN(RgtqueryR(R]((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyt __enter__s cCs!|r|jƒn |jƒdS(N(trollbacktcommit(R]texctvaluettb((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyt__exit__s cCs|j||jƒS(s If o is a single object, returns an SQL literal as a string. If o is a non-string sequence, the items of the sequence are converted and returned as a sequence. Non-standard. For internal use; do not use this in your applications. (tescapeRL(R]to((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyR. s cCs1ddlm}|dtdƒ|jdƒdS(s„Explicitly begin a connection. Non-standard. DEPRECATED: Will be removed in 1.3. Use an SQL BEGIN statement instead.iÿÿÿÿ(twarns2begin() is non-standard and will be removed in 1.3iRiN(twarningsRttDeprecationWarningRj(R]Rt((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pytbegins t warning_countcCs>ddlm}|jƒ}|r6||jƒdƒSdSdS(spReturn the number of warnings generated from the last query. This is derived from the info() method.iÿÿÿÿ(tatoiiN(tstringRytinfoRE(R]RyR{((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyRx#s  cCs³|dkrd}n|}|jƒ|kr—ytt|ƒj|ƒWq—tk r“|jdkrutdƒ‚n|jd|ƒ|jƒq—Xn||j _ ||j _ dS( s÷Set the connection character set to charset. The character set can only be changed in MySQL-4.1 and newer. If you try to change the character set from the current value in an older version, NotSupportedError will be raised.tutf8mb4tutf8iis server is too old to set charsets SET NAMES %sN(ii( RORHRRPtAttributeErrorRNR Rjt store_resultR4R"R1(R]R"t py_charset((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyRP-s    cCs=|jdkrtdƒ‚n|jd|ƒ|jƒdS(sNSet the connection sql_mode. See MySQL documentation for legal values.iis!server is too old to set sql_modesSET SESSION sql_mode='%s'N(ii(RNR RjR(R]R%((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyRQAscCs?|jdkrdS|jdƒ|jƒ}|jdƒ}|S(sæReturn detailed information about warnings as a sequence of tuples of (Level, Code, Message). This is only supported in MySQL-4.1 and up. If your server is an earlier version, an empty sequence is returned.iis SHOW WARNINGSi(ii((RNRjRt fetch_row(R]trRu((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyt show_warningsIs   N(!t__name__t __module__t__doc__RtCursorR>RIR(RRRkRqR.RwthasattrRCR RxRPRQRƒRRRRRRRRR R Rt errorhandler(((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pyR8s2  ²       (R†tMySQLdbRt_mysql_exceptionsRRRRRRRRR R RWRCtreRtcompileRRR R(((sF/opt/alt/python27/lib64/python2.7/site-packages/MySQLdb/connections.pytsF