Skip to content

Commit 263db2e

Browse files
author
Hiroshi Inoue
committed
Make NAMEDATALEN changeable at compile time.
1 parent 87c9636 commit 263db2e

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/interfaces/odbc/connection.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,11 @@ CC_connect(ConnectionClass *self, char password_req, char *salt_para)
645645
ci->drivers.ksqo,
646646
ci->drivers.unique_index,
647647
ci->drivers.use_declarefetch);
648-
qlog(" text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d\n",
648+
qlog(" text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d NAMEDATALEN=%d\n",
649649
ci->drivers.text_as_longvarchar,
650650
ci->drivers.unknowns_as_longvarchar,
651-
ci->drivers.bools_as_char);
651+
ci->drivers.bools_as_char,
652+
MAX_TABLE_LEN);
652653

653654
#ifdef MULTIBYTE
654655
encoding = check_client_encoding(ci->conn_settings);
@@ -728,7 +729,7 @@ CC_connect(ConnectionClass *self, char password_req, char *salt_para)
728729
SOCK_put_int(sock, htonl(4 + sizeof(StartupPacket6_2)), 4);
729730
sp62.authtype = htonl(NO_AUTHENTICATION);
730731
strncpy(sp62.database, ci->database, PATH_SIZE);
731-
strncpy(sp62.user, ci->username, NAMEDATALEN);
732+
strncpy(sp62.user, ci->username, USRNAMEDATALEN);
732733
SOCK_put_n_char(sock, (char *) &sp62, sizeof(StartupPacket6_2));
733734
SOCK_flush_output(sock);
734735
}

src/interfaces/odbc/connection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ typedef enum
9494
#define NO_AUTHENTICATION 7
9595
#define PATH_SIZE 64
9696
#define ARGV_SIZE 64
97-
#define NAMEDATALEN 16
97+
#define USRNAMEDATALEN 16
9898

9999
typedef unsigned int ProtocolVersion;
100100

@@ -120,7 +120,7 @@ typedef struct _StartupPacket6_2
120120
{
121121
unsigned int authtype;
122122
char database[PATH_SIZE];
123-
char user[NAMEDATALEN];
123+
char user[USRNAMEDATALEN];
124124
char options[ARGV_SIZE];
125125
char execfile[ARGV_SIZE];
126126
char tty[PATH_SIZE];

src/interfaces/odbc/psqlodbc.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Comments: See "notice.txt" for copyright and license information.
77
*
8-
* $Id: psqlodbc.h,v 1.68 2002/06/28 02:44:15 inoue Exp $
8+
* $Id: psqlodbc.h,v 1.69 2002/07/11 01:52:46 inoue Exp $
99
*
1010
*/
1111

@@ -27,6 +27,10 @@
2727
#define ODBCVER 0x0250
2828
#endif /* ODBCVER_REP */
2929

30+
#ifndef NAMEDATALEN
31+
#define NAMEDATALEN 32
32+
#endif /* NAMEDATALEN */
33+
3034

3135
#if defined(WIN32) || defined(WITH_UNIXODBC) || defined(WITH_IODBC)
3236
#include <sql.h>
@@ -124,9 +128,9 @@ typedef UInt4 Oid;
124128
#define BYTELEN 8
125129
#define VARHDRSZ sizeof(Int4)
126130

127-
#define MAX_SCHEMA_LEN 32
128-
#define MAX_TABLE_LEN 32
129-
#define MAX_COLUMN_LEN 32
131+
#define MAX_SCHEMA_LEN NAMEDATALEN
132+
#define MAX_TABLE_LEN NAMEDATALEN
133+
#define MAX_COLUMN_LEN NAMEDATALEN
130134
#define MAX_CURSOR_LEN 32
131135

132136
/* Registry length limits */
@@ -239,7 +243,7 @@ void logs_on_off(int cnopen, int, int);
239243
#define TEXT_FIELD_SIZE 8190 /* size of text fields
240244
* (not including null
241245
* term) */
242-
#define NAME_FIELD_SIZE 32 /* size of name fields */
246+
#define NAME_FIELD_SIZE NAMEDATALEN /* size of name fields */
243247
#define MAX_VARCHAR_SIZE 254 /* maximum size of a varchar (not
244248
* including null term) */
245249

0 commit comments

Comments
 (0)