server/sqlutils.py
changeset 10612 84468b90e9c1
parent 10607 6519ae8cca0c
child 10651 9ca33768473c
equal deleted inserted replaced
10611:f4dec0cca9a1 10612:84468b90e9c1
    25 import re
    25 import re
    26 import subprocess
    26 import subprocess
    27 from os.path import abspath
    27 from os.path import abspath
    28 from logging import getLogger
    28 from logging import getLogger
    29 
    29 
       
    30 from six import string_types
    30 from six.moves import filter
    31 from six.moves import filter
    31 
    32 
    32 from logilab import database as db, common as lgc
    33 from logilab import database as db, common as lgc
    33 from logilab.common.shellutils import ProgressBar, DummyProgressBar
    34 from logilab.common.shellutils import ProgressBar, DummyProgressBar
    34 from logilab.common.deprecation import deprecated
    35 from logilab.common.deprecation import deprecated
    68     if hasattr(cursor_or_execute, 'execute'):
    69     if hasattr(cursor_or_execute, 'execute'):
    69         execute = cursor_or_execute.execute
    70         execute = cursor_or_execute.execute
    70     else:
    71     else:
    71         execute = cursor_or_execute
    72         execute = cursor_or_execute
    72     sqlstmts_as_string = False
    73     sqlstmts_as_string = False
    73     if isinstance(sqlstmts, basestring):
    74     if isinstance(sqlstmts, string_types):
    74         sqlstmts_as_string = True
    75         sqlstmts_as_string = True
    75         sqlstmts = sqlstmts.split(delimiter)
    76         sqlstmts = sqlstmts.split(delimiter)
    76     if withpb:
    77     if withpb:
    77         if sys.stdout.isatty():
    78         if sys.stdout.isatty():
    78             pb = ProgressBar(len(sqlstmts), title=pbtitle)
    79             pb = ProgressBar(len(sqlstmts), title=pbtitle)