예제 #1
0
 def test_date_time_allocation_bug(self):
     d1 = psycopg2.Date(2002,12,25)
     d2 = psycopg2.DateFromTicks(time.mktime((2002,12,25,0,0,0,0,0,0)))
     t1 = psycopg2.Time(13,45,30)
     t2 = psycopg2.TimeFromTicks(time.mktime((2001,1,1,13,45,30,0,0,0)))
     t1 = psycopg2.Timestamp(2002,12,25,13,45,30)
     t2 = psycopg2.TimestampFromTicks(
         time.mktime((2002,12,25,13,45,30,0,0,0)))
예제 #2
0
    def write_data(self, data):
        s1 = 'kb_table'
        s2 = '(field_team_id, field_team_name, field_team_skill, field_team_location, field_team_freq, time)'
        t = time.localtime()
        t = psycopg2.Time(t[3], t[4], t[4])

        self.cur.execute(
            """INSERT INTO %s %s VALUES (%s, %s, %s, %s, %s, %s, %s);""" %
            (s1, s2, data[0], data[1], data[2], data[3], data[4]), t)

        self.conn.commit()
예제 #3
0
    def write_data(self, data):
        s1 = 'geolocation_table'
        s2 = '(hist_box1_c1, hist_box1_c2, hist_box2_c1, hist_box2_c2, hist_box3_c1, hist_box3_c2, guess, time)'
        t = time.localtime()
        t = psycopg2.Time(t[3], t[4], t[4])

        self.cur.execute(
            """INSERT INTO %s %s VALUES (%s, %s, %s, %s, %s, %s, %s, %s);""" %
            (s1, s2, data[0], data[1], data[2], data[3], data[4], data[5],
             data[6], t))

        self.conn.commit()
예제 #4
0
 def GetDateAndTimeForPostgresql(self, dateAndTime):
     timeNum = self.GetDateAndTime(dateAndTime)
     date = psycopg2.Date(timeNum[0], timeNum[1], timeNum[2])
     time = psycopg2.Time(timeNum[3], 0, 0)
     return [date, time]