summaryrefslogtreecommitdiff
path: root/portato/db/__init__.py
blob: 40bf9ee7fd8fd742040d9b950a0fb6f4c9a3adac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
#
# File: portato/db/__init__.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
# Copyright (C) 2009 René 'Necoro' Neumann
# This is free software.  You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO WARRANTY, to the extent permitted by law.
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>

from __future__ import absolute_import

from ..session import Session, SectionDict
from ..constants import USE_SQL
from ..helper import debug

_SESSION = None

def Database():
    global _SESSION

    if _SESSION is None:
        _SESSION = Session("db.cfg", name = "DB")

    if USE_SQL:
        debug("Using SQLDatabase")
        from .sql import SQLDatabase
        return SQLDatabase(SectionDict(_SESSION, "SQL"))
    else:
        debug("Using DictDatabase")
        from .dict import DictDatabase
        return DictDatabase(SectionDict(_SESSION, "dict"))
ss='insertions'>+3 2017-03-12Split document content into its own table to avoid having to load it each tim...René 'Necoro' Neumann2-15/+22 2017-03-12Whitespace fixesRené 'Necoro' Neumann3-8/+8 2017-03-12Implement finding documents by tagsRené 'Necoro' Neumann1-0/+43 2017-03-12Make field part virtual prefixes to explicitly be int for the moment.René 'Necoro' Neumann1-1/+1 2017-03-12Fix handling of composite pks in peewee.René 'Necoro' Neumann3-2/+17 2017-03-12Misc fixesRené 'Necoro' Neumann1-3/+6 2017-03-11Upgrade to peewee-2.9 and drop our customizationsRené 'Necoro' Neumann3-120/+9 2017-03-11Remove useless requirements.txtRené 'Necoro' Neumann1-2/+0 2017-03-11A tag with a prefix implies the prefixes default tagRené 'Necoro' Neumann1-5/+13 2017-03-11Roll our own version of create_or_get, replacing the one broken/removed one f...René 'Necoro' Neumann1-0/+25 2017-03-11Minor fixesRené 'Necoro' Neumann1-3/+3 2017-03-11Remove peewee import to allow import on global levelRené 'Necoro' Neumann2-2/+6 2017-03-04Prefixes, Tags, and ImplicationsRené 'Necoro' Neumann2-12/+74 2017-03-04Allow to add implications for tagsRené 'Necoro' Neumann1-12/+30 2017-03-04FixesRené 'Necoro' Neumann1-8/+5 2017-03-04Fix Peewee Model.get() (cf. PR #1202)René 'Necoro' Neumann1-1/+25 2017-03-04Remove "builtin" and "pseudo" columns; use "virtual" insteadRené 'Necoro' Neumann3-10/+4 2017-02-27Inserting DocumentsRené 'Necoro' Neumann4-16/+91 2017-02-26Refined the EnumFieldRené 'Necoro' Neumann2-24/+34 2017-02-26Introduce enum fieldsRené 'Necoro' Neumann1-2/+31 2017-02-26Introduce the closureRené 'Necoro' Neumann2-3/+102 2017-02-26Some repr and str improvements on the modelRené 'Necoro' Neumann1-3/+25 2017-02-26Move logging to extra functionRené 'Necoro' Neumann1-5/+7 2017-02-26Include sqllite closure extension in build processRené 'Necoro' Neumann4-2/+1001 2017-02-26More tag handlingRené 'Necoro' Neumann2-3/+82 2017-02-25More prefix workRené 'Necoro' Neumann3-9/+96 2017-02-25Use Peewee instead of SQLAlchemyRené 'Necoro' Neumann5-121/+96 2016-08-16FixRené 'Necoro' Neumann1-1/+1 2016-08-16Use current setuputils flowRené 'Necoro' Neumann2-0/+17 2016-08-16Basic CLIRené 'Necoro' Neumann3-0/+33 2016-08-15Initial model and sqlalchemy setupRené 'Necoro' Neumann3-0/+104