mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 01:37:31 +03:00 
			
		
		
		
	Merge branch 'pull-507'
This commit is contained in:
		
						commit
						75747606d3
					
				| 
						 | 
					@ -139,7 +139,18 @@ static int pthread_mutex_init(pthread_mutex_t *mutex, void* fake)
 | 
				
			||||||
	: ((_fpclass(x) == _FPCLASS_NINF) ? -1 : 0))
 | 
						: ((_fpclass(x) == _FPCLASS_NINF) ? -1 : 0))
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#define strcasecmp(x, y) lstrcmpi(x, y)
 | 
					#define strcasecmp(x, y) lstrcmpi(x, y)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef __int8              int8_t;
 | 
				
			||||||
 | 
					typedef __int16             int16_t;
 | 
				
			||||||
 | 
					typedef __int32             int32_t;
 | 
				
			||||||
 | 
					typedef __int64             int64_t;
 | 
				
			||||||
 | 
					typedef unsigned __int8     uint8_t;
 | 
				
			||||||
 | 
					typedef unsigned __int16    uint16_t;
 | 
				
			||||||
 | 
					typedef unsigned __int32    uint32_t;
 | 
				
			||||||
 | 
					typedef unsigned __int64    uint64_t;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "win32_support.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* what's this, we have no round function either? */
 | 
					/* what's this, we have no round function either? */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -482,7 +482,7 @@ pq_begin_locked(connectionObject *conn, PGresult **pgres, char **error,
 | 
				
			||||||
                PyThreadState **tstate)
 | 
					                PyThreadState **tstate)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const size_t bufsize = 256;
 | 
					    const size_t bufsize = 256;
 | 
				
			||||||
    char buf[bufsize];
 | 
					    char buf[256];  /* buf size must be same as bufsize */
 | 
				
			||||||
    int result;
 | 
					    int result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Dprintf("pq_begin_locked: pgconn = %p, autocommit = %d, status = %d",
 | 
					    Dprintf("pq_begin_locked: pgconn = %p, autocommit = %d, status = %d",
 | 
				
			||||||
| 
						 | 
					@ -1786,7 +1786,7 @@ pq_copy_both(replicationCursorObject *repl, PyObject *consume, double keepalive_
 | 
				
			||||||
    CLEARPGRES(curs->pgres);
 | 
					    CLEARPGRES(curs->pgres);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    keep_intr.tv_sec  = (int)keepalive_interval;
 | 
					    keep_intr.tv_sec  = (int)keepalive_interval;
 | 
				
			||||||
    keep_intr.tv_usec = (keepalive_interval - keep_intr.tv_sec)*1.0e6;
 | 
					    keep_intr.tv_usec = (long)((keepalive_interval - keep_intr.tv_sec)*1.0e6);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while (1) {
 | 
					    while (1) {
 | 
				
			||||||
        if (pq_read_replication_message(repl, &msg) < 0) {
 | 
					        if (pq_read_replication_message(repl, &msg) < 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@
 | 
				
			||||||
   src/port/gettimeofday.c in PostgreSQL core */
 | 
					   src/port/gettimeofday.c in PostgreSQL core */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* FILETIME of Jan 1 1970 00:00:00. */
 | 
					/* FILETIME of Jan 1 1970 00:00:00. */
 | 
				
			||||||
static const unsigned __int64 epoch = 116444736000000000ULL;
 | 
					static const unsigned __int64 epoch = ((unsigned __int64) 116444736000000000ULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * timezone information is stored outside the kernel so tzp isn't used anymore.
 | 
					 * timezone information is stored outside the kernel so tzp isn't used anymore.
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ static const unsigned __int64 epoch = 116444736000000000ULL;
 | 
				
			||||||
 * elapsed_time().
 | 
					 * elapsed_time().
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
gettimeofday(struct timeval * tp, struct timezone * tzp)
 | 
					gettimeofday(struct timeval * tp, void * tzp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    FILETIME	file_time;
 | 
					    FILETIME	file_time;
 | 
				
			||||||
    SYSTEMTIME	system_time;
 | 
					    SYSTEMTIME	system_time;
 | 
				
			||||||
| 
						 | 
					@ -60,17 +60,30 @@ gettimeofday(struct timeval * tp, struct timezone * tzp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* timeradd missing on MS VC */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					timeradd(struct timeval *a, struct timeval *b, struct timeval *c)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  c->tv_sec = a->tv_sec + b->tv_sec;
 | 
				
			||||||
 | 
					  c->tv_usec = a->tv_usec + b->tv_usec;
 | 
				
			||||||
 | 
					  if(c->tv_usec >= 1000000L) {
 | 
				
			||||||
 | 
					    c->tv_usec -= 1000000L;
 | 
				
			||||||
 | 
					    c->tv_sec += 1;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
#endif /* !defined(__MINGW32__) */
 | 
					#endif /* !defined(__MINGW32__) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* timersub is missing on mingw */
 | 
					/* timersub is missing on mingw & MS VC */
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
timersub(struct timeval *a, struct timeval *b, struct timeval *c)
 | 
					timersub(struct timeval *a, struct timeval *b, struct timeval *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    c->tv_sec  = a->tv_sec  - b->tv_sec;
 | 
					    c->tv_sec  = a->tv_sec  - b->tv_sec;
 | 
				
			||||||
    c->tv_usec = a->tv_usec - b->tv_usec;
 | 
					    c->tv_usec = a->tv_usec - b->tv_usec;
 | 
				
			||||||
    if (tv_usec < 0) {
 | 
					    if (c->tv_usec < 0) {
 | 
				
			||||||
        c->tv_usec += 1000000;
 | 
					        c->tv_usec += 1000000;
 | 
				
			||||||
        c->tv_sec  -= 1;
 | 
					        c->tv_sec  -= 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* defined(_WIN32) */
 | 
					#endif /* defined(_WIN32) */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,18 +23,26 @@
 | 
				
			||||||
 * License for more details.
 | 
					 * License for more details.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#ifndef PSYCOPG_WIN32_SUPPORT_H
 | 
					#ifndef PSYCOPG_WIN32_SUPPORT_H
 | 
				
			||||||
#define PSYCOPG_WIN32_SUPPORT_H 1
 | 
					#define PSYCOPG_WIN32_SUPPORT_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "psycopg/config.h"
 | 
					#include "psycopg/config.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef __MINGW32__
 | 
				
			||||||
#include <sys/time.h>
 | 
					#include <sys/time.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef _WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
#ifndef __MINGW32__
 | 
					#ifndef __MINGW32__
 | 
				
			||||||
HIDDEN int gettimeofday(struct timeval * tp, struct timezone * tzp);
 | 
					extern HIDDEN int gettimeofday(struct timeval * tp, void * tzp);
 | 
				
			||||||
 | 
					extern HIDDEN void timeradd(struct timeval *a, struct timeval *b, struct timeval *c);
 | 
				
			||||||
 | 
					#elif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HIDDEN void timersub(struct timeval *a, struct timeval *b, struct timeval *c);
 | 
					extern HIDDEN void timersub(struct timeval *a, struct timeval *b, struct timeval *c);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* !defined(PSYCOPG_WIN32_SUPPORT_H) */
 | 
					#endif /* !defined(PSYCOPG_WIN32_SUPPORT_H) */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user