B TH@sdZddlmZmZmZmZmZddlmZm Z ddl Tddl m Z m Z edZddlZy ejZWnek r|ejZYnXddZd d Zd d Zd dZddZddZddZddZddZddZddZe jefgZ e!ee ee"eeee#ee$ee%eeee&ee'ee(e)e*e+e,ee-eej.e!ej/e!ej0e ej1e"ej2e"ej3e"ej4e"ej5e ej6e!ej7e!ej8eej9e:ej;eej?e@ejAe ejBe ejCe ejDe ejEe ejFe ejGe i$ZHe reeHeI<neeHe<y$ddlJmKZKeKeHej3<eKeHej4<WneLk rYnXdS)aMySQLdb type conversion module This module handles all the type conversions for MySQL. If the default type conversions aren't what you need, you can make your own. The dictionary conversions maps some kind of type to a conversion function which returns the corresponding value: Key: FIELD_TYPE.* (from MySQLdb.constants) Conversion function: Arguments: string Returns: Python object Key: Python type object (from types) or class Conversion function: Arguments: Python object of indicated type or class AND conversion dictionary Returns: SQL literal value Notes: Most conversion functions can ignore the dictionary, but it is a required parameter. It is necessary for converting things like sequences and instances. Don't modify conversions if you can avoid it. Instead, make copies (with the copy() method), modify the copies, and then pass them to MySQL.connect(). )string_literalescape_sequence escape_dictescapeNULL) FIELD_TYPEFLAG)*)PY2longNcCs tt|S)N)strint)sdrE/opt/alt/python37/lib64/python3.7/site-packages/MySQLdb/converters.pyBool2Str2rcCstdd|dDS)NcSsg|] }|r|qSrr).0irrr 5szStr2Set..,)setsplit)rrrrStr2Set4srcCstd||S)Nr)rjoin)rrrrrSet2Str7srcCst|S)z*Convert something into a string via str().)r )rrrrr Thing2Str:srcCs|S)zConvert a unicode object to a string using the default encoding. This is only used as a placeholder for the real function, which is connection-dependent.)encode)rrrrr Unicode2Str>srcCsd|S)Nz%.15gr)orrrr Float2StrDsr!cCstS)zConvert None to NULL.)r)r rrrr None2NULLGsr"cCs t||S)zConvert something into a SQL string literal. If using MySQL-3.23 or newer, string_literal() is a method of the _mysql.MYSQL object, and this function will be overridden with that method when the connection is created.)r)r rrrr Thing2LiteralKsr#cCs td|S)Nc)array)rrrr char_arraySsr&cCst||S)N)r#Ztostring)r rrrr array2StrVsr'cCsddt||S)Nz(%s)r)rr)trrrr quote_tupleYsr))Decimal)M__doc__Z_mysqlrrrrrZMySQLdb.constantsrrZ MySQLdb.timesZMySQLdb.compatr r typeZNoneTyper%Z ArrayTypeAttributeErrorrrrrrr!r"r#r&r'r)ZBINARYbytesZ _bytes_or_strr floattuplelistdictboolZDateZ DateTimeTypeZDateTime2literalZDateTimeDeltaTypeZDateTimeDelta2literalr rZTINYZSHORTZLONGZFLOATZDOUBLEZDECIMALZ NEWDECIMALZLONGLONGZINT24ZYEARZSET TIMESTAMPZmysql_timestamp_converterZDATETIMEZDateTime_or_NoneZTIMEZTimeDelta_or_NoneZDATEZ Date_or_NoneZ TINY_BLOBZ MEDIUM_BLOBZ LONG_BLOBZBLOBSTRINGZ VAR_STRINGZVARCHARZ conversionsZunicodeZdecimalr* ImportErrorrrrr!s