<s> """<STR_LIT>""" <EOL> from sqlalchemy import types as sqltypes , processors <EOL> from sqlalchemy . dialects . sybase . base import SybaseDialect , SybaseExecutionContext , SybaseSQLCompiler <EOL> class _SybNumeric ( sqltypes . Numeric ) : <EOL> def result_processor ( self , dialect , type_ ) : <EOL> if not self . asdecimal : <EOL> return processors . to_float <EOL> else : <EOL> return sqltypes . Numeric . result_processor ( self , dialect , type_ ) <EOL> class SybaseExecutionContext_pysybase ( SybaseExecutionContext ) : <EOL> def set_ddl_autocommit ( self , dbapi_connection , value ) : <EOL> if value : <EOL> dbapi_connection . commit ( ) <EOL> def pre_exec ( self ) : <EOL> SybaseExecutionContext . pre_exec ( self ) <EOL> for param in self . parameters : <EOL> for key in list ( param ) : <EOL> param [ "<STR_LIT:@>" + key ] = param [ key ] <EOL> del param [ key ] <EOL> class SybaseSQLCompiler_pysybase ( SybaseSQLCompiler ) : <EOL> def bindparam_string ( self , name , ** kw ) : <EOL> return "<STR_LIT:@>" + name <EOL> class SybaseDialect_pysybase ( SybaseDialect ) : <EOL> driver = '<STR_LIT>' <EOL> execution_ctx_cls = SybaseExecutionContext_pysybase <EOL> statement_compiler = SybaseSQLCompiler_pysybase <EOL> colspecs = { <EOL> sqltypes . Numeric : _SybNumeric , <EOL> sqltypes . Float : sqltypes . Float <EOL> } <EOL> @ classmethod <EOL> def dbapi ( cls ) : <EOL> import Sybase <EOL> return Sybase <EOL> def create_connect_args ( self , url ) : <EOL> opts = url . translate_connect_args ( username = '<STR_LIT:user>' , password = '<STR_LIT>' ) <EOL> return ( [ opts . pop ( '<STR_LIT:host>' ) ] , opts ) <EOL> def do_executemany ( self , cursor , statement , parameters , context = None ) : <EOL> for param in parameters : <EOL> cursor . execute ( statement , param ) <EOL> def _get_server_version_info ( self , connection ) : <EOL> vers = connection . scalar ( "<STR_LIT>" ) <EOL> return ( vers / <NUM_LIT:1000> , vers % <NUM_LIT:1000> / <NUM_LIT:100> , vers % <NUM_LIT:100> / <NUM_LIT:10> , vers % <NUM_LIT:10> ) <EOL> def is_disconnect ( self , e , connection , cursor ) : <EOL> if isinstance ( e , ( self . dbapi . OperationalError , <EOL> self . dbapi . ProgrammingError ) ) : <EOL> msg = str ( e ) <EOL> return ( '<STR_LIT>' in msg or <EOL> '<STR_LIT>' in msg or <EOL> '<STR_LIT>' in msg ) <EOL> else : <EOL> return False <EOL> dialect = SybaseDialect_pysybase </s>
