Ejemplo n.º 1
0
    def _sqlite(self, _request):
        _db_file_path = _request.get(SQL.SQLITE.lower())
        if _db_file_path == None:
            logging.error("%s not in %s" % (SQL.SQLITE.lower(), str(_request)))
            return _return(self, -1)
        
        _db_file_path = _db_file_path.get("db_file_path")
        if _db_file_path == None or len(_db_file_path) == 0:
            logging.error("db_file_path is required for sqlite")
            return _return(self, -1)
        
        try:
            _dir = os.path.dirname(_db_file_path)
            _mkdir_p(_dir)
            open(_db_file_path, "w").close()
        except:
            logging.error("sqlite: can not create %s" % _db_file_path)
            return _return(self, -1)
        
        _config = {
            "type": SQL.SQLITE.lower(),
            "sqlite": {
                "db_file_path": _db_file_path
            }
        }

        if create_sqlite_tables(_config):
            self._dump_db_config(_config)
            return _return(self, 0)
        return _return(self, -1)
Ejemplo n.º 2
0
    def _sqlite(self, _request):
        _db_file_path = _request.get(SQL.SQLITE.lower())
        if _db_file_path == None:
            logging.error("%s not in %s" % (SQL.SQLITE.lower(), str(_request)))
            return _return(self, -1)

        _db_file_path = _db_file_path.get("db_file_path")
        if _db_file_path == None or len(_db_file_path) == 0:
            logging.error("db_file_path is required for sqlite")
            return _return(self, -1)

        try:
            _dir = os.path.dirname(_db_file_path)
            _mkdir_p(_dir)
            open(_db_file_path, "w").close()
        except:
            logging.error("sqlite: can not create %s" % _db_file_path)
            return _return(self, -1)

        _config = {
            "type": SQL.SQLITE.lower(),
            "sqlite": {
                "db_file_path": _db_file_path
            }
        }

        if create_sqlite_tables(_config):
            self._dump_db_config(_config)
            return _return(self, 0)
        return _return(self, -1)
Ejemplo n.º 3
0
    def _sqlite(self, _request):
        logging.info(_request)

        _db_file_path = _request.get("sqlite").get("db_file_path")
        if _db_file_path == None or len(_db_file_path) == 0:
            logging.error("db_file_path is required for sqlite")
            return _return(self, -1)
        
        try:
            self._mkdir_p(_db_file_path)
            open(_db_file_path, "w").close()
        except:
            logging.error("sqlite db_file_path can not create")
            return _return(self, -1)
        
        _config = {
            "type": SQL.SQLITE.lower(),
            "sqlite": {
                "db_file_path": _db_file_path
            }
        }

        if create_sqlite_tables(_config.get(SQL.SQLITE.lower())):
            self._dump_db_config(_config)
            return _return(self, 0)
        return _return(self, -1)
Ejemplo n.º 4
0
    def _sqlite(self):
        _cur = _cur_dir()
        _db_file_path = _cur + "/ppmessage/resource/data/db/ppmessage.db"
        
        try:
            _dir = os.path.dirname(_db_file_path)
            _mkdir_p(_dir)
            open(_db_file_path, "w").close()
        except:
            logging.error("sqlite: can not create %s" % _db_file_path)
            return False
        
        _config = {
            "type": SQL.SQLITE.lower(),
            "sqlite": {
                "db_file_path": _db_file_path
            }
        }

        if create_sqlite_tables(_config):
            self._dump_db_config(_config)
            return True
        return False