server/sqlutils.py
changeset 11035 0fb100e8385b
parent 11034 75d752e6daf7
equal deleted inserted replaced
11034:75d752e6daf7 11035:0fb100e8385b
    45 from cubicweb.server import SQL_CONNECT_HOOKS
    45 from cubicweb.server import SQL_CONNECT_HOOKS
    46 from cubicweb.server.utils import crypt_password
    46 from cubicweb.server.utils import crypt_password
    47 
    47 
    48 lgc.USE_MX_DATETIME = False
    48 lgc.USE_MX_DATETIME = False
    49 SQL_PREFIX = 'cw_'
    49 SQL_PREFIX = 'cw_'
       
    50 
    50 
    51 
    51 def _run_command(cmd):
    52 def _run_command(cmd):
    52     if isinstance(cmd, string_types):
    53     if isinstance(cmd, string_types):
    53         print(cmd)
    54         print(cmd)
    54         return subprocess.call(cmd, shell=True)
    55         return subprocess.call(cmd, shell=True)
    94         if not sql:
    95         if not sql:
    95             continue
    96             continue
    96         try:
    97         try:
    97             # some dbapi modules doesn't accept unicode for sql string
    98             # some dbapi modules doesn't accept unicode for sql string
    98             execute(str(sql))
    99             execute(str(sql))
    99         except Exception as err:
   100         except Exception:
   100             if cnx:
   101             if cnx:
   101                 cnx.rollback()
   102                 cnx.rollback()
   102             failed.append(sql)
   103             failed.append(sql)
   103         else:
   104         else:
   104             if cnx:
   105             if cnx: