Example #1
0
    def save(self):
        if self._post_id:
            self.update(self)
        else:
            try:
                insert = InsertBuilder()
                insert.setStatement('insert into posts (user_id, post, lat, lng)')
                insert.setValues('values ("1", "' + self._post + '" , "44.34567", "-66.78945")')
                self._db.execute(insert);
            except:
                print "Could not insert record"

            self.notify()
Example #2
0
 def save(self):
     
     if self._comment_id:
         self.update(self)
     else:
         try:
             insert = InsertBuilder()
             insert.setStatement('insert into comments (user_id, post_id, comment)')
             insert.setValues('values ("' + self._user_id + '", "' + self._post_id + '" , "' + self._comment +'")')
             self._db.execute(insert);
         except:
             print "Could not insert record"
             
     self.notify()
Example #3
0
d = Database('pannell', 'pannell',  'B00609201', 'db.cs.dal.ca')

d.connect()

print d.database_handle

select = SelectBuilder()

select.setStatement('select *')

print select.getStatement()

select.setTables('from users')

print select.getTables()

users = d.execute(select)
    
while True:
  record = users.fetch_row()
  if not record: break
  print record


insert = InsertBuilder()

insert.setStatement('insert into users (user_name, password, role) values ("p2p2p2", "4321", "normal")')

result = d.execute(insert)