Ejemplo n.º 1
0
 def dbSelect(self, table=None, listColumns=None):
     db = backbone.get_db()
     listSelection = ", ".join(listColumns)
     try:
         cur = db.execute('SELECT ' + listSelection + ' from ' + table)
         results = cur.fetchall()
     except:
         results = ["Incorrect Column"]
     # return render_template('home.html', labels=labels, results=results, list=list)
     return (results)
Ejemplo n.º 2
0
 def __init__(self):
     nn = "NOT NULL"
     self.tableNames = ['Bill', 'dbNames', 'cows']
     self.id = {'id' : 'Integer PRIMARY KEY autoincrement'}
     self.name = {'name': ' varchar(75) ' + nn}
     self.creationDate = {'dateCreated' : 'DATE'}
     self.lastName = {'LastName','varchar(255) ' + nn}
     self.fistName = {'FirstName','varchar(255) ' + nn}
     self.address = {'Address', 'varchar(255) ' + nn}
     self.city = {'City', 'varchar(255) ' + nn}
     self.feed = backbone.get_db()
Ejemplo n.º 3
0
    def __init__(self):
        ''' Takes the URL Query request, compares to our static dict, and looks through our database '''
        ''' {Table Name: Code Name found through URL Query } '''
        self.tableNames = {'Bill':'billing', 'cows':'test', 'queryTableNames':'d'}

        ''' Same thing here, URL Query to predetermined dict, compares and continues to database '''
        self.operatorList = {'SELECT':'view', 'CREATE':'insert','DROP':'delete','UPDATE':'update'}

        ''' Let's put our database connection on standby'''
        self.feed = backbone.get_db()

        self.default = {}
Ejemplo n.º 4
0
    def dbSelectForResults(self, table=None, operator=None, searchColumns="*"):
        db = backbone.get_db()
        listSelection = ", ".join(searchColumns)

        try:
            cur = db.execute(operator + ' ' + listSelection + ' FROM ' + table)

            return cur.fetchall()

        except:

            self.default = {"No Results found or error with operator": False}