Releasing 2.0 beta 5.

This commit is contained in:
Federico Di Gregorio 2005-10-18 14:44:57 +00:00
parent 8d4607ebbd
commit 49a255059e
5 changed files with 27 additions and 24 deletions

View File

@ -2,6 +2,11 @@
* 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>
* NOTIFY is back end working.

2
NEWS
View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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;