mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-10-31 07:47:30 +03:00 
			
		
		
		
	Check server_version before using lo_*64 functions. If less tahn 9.3 old none 64bit functions will be use.
This commit is contained in:
		
							parent
							
								
									cd67d3d2fe
								
							
						
					
					
						commit
						e5bbde9554
					
				|  | @ -390,7 +390,11 @@ lobject_seek(lobjectObject *self, long pos, int whence) | ||||||
|     pthread_mutex_lock(&(self->conn->lock)); |     pthread_mutex_lock(&(self->conn->lock)); | ||||||
| 
 | 
 | ||||||
| #if HAVE_LO64 | #if HAVE_LO64 | ||||||
|  |     if (self->conn->server_version < 90300) { | ||||||
|  |         where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence); | ||||||
|  |     } else { | ||||||
|         where = lo_lseek64(self->conn->pgconn, self->fd, pos, whence); |         where = lo_lseek64(self->conn->pgconn, self->fd, pos, whence); | ||||||
|  |     } | ||||||
| #else | #else | ||||||
|     where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence); |     where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence); | ||||||
| #endif | #endif | ||||||
|  | @ -421,7 +425,11 @@ lobject_tell(lobjectObject *self) | ||||||
|     pthread_mutex_lock(&(self->conn->lock)); |     pthread_mutex_lock(&(self->conn->lock)); | ||||||
| 
 | 
 | ||||||
| #if HAVE_LO64 | #if HAVE_LO64 | ||||||
|  |     if (self->conn->server_version < 90300) { | ||||||
|  |         where = (long)lo_tell(self->conn->pgconn, self->fd); | ||||||
|  |     } else { | ||||||
|         where = lo_tell64(self->conn->pgconn, self->fd); |         where = lo_tell64(self->conn->pgconn, self->fd); | ||||||
|  |     } | ||||||
| #else | #else | ||||||
|     where = (long)lo_tell(self->conn->pgconn, self->fd); |     where = (long)lo_tell(self->conn->pgconn, self->fd); | ||||||
| #endif | #endif | ||||||
|  | @ -482,7 +490,11 @@ lobject_truncate(lobjectObject *self, size_t len) | ||||||
|     pthread_mutex_lock(&(self->conn->lock)); |     pthread_mutex_lock(&(self->conn->lock)); | ||||||
| 
 | 
 | ||||||
| #if HAVE_LO64 | #if HAVE_LO64 | ||||||
|  |     if (self->conn->server_version < 90300) { | ||||||
|  |         retvalue = lo_truncate(self->conn->pgconn, self->fd, len); | ||||||
|  |     } else { | ||||||
|         retvalue = lo_truncate64(self->conn->pgconn, self->fd, len); |         retvalue = lo_truncate64(self->conn->pgconn, self->fd, len); | ||||||
|  |     } | ||||||
| #else | #else | ||||||
|     retvalue = lo_truncate(self->conn->pgconn, self->fd, len); |     retvalue = lo_truncate(self->conn->pgconn, self->fd, len); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user