Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
baeb8790
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
baeb8790
编写于
11月 10, 1997
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix case issues with quotes.
上级
0f367cf8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
106 addition
and
72 deletion
+106
-72
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+42
-39
src/include/c.h
src/include/c.h
+4
-4
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+39
-26
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+21
-3
未找到文件。
src/backend/postmaster/postmaster.c
浏览文件 @
baeb8790
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.6
0 1997/11/07 20:51:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.6
1 1997/11/10 05:10:21
momjian Exp $
*
* NOTES
*
...
...
@@ -131,8 +131,8 @@ static char *progname = (char *) NULL;
*/
static
char
Execfile
[
MAXPATHLEN
]
=
""
;
static
int
ServerSock_INET
=
INVALID_SOCK
;
/* stream socket server */
static
int
ServerSock_UNIX
=
INVALID_SOCK
;
/* stream socket server */
static
int
ServerSock_INET
=
INVALID_SOCK
;
/* stream socket server */
static
int
ServerSock_UNIX
=
INVALID_SOCK
;
/* stream socket server */
/*
* Set by the -o option
...
...
@@ -149,8 +149,8 @@ static char ExtraOptions[ARGV_SIZE] = "";
static
int
Reinit
=
1
;
static
int
SendStop
=
0
;
static
int
NetServer
=
0
;
/* if not zero, postmaster listen for
non-local connections */
static
int
NetServer
=
0
;
/* if not zero, postmaster listen for
*
non-local connections */
static
int
MultiplexedBackends
=
0
;
static
int
MultiplexedBackendPort
;
...
...
@@ -318,8 +318,8 @@ PostmasterMain(int argc, char *argv[])
else
DebugLvl
=
1
;
break
;
case
'i'
:
NetServer
=
1
;
case
'i'
:
NetServer
=
1
;
break
;
case
'm'
:
MultiplexedBackends
=
1
;
...
...
@@ -394,15 +394,15 @@ PostmasterMain(int argc, char *argv[])
}
if
(
NetServer
)
{
status
=
StreamServerPort
(
hostName
,
PostPortName
,
&
ServerSock_INET
);
if
(
status
!=
STATUS_OK
)
{
fprintf
(
stderr
,
"%s: cannot create INET stream port
\n
"
,
progname
);
exit
(
1
);
}
}
{
status
=
StreamServerPort
(
hostName
,
PostPortName
,
&
ServerSock_INET
);
if
(
status
!=
STATUS_OK
)
{
fprintf
(
stderr
,
"%s: cannot create INET stream port
\n
"
,
progname
);
exit
(
1
);
}
}
status
=
StreamServerPort
(
NULL
,
PostPortName
,
&
ServerSock_UNIX
);
if
(
status
!=
STATUS_OK
)
{
...
...
@@ -487,11 +487,13 @@ usage(const char *progname)
static
int
ServerLoop
(
void
)
{
fd_set
rmask
,
basemask
;
fd_set
rmask
,
basemask
;
int
nSockets
,
nSelected
,
status
,
oldFd
,
newFd
;
oldFd
,
newFd
;
Dlelem
*
next
,
*
curr
;
...
...
@@ -511,11 +513,11 @@ ServerLoop(void)
FD_SET
(
ServerSock_UNIX
,
&
basemask
);
nSockets
=
ServerSock_UNIX
;
if
(
ServerSock_INET
!=
INVALID_SOCK
)
{
FD_SET
(
ServerSock_INET
,
&
basemask
);
if
(
ServerSock_INET
>
ServerSock_UNIX
)
nSockets
=
ServerSock_INET
;
}
{
FD_SET
(
ServerSock_INET
,
&
basemask
);
if
(
ServerSock_INET
>
ServerSock_UNIX
)
nSockets
=
ServerSock_INET
;
}
nSockets
++
;
#ifdef HAVE_SIGPROCMASK
...
...
@@ -563,14 +565,14 @@ ServerLoop(void)
/* new connection pending on our well-known port's socket */
oldFd
=
-
1
;
if
(
FD_ISSET
(
ServerSock_UNIX
,
&
rmask
))
oldFd
=
ServerSock_UNIX
;
else
if
(
ServerSock_INET
!=
INVALID_SOCK
&&
FD_ISSET
(
ServerSock_INET
,
&
rmask
))
oldFd
=
ServerSock_INET
;
if
(
FD_ISSET
(
ServerSock_UNIX
,
&
rmask
))
oldFd
=
ServerSock_UNIX
;
else
if
(
ServerSock_INET
!=
INVALID_SOCK
&&
FD_ISSET
(
ServerSock_INET
,
&
rmask
))
oldFd
=
ServerSock_INET
;
if
(
oldFd
>=
0
)
{
/*
* connect and make an addition to PortList. If the
* connection dies and we notice it, just forget about the
...
...
@@ -587,9 +589,9 @@ ServerLoop(void)
progname
,
newFd
);
}
else
if
(
DebugLvl
)
fprintf
(
stderr
,
"%s: ServerLoop: connect failed: (%d) %s
\n
"
,
progname
,
errno
,
strerror
(
errno
));
fprintf
(
stderr
,
"%s: ServerLoop: connect failed: (%d) %s
\n
"
,
progname
,
errno
,
strerror
(
errno
));
--
nSelected
;
FD_CLR
(
oldFd
,
&
rmask
);
}
...
...
@@ -823,7 +825,7 @@ ConnStartup(Port *port, int *status,
static
void
send_error_reply
(
Port
*
port
,
const
char
*
errormsg
)
{
int
rc
;
/* return code from write */
int
rc
;
/* return code from write */
char
*
reply
;
/*
...
...
@@ -1299,8 +1301,10 @@ ExitPostmaster(int status)
* Not sure of the semantics here. When the Postmaster dies, should
* the backends all be killed? probably not.
*/
if
(
ServerSock_INET
!=
INVALID_SOCK
)
close
(
ServerSock_INET
);
if
(
ServerSock_UNIX
!=
INVALID_SOCK
)
close
(
ServerSock_UNIX
);
if
(
ServerSock_INET
!=
INVALID_SOCK
)
close
(
ServerSock_INET
);
if
(
ServerSock_UNIX
!=
INVALID_SOCK
)
close
(
ServerSock_UNIX
);
exitpg
(
status
);
}
...
...
@@ -1315,10 +1319,9 @@ dumpstatus(SIGNAL_ARGS)
fprintf
(
stderr
,
"%s: dumpstatus:
\n
"
,
progname
);
fprintf
(
stderr
,
"
\t
sock %d: nBytes=%d, laddr=0x%lx, raddr=0x%lx
\n
"
,
port
->
sock
,
port
->
nBytes
,
(
long
int
)
port
->
laddr
.
in
.
sin_addr
.
s_addr
,
(
long
int
)
port
->
raddr
.
in
.
sin_addr
.
s_addr
);
port
->
sock
,
port
->
nBytes
,
(
long
int
)
port
->
laddr
.
in
.
sin_addr
.
s_addr
,
(
long
int
)
port
->
raddr
.
in
.
sin_addr
.
s_addr
);
curr
=
DLGetSucc
(
curr
);
}
}
src/include/c.h
浏览文件 @
baeb8790
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.2
6 1997/10/30 23:36:56
momjian Exp $
* $Id: c.h,v 1.2
7 1997/11/10 05:10:34
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -697,8 +697,8 @@ typedef struct Exception
#define INT_ALIGN_MASK (sizeof(int32) - 1)
/* This function gets call too often, so we inline it if we can */
#define MemSet(start, val, len)
do \
{
/* are we aligned for int32? */
\
#define MemSet(start, val, len)
do \
{
/* are we aligned for int32? */
\
/* We have to cast the pointer to int \
so we can do the AND */
\
if (((int)(start) & INT_ALIGN_MASK) == 0 && \
...
...
@@ -707,7 +707,7 @@ typedef struct Exception
/* \
* We got this number by testing this \
* against the stock memset() on \
* bsd/os 3.0.
Larger values were \
* bsd/os 3.0.
Larger values were \
* slower. \
*/
\
(len) <= 64) \
...
...
src/interfaces/libpq/fe-connect.c
浏览文件 @
baeb8790
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.4
3 1997/11/07 20:52:1
5 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.4
4 1997/11/10 05:10:4
5 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -340,8 +340,9 @@ PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const cha
if
(
!
pghost
||
pghost
[
0
]
==
'\0'
)
{
conn
->
pghost
=
NULL
;
if
(
tmp
=
getenv
(
"PGHOST"
))
conn
->
pghost
=
strdup
(
tmp
);
conn
->
pghost
=
NULL
;
if
(
tmp
=
getenv
(
"PGHOST"
))
conn
->
pghost
=
strdup
(
tmp
);
}
else
conn
->
pghost
=
strdup
(
pghost
);
...
...
@@ -413,14 +414,23 @@ PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const cha
{
if
(((
tmp
=
(
char
*
)
dbName
)
&&
(
dbName
[
0
]
!=
'\0'
))
||
((
tmp
=
getenv
(
"PGDATABASE"
))))
{
conn
->
dbName
=
strdup
(
tmp
);
}
else
conn
->
dbName
=
strdup
(
conn
->
pguser
);
for
(
i
=
0
;
conn
->
dbName
[
i
];
i
++
)
if
(
isupper
(
conn
->
dbName
[
i
]))
conn
->
dbName
[
i
]
=
tolower
(
conn
->
dbName
[
i
]);
/*
* if the table name is surrounded by double-quotes, then
* don't convert case
*/
if
(
*
conn
->
dbName
==
'"'
)
{
strcpy
(
conn
->
dbName
,
conn
->
dbName
+
1
);
*
(
conn
->
dbName
+
strlen
(
conn
->
dbName
)
-
1
)
=
'\0'
;
}
else
for
(
i
=
0
;
conn
->
dbName
[
i
];
i
++
)
if
(
isupper
(
conn
->
dbName
[
i
]))
conn
->
dbName
[
i
]
=
tolower
(
conn
->
dbName
[
i
]);
}
else
conn
->
dbName
=
NULL
;
...
...
@@ -470,7 +480,9 @@ connectDB(PGconn *conn)
MsgType
msgtype
;
int
laddrlen
=
sizeof
(
struct
sockaddr
);
Port
*
port
=
conn
->
port
;
int
portno
,
family
,
len
;
int
portno
,
family
,
len
;
/*
* Initialize the startup packet.
...
...
@@ -498,8 +510,8 @@ connectDB(PGconn *conn)
port
=
(
Port
*
)
malloc
(
sizeof
(
Port
));
MemSet
((
char
*
)
port
,
0
,
sizeof
(
Port
));
if
(
conn
->
pghost
&&
(
!
(
hp
=
gethostbyname
(
conn
->
pghost
))
||
hp
->
h_addrtype
!=
AF_INET
))
if
(
conn
->
pghost
&&
(
!
(
hp
=
gethostbyname
(
conn
->
pghost
))
||
hp
->
h_addrtype
!=
AF_INET
))
{
(
void
)
sprintf
(
conn
->
errorMessage
,
"connectDB() -- unknown hostname: %s
\n
"
,
...
...
@@ -510,17 +522,17 @@ connectDB(PGconn *conn)
portno
=
atoi
(
conn
->
pgport
);
port
->
raddr
.
in
.
sin_family
=
family
=
conn
->
pghost
?
AF_INET
:
AF_UNIX
;
if
(
family
==
AF_INET
)
{
memmove
((
char
*
)
&
(
port
->
raddr
.
in
.
sin_addr
),
(
char
*
)
hp
->
h_addr
,
hp
->
h_length
);
port
->
raddr
.
in
.
sin_port
=
htons
((
unsigned
short
)
(
portno
));
len
=
sizeof
(
struct
sockaddr_in
);
}
{
memmove
((
char
*
)
&
(
port
->
raddr
.
in
.
sin_addr
),
(
char
*
)
hp
->
h_addr
,
hp
->
h_length
);
port
->
raddr
.
in
.
sin_port
=
htons
((
unsigned
short
)
(
portno
));
len
=
sizeof
(
struct
sockaddr_in
);
}
else
{
len
=
UNIXSOCK_PATH
(
port
->
raddr
.
un
,
portno
);
}
{
len
=
UNIXSOCK_PATH
(
port
->
raddr
.
un
,
portno
);
}
/* connect to the server */
if
((
port
->
sock
=
socket
(
family
,
SOCK_STREAM
,
0
))
<
0
)
{
...
...
@@ -529,12 +541,12 @@ connectDB(PGconn *conn)
errno
,
strerror
(
errno
));
goto
connect_errReturn
;
}
if
(
connect
(
port
->
sock
,
(
struct
sockaddr
*
)
&
port
->
raddr
,
len
)
<
0
)
if
(
connect
(
port
->
sock
,
(
struct
sockaddr
*
)
&
port
->
raddr
,
len
)
<
0
)
{
(
void
)
sprintf
(
conn
->
errorMessage
,
"connectDB() failed: Is the postmaster running at '%s' on port '%s'?
\n
"
,
conn
->
pghost
?
conn
->
pghost
:
"UNIX Socket"
,
conn
->
pgport
);
"connectDB() failed: Is the postmaster running at '%s' on port '%s'?
\n
"
,
conn
->
pghost
?
conn
->
pghost
:
"UNIX Socket"
,
conn
->
pgport
);
goto
connect_errReturn
;
}
if
(
family
==
AF_INET
)
...
...
@@ -779,7 +791,8 @@ packetSend(Port *port,
PacketLen
len
,
bool
nonBlocking
)
{
PacketLen
doneLen
=
write
(
port
->
sock
,
buf
,
len
);
PacketLen
doneLen
=
write
(
port
->
sock
,
buf
,
len
);
if
(
doneLen
<
len
)
{
return
(
STATUS_ERROR
);
...
...
src/interfaces/libpq/fe-exec.c
浏览文件 @
baeb8790
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.
39 1997/11/03 04:21:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.
40 1997/11/10 05:10:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -17,6 +17,7 @@
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include "postgres.h"
#include "libpq/pqcomm.h"
#include "libpq/pqsignal.h"
...
...
@@ -31,12 +32,14 @@
#ifdef TIOCGWINSZ
struct
winsize
screen_size
;
#else
struct
winsize
{
int
ws_row
;
int
ws_col
;
}
screen_size
;
#endif
/* the rows array in a PGresGroup has to grow to accommodate the rows */
...
...
@@ -1674,6 +1677,7 @@ int
PQfnumber
(
PGresult
*
res
,
const
char
*
field_name
)
{
int
i
;
char
*
field_case
;
if
(
!
res
)
{
...
...
@@ -1686,13 +1690,27 @@ PQfnumber(PGresult *res, const char *field_name)
res
->
attDescs
==
NULL
)
return
-
1
;
field_case
=
strdup
(
field_name
);
if
(
*
field_case
==
'"'
)
{
strcpy
(
field_case
,
field_case
+
1
);
*
(
field_case
+
strlen
(
field_case
)
-
1
)
=
'\0'
;
}
else
for
(
i
=
0
;
field_case
;
i
++
)
if
(
isupper
(
field_case
[
i
]))
field_case
[
i
]
=
tolower
(
field_case
[
i
]);
for
(
i
=
0
;
i
<
res
->
numAttributes
;
i
++
)
{
if
(
strcasecmp
(
field_name
,
res
->
attDescs
[
i
].
name
)
==
0
)
if
(
strcmp
(
field_name
,
res
->
attDescs
[
i
].
name
)
==
0
)
{
free
(
field_case
);
return
i
;
}
}
free
(
field_case
);
return
-
1
;
}
Oid
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录