# Path: gemBS/utils.py
# class CommandException(Exception):
#     """Exception thrown by gemtools commands"""
#     pass


import os
import sqlite3
import re
import fnmatch
import logging
import json
import threading as th
from .utils import CommandException

## Global register for db commands that must be performed if
## processes are aborted

class database(sqlite3.Connection):
    db_name = None
    json_data = None
    _mem_db = False
    _db_com_register = {}
    _lock = th.Lock()
    
    @classmethod
    def setup(cls, json_data):
        cls.json_data = json_data
        config = cls.json_data.config
        cls.db_name = config['DEFAULT'].get('gembs_dbfile', 'file:gemBS?mode=memory&cache=shared')
        cls._mem_db = (cls.db_name.startswith('file:'))
        
    @classmethod
    def mem_db(cls):

# Path: gemBS/utils.py
# class CommandException(Exception):
#     """Exception thrown by gemtools commands"""
#     pass


# Path: gemBS/database.py
import os
import sqlite3
import re
import fnmatch
import logging
import json
import threading as th
from .utils import CommandException


## Global register for db commands that must be performed if
## processes are aborted

class database(sqlite3.Connection):
    db_name = None
    json_data = None
    _mem_db = False
    _db_com_register = {}
    _lock = th.Lock()
    
    @classmethod
    def setup(cls, json_data):
        cls.json_data = json_data
        config = cls.json_data.config
        cls.db_name = config['DEFAULT'].get('gembs_dbfile', 'file:gemBS?mode=memory&cache=shared')
        cls._mem_db = (cls.db_name.startswith('file:'))
        
    @classmethod
    def mem_db(cls):

        return cls._mem_db