Exemplo n.º 1
0
def getSqlException(state, code, message, context=None, exception=None):
    error = SQLException()
    error.SQLState = state
    error.ErrorCode = code
    error.NextException = exception
    error.Message = message
    error.Context = context
    return error
Exemplo n.º 2
0
 def prepareCommand(self, command, commandtype):
     sql = None
     if commandtype == TABLE:
         sql = getSqlQuery(self._ctx, 'prepareCommand', command)
     elif commandtype == QUERY:
         if self.getQueries().hasByName(command):
             sql = self.getQueries().getByName(command).Command
     elif commandtype == COMMAND:
         sql = command
     if sql is None:
         raise SQLException()
     return self.prepareStatement(sql)
Exemplo n.º 3
0
 def prepareCommand(self, command, commandtype):
     query = None
     if commandtype == TABLE:
         query = getSqlQuery(self.ctx, 'prepareCommand', command)
     elif commandtype == QUERY:
         if self.getQueries().hasByName(command):
             query = self.getQueries().getByName(command).Command
     elif commandtype == COMMAND:
         query = command
     # TODO: sometime we cannot use: connection.prepareStatement(sql)
     # TODO: it trow a: java.lang.IncompatibleClassChangeError
     # TODO: if self._patched: fallback to connection.prepareCall(sql)
     if query is not None:
         return PreparedStatement(self, query, self._patched)
     raise SQLException()
Exemplo n.º 4
0
 def prepareCommand(self, command, commandtype):
     # TODO: cannot use: self._connection.prepareCommand()
     # TODO: it trow a: java.lang.IncompatibleClassChangeError
     # TODO: in the same way when using self._connection.prepareStatement(sql)
     # TODO: fallback to: self._connection.prepareCall(sql)
     print("Connection.prepareCommand()")
     query = None
     if commandtype == TABLE:
         query = 'SELECT * FROM "%s"' % command
     elif commandtype == QUERY:
         queries = self._connection.getQueries()
         if queries.hasByName(command):
             query = queries.getByName(command).Command
     elif commandtype == COMMAND:
         query = command
     if query is not None:
         statement = CallableStatement(self, query)
         return statement
     raise SQLException()