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