mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Update odbc driver to current version V.0244
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
|
||||
/* Module: columninfo.c
|
||||
*
|
||||
* Description: This module contains routines related to
|
||||
* reading and storing the field information from a query.
|
||||
*
|
||||
* Classes: ColumnInfoClass (Functions prefix: "CI_")
|
||||
*
|
||||
* API functions: none
|
||||
*
|
||||
* Comments: See "notice.txt" for copyright and license information.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "columninfo.h"
|
||||
/* Module: columninfo.c
|
||||
*
|
||||
* Description: This module contains routines related to
|
||||
* reading and storing the field information from a query.
|
||||
*
|
||||
* Classes: ColumnInfoClass (Functions prefix: "CI_")
|
||||
*
|
||||
* API functions: none
|
||||
*
|
||||
* Comments: See "notice.txt" for copyright and license information.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "columninfo.h"
|
||||
#include "socket.h"
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
@@ -29,6 +29,7 @@ ColumnInfoClass *rv;
|
||||
rv->name = NULL;
|
||||
rv->adtid = NULL;
|
||||
rv->adtsize = NULL;
|
||||
rv->display_size = NULL;
|
||||
}
|
||||
|
||||
return rv;
|
||||
@@ -54,7 +55,7 @@ int new_num_fields;
|
||||
Oid new_adtid;
|
||||
Int2 new_adtsize;
|
||||
char new_field_name[MAX_MESSAGE_LEN+1];
|
||||
|
||||
|
||||
|
||||
/* at first read in the number of fields that are in the query */
|
||||
new_num_fields = (Int2) SOCK_get_int(sock, sizeof(Int2));
|
||||
@@ -93,11 +94,12 @@ int num_fields = self->num_fields;
|
||||
if( self->name[lf])
|
||||
free (self->name[lf]);
|
||||
}
|
||||
|
||||
|
||||
/* Safe to call even if null */
|
||||
free(self->name);
|
||||
free(self->adtid);
|
||||
free(self->adtsize);
|
||||
free(self->display_size);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -110,6 +112,7 @@ CI_set_num_fields(ColumnInfoClass *self, int new_num_fields)
|
||||
self->name = (char **) malloc (sizeof(char *) * self->num_fields);
|
||||
self->adtid = (Oid *) malloc (sizeof(Oid) * self->num_fields);
|
||||
self->adtsize = (Int2 *) malloc (sizeof(Int2) * self->num_fields);
|
||||
self->display_size = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -126,34 +129,7 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
|
||||
self->name[field_num] = strdup(new_name);
|
||||
self->adtid[field_num] = new_adtid;
|
||||
self->adtsize[field_num] = new_adtsize;
|
||||
}
|
||||
|
||||
char *
|
||||
CI_get_fieldname(ColumnInfoClass *self, Int2 which)
|
||||
{
|
||||
char *rv = NULL;
|
||||
|
||||
if ( ! self->name)
|
||||
return NULL;
|
||||
|
||||
if ((which >= 0) && (which < self->num_fields))
|
||||
rv = self->name[which];
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Int2
|
||||
CI_get_fieldsize(ColumnInfoClass *self, Int2 which)
|
||||
{
|
||||
Int2 rv = 0;
|
||||
|
||||
if ( ! self->adtsize)
|
||||
return 0;
|
||||
|
||||
if ((which >= 0) && (which < self->num_fields))
|
||||
rv = self->adtsize[which];
|
||||
|
||||
return rv;
|
||||
|
||||
self->display_size[field_num] = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user