mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
Releasing 2.0 beta 5.
This commit is contained in:
parent
8d4607ebbd
commit
49a255059e
|
@ -1,6 +1,11 @@
|
|||
2005-10-19 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* Releasing 2.0 beta 5.
|
||||
|
||||
* psycopg/adapter_mxdatetime.c: reverted to old strftime method to format
|
||||
mx.DateTime objects; the new method didn't worked in some corner-cases.
|
||||
This makes impossible to have more than 2 decimal places for seconds but
|
||||
at least we get the time right every time.
|
||||
|
||||
2005-10-18 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
|
|
2
NEWS
2
NEWS
|
@ -1,8 +1,6 @@
|
|||
What's new in psycopg 2.0 beta 5
|
||||
--------------------------------
|
||||
|
||||
* First (and probably last) release candidate.
|
||||
|
||||
* Fixed all known bugs.
|
||||
|
||||
* The initial isolation level is now read from the server and
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# See the LICENSE file for details.
|
||||
|
||||
|
||||
ALLOWED_PSYCOPG_VERSIONS = ('2.0b2', '2.0b3')
|
||||
ALLOWED_PSYCOPG_VERSIONS = ('2.0b4', '2.0b5')
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
|
|
@ -18,7 +18,8 @@ DSN = 'dbname=test'
|
|||
|
||||
## don't modify anything below tis line (except for experimenting)
|
||||
|
||||
import sys, psycopg2
|
||||
import sys
|
||||
import psycopg2
|
||||
import mx.DateTime
|
||||
import datetime
|
||||
|
||||
|
@ -30,14 +31,13 @@ conn = psycopg2.connect(DSN)
|
|||
curs = conn.cursor()
|
||||
|
||||
try:
|
||||
curs.execute("""CREATE TABLE test_dt (k int4, d date, t time, dt timestamp,
|
||||
z interval)""")
|
||||
curs.execute("""CREATE TABLE test_dt (
|
||||
k int4, d date, t time, dt timestamp, z interval)""")
|
||||
except:
|
||||
conn.rollback()
|
||||
curs.execute("DROP TABLE test_dt")
|
||||
curs.execute("""CREATE TABLE test_dt (k int4,
|
||||
d date, t time, dt timestamp,
|
||||
z interval)""")
|
||||
curs.execute("""CREATE TABLE test_dt (
|
||||
k int4, d date, t time, dt timestamp, z interval)""")
|
||||
conn.commit()
|
||||
|
||||
# build and insert some data using mx.DateTime
|
||||
|
@ -48,6 +48,10 @@ mx1 = (
|
|||
mx.DateTime.Timestamp(2004, 10, 19, 0, 11, 17.5),
|
||||
mx.DateTime.DateTimeDelta(13, 15, 17, 59.9))
|
||||
|
||||
from psycopg2.extensions import adapt
|
||||
import psycopg2.extras
|
||||
print adapt(mx1)
|
||||
|
||||
print "Inserting mx.DateTime values..."
|
||||
curs.execute("INSERT INTO test_dt VALUES (%s, %s, %s, %s, %s)", mx1)
|
||||
|
||||
|
|
|
@ -45,30 +45,26 @@ mxdatetime_str(mxdatetimeObject *self)
|
|||
PyObject *res = NULL;
|
||||
char *buffer = NULL;
|
||||
|
||||
mxDateTimeObject *obj = (mxDateTimeObject*)self->wrapped;
|
||||
/* mxDateTimeObject *obj = (mxDateTimeObject*)self->wrapped; */
|
||||
|
||||
switch (self->type) {
|
||||
|
||||
case 0:
|
||||
asprintf(&buffer, "'%02d:%02d:%.6f'",
|
||||
(int)obj->hour, (int)obj->minute, (float)obj->second);
|
||||
if (buffer) res = PyString_FromString(buffer);
|
||||
case PSYCO_MXDATETIME_TIME:
|
||||
res = PyObject_CallMethod(self->wrapped, "strftime", "s",
|
||||
"'%H:%M:%S'");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
asprintf(&buffer, "'%ld-%02d-%02d'",
|
||||
obj->year, (int)obj->month, (int)obj->day);
|
||||
if (buffer) res = PyString_FromString(buffer);
|
||||
case PSYCO_MXDATETIME_DATE:
|
||||
res = PyObject_CallMethod(self->wrapped, "strftime", "s",
|
||||
"'%Y-%m-%d'");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
asprintf(&buffer, "'%ld-%02d-%02d %02d:%02d:%.6f'",
|
||||
obj->year, (int)obj->month, (int)obj->day,
|
||||
(int)obj->hour, (int)obj->minute, (float)obj->second);
|
||||
if (buffer) res = PyString_FromString(buffer);
|
||||
case PSYCO_MXDATETIME_TIMESTAMP:
|
||||
res = PyObject_CallMethod(self->wrapped, "strftime", "s",
|
||||
"'%Y-%m-%dT%H:%M:%S'");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case PSYCO_MXDATETIME_INTERVAL:
|
||||
res = PyObject_CallMethod(self->wrapped, "strftime", "s",
|
||||
"'%d:%H:%M:%S'");
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user