X-Git-Url: https://git.jsancho.org/?p=mojodb.git;a=blobdiff_plain;f=dbutils.py;fp=dbutils.py;h=2eb459e65d92c9e5f7cd3278c1d5ae02b5b3aa8d;hp=0000000000000000000000000000000000000000;hb=aa509ddc8574e0a5220c94a2b72f4d5a798d6e8a;hpb=2c1872fd5004c8464e146081b61783de47b87e2d diff --git a/dbutils.py b/dbutils.py new file mode 100644 index 0000000..2eb459e --- /dev/null +++ b/dbutils.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# mojo, a Python library for implementing document based databases +# Copyright (C) 2013-2014 by Javier Sancho Fernandez +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +class SQLGeneric(object): + def sql(self): + return "" + + +class Query(SQLGeneric): + def __init__(self, fields, tables, constraints): + self.fields = fields + self.tables = tables + self.constraints = constraints + + +class Field(SQLGeneric): + def __init__(self, table, field_name): + self.table = table + self.field_name = field_name + + +class Table(SQLGeneric): + def __init__(self, db_name, table_name): + self.db_name = db_name + self.table_name = table_name + + +class Constraint(SQLGeneric): + def __init__(self, operator, *args): + self.operator = operator + self.args = args + +class Literal(SQLGeneric): + def __init__(self, value): + self.value = value