BUG in PgODBC found/fixed (win32)

From: "Sam O'Connor" <Sam(at)OConnor(dot)net>
To: pgsql-interfaces(at)postgreSQL(dot)org
Subject: BUG in PgODBC found/fixed (win32)
Date: 1999-10-23 22:10:58
Message-ID: 38123272.955C19B9@OConnor.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-sql

The lo id is currently stored in the parameter EXEC_buffer pointer
with a cast, and is pulled out again later when it is needed.
Bit of a hack but it works.
Later on if EXEC_buffer is not NULL it is freed. Opps.
The fix is just to check for type SQL_LONGVARBINARY before
doing the deallocation.

I'm not sure who the current maintainer is, I've just been happily using
the stuff recently without having to do any work on it. Yey :)
Should I just be putting fixes like this straight into CVS?
If so where can I get access.

- Sam

BTW. Is anyone else using postgres large objects through ODBC in
windows?

Here are some diffs:

diff -c -r pgodbc_vendor/bind.c pgodbc/bind.c
*** pgodbc_vendor/bind.c Fri Jan 08 10:32:46 1999
--- pgodbc/bind.c Sat Oct 23 13:08:50 1999
***************
*** 123,131 ****
stmt->parameters[ipar].EXEC_used = NULL;
}

! if (stmt->parameters[ipar].EXEC_buffer) {
! free(stmt->parameters[ipar].EXEC_buffer);
stmt->parameters[ipar].EXEC_buffer = NULL;
}

/* Data at exec macro only valid for C char/binary data */
--- 123,135 ----
stmt->parameters[ipar].EXEC_used = NULL;
}

! if ( stmt->parameters[ipar].SQLType == SQL_LONGVARBINARY) {
stmt->parameters[ipar].EXEC_buffer = NULL;
+ } else {
+ if (stmt->parameters[ipar].EXEC_buffer) {
+ free(stmt->parameters[ipar].EXEC_buffer);
+ stmt->parameters[ipar].EXEC_buffer = NULL;
+ }
}

/* Data at exec macro only valid for C char/binary data */
diff -c -r pgodbc_vendor/statement.c pgodbc/statement.c
*** pgodbc_vendor/statement.c Thu Sep 02 22:08:04 1999
--- pgodbc/statement.c Sat Oct 23 13:07:24 1999
***************
*** 326,334 ****
self->parameters[i].EXEC_used = NULL;
}

! if (self->parameters[i].EXEC_buffer) {
! free(self->parameters[i].EXEC_buffer);
self->parameters[i].EXEC_buffer = NULL;
}
}
}
--- 326,338 ----
self->parameters[i].EXEC_used = NULL;
}

! if ( self->parameters[i].SQLType == SQL_LONGVARBINARY) {
self->parameters[i].EXEC_buffer = NULL;
+ } else {
+ if (self->parameters[i].EXEC_buffer) {
+ free(self->parameters[i].EXEC_buffer);
+ self->parameters[i].EXEC_buffer = NULL;
+ }
}
}
}

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Martin Weinberg 1999-10-24 12:16:12 Re: [GENERAL] Re: Errors in Postgres
Previous Message Hans Matzen 1999-10-23 18:47:24 pgaccess - Print Reports

Browse pgsql-sql by date

  From Date Subject
Next Message Albert REINER 1999-10-24 15:18:46 Re: [SQL] Can VACUUM, but cannot do VACUUM ANALYZE
Previous Message Tom Lane 1999-10-23 16:42:00 Re: [SQL] sum-function