Exemplo n.º 1
0
    def sqlmap(self):
        try:
            stream = DataInput(request.environ['wsgi.input'].read(
                int(request.environ['CONTENT_LENGTH'])))
            ret = ""
            while stream.dataAvailable() > 0:
                (type, key, values) = Codec.decodeRequest(stream)

                log.debug("sqlmap request %s" % (key))
                if type == Codec.SELECT:
                    ret = Codec.encodeResults(self.session.sqlmap(key, values))
                elif type == Codec.UPDATE:
                    ret = Codec.encodeLastId(
                        self.session.sqlmap(key, values).lastrowid)
                elif type == Codec.FUNCTION:
                    if hasattr(self, key):
                        ret = getattr(self, key)(*values)
                    else:
                        raise Exception("Unknown FUNCTION call %s" % (key))
                else:
                    raise Exception("Unknown call type %s" % (type))

            self.session.commit()
            return ret

        except Exception, e:
            self.session.rollback()
            msg = Exception.__str__(e)
            filename, lineno, name, line = traceback.extract_tb(
                sys.exc_info()[2])[-1]
            return Codec.encodeError(filename, lineno, msg)
Exemplo n.º 2
0
	def sqlmap(self):
		try:
			stream = DataInput(request.environ['wsgi.input'].read(int(request.environ['CONTENT_LENGTH'])))
			ret = ""
			while stream.dataAvailable() > 0:
				(type, key, values) = Codec.decodeRequest(stream)

				log.debug("sqlmap request %s" % (key))
				if type == Codec.SELECT:
					ret = Codec.encodeResults(self.session.sqlmap(key, values))
				elif type == Codec.UPDATE:
					ret = Codec.encodeLastId(self.session.sqlmap(key, values).lastrowid)
				elif type == Codec.FUNCTION:
					if hasattr(self, key):
						ret = getattr(self, key)(*values)
					else:
						raise Exception("Unknown FUNCTION call %s" % (key))
				else:
					raise Exception("Unknown call type %s" % (type))

			self.session.commit()
			return ret

		except Exception, e:
			self.session.rollback()
			msg = Exception.__str__(e)
			filename, lineno, name, line = traceback.extract_tb(sys.exc_info()[2])[-1]
			return Codec.encodeError(filename, lineno, msg)
Exemplo n.º 3
0
 def UpdateClass(self, eventid, course, classcode, carid):
     UpdateClassResults(self.session, eventid, course, classcode, carid)
     return Codec.encodeLastId(-1)
Exemplo n.º 4
0
	def UpdateClass(self, eventid, course, classcode, carid):
		UpdateClassResults(self.session, eventid, course, classcode, carid)
		return Codec.encodeLastId(-1)