Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
46d7ae75
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,发现更多精彩内容 >>
提交
46d7ae75
编写于
8月 25, 2001
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add intended Array.java file that accidentally was patched into the
wrong directory.
上级
d39ec83c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
57 addition
and
59 deletion
+57
-59
src/backend/libpq/md5.c
src/backend/libpq/md5.c
+42
-44
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
+15
-15
未找到文件。
src/backend/libpq/md5.c
浏览文件 @
46d7ae75
...
...
@@ -24,10 +24,6 @@
* PRIVATE FUNCTIONS
*/
typedef
unsigned
char
unsigned8
;
typedef
unsigned
int
unsigned32
;
typedef
unsigned
long
unsigned64
;
#ifdef FRONTEND
#undef palloc
#define palloc malloc
...
...
@@ -39,13 +35,13 @@ typedef unsigned long unsigned64;
* The returned array is allocated using malloc. the caller should free it
* when it is no longer needed.
*/
static
u
nsigned
8
*
createPaddedCopyWithLength
(
u
nsigned8
*
b
,
unsigned
32
*
l
)
static
u
int
8
*
createPaddedCopyWithLength
(
u
int8
*
b
,
uint
32
*
l
)
{
u
nsigned
8
*
ret
;
u
nsigned
32
q
;
u
nsigned
32
len
,
newLen448
;
u
nsigned64
len64
;
u
int
8
*
ret
;
u
int
32
q
;
u
int
32
len
,
newLen448
;
u
int32
len_high
,
len_low
;
/* 64-bit value split into 32-bit sections */
len
=
((
b
==
NULL
)
?
0
:
*
l
);
newLen448
=
len
+
64
-
(
len
%
64
)
-
8
;
...
...
@@ -53,11 +49,11 @@ createPaddedCopyWithLength(unsigned8 *b, unsigned32 *l)
newLen448
+=
64
;
*
l
=
newLen448
+
8
;
if
((
ret
=
(
u
nsigned8
*
)
malloc
(
sizeof
(
unsigned
8
)
*
*
l
))
==
NULL
)
if
((
ret
=
(
u
int8
*
)
malloc
(
sizeof
(
uint
8
)
*
*
l
))
==
NULL
)
return
NULL
;
if
(
b
!=
NULL
)
memcpy
(
ret
,
b
,
sizeof
(
u
nsigned
8
)
*
len
);
memcpy
(
ret
,
b
,
sizeof
(
u
int
8
)
*
len
);
/* pad */
ret
[
len
]
=
0x80
;
...
...
@@ -65,24 +61,26 @@ createPaddedCopyWithLength(unsigned8 *b, unsigned32 *l)
ret
[
q
]
=
0x00
;
/* append length as a 64 bit bitcount */
len64
=
len
;
len64
<<=
3
;
len_low
=
len
;
/* split into two 32-bit values */
/* we only look at the bottom 32-bits */
len_high
=
len
>>
29
;
len_low
<<=
3
;
q
=
newLen448
;
ret
[
q
++
]
=
(
len64
&
0xFF
);
len64
>>=
8
;
ret
[
q
++
]
=
(
len64
&
0xFF
);
len64
>>=
8
;
ret
[
q
++
]
=
(
len64
&
0xFF
);
len64
>>=
8
;
ret
[
q
++
]
=
(
len64
&
0xFF
);
len64
>>=
8
;
ret
[
q
++
]
=
(
len64
&
0xFF
);
len64
>>=
8
;
ret
[
q
++
]
=
(
len64
&
0xFF
);
len64
>>=
8
;
ret
[
q
++
]
=
(
len64
&
0xFF
);
len64
>>=
8
;
ret
[
q
]
=
(
len64
&
0xFF
);
ret
[
q
++
]
=
(
len_low
&
0xff
);
len_low
>>=
8
;
ret
[
q
++
]
=
(
len_low
&
0xff
);
len_low
>>=
8
;
ret
[
q
++
]
=
(
len_low
&
0xff
);
len_low
>>=
8
;
ret
[
q
++
]
=
(
len_low
&
0xff
);
ret
[
q
++
]
=
(
len_high
&
0xff
);
len_high
>>=
8
;
ret
[
q
++
]
=
(
len_high
&
0xff
);
len_high
>>=
8
;
ret
[
q
++
]
=
(
len_high
&
0xff
);
len_high
>>=
8
;
ret
[
q
]
=
(
len_high
&
0xff
);
return
ret
;
}
...
...
@@ -94,9 +92,9 @@ createPaddedCopyWithLength(unsigned8 *b, unsigned32 *l)
#define ROT_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
static
void
doTheRounds
(
u
nsigned32
X
[
16
],
unsigned
32
state
[
4
])
doTheRounds
(
u
int32
X
[
16
],
uint
32
state
[
4
])
{
u
nsigned
32
a
,
b
,
c
,
d
;
u
int
32
a
,
b
,
c
,
d
;
a
=
state
[
0
];
b
=
state
[
1
];
...
...
@@ -182,13 +180,13 @@ doTheRounds(unsigned32 X[16], unsigned32 state[4])
}
static
int
calculateDigestFromBuffer
(
u
nsigned8
*
b
,
unsigned32
len
,
unsigned
8
sum
[
16
])
calculateDigestFromBuffer
(
u
int8
*
b
,
uint32
len
,
uint
8
sum
[
16
])
{
register
u
nsigned
32
i
,
j
,
k
,
newI
;
u
nsigned
32
l
;
u
nsigned
8
*
input
;
register
u
nsigned
32
*
wbp
;
u
nsigned
32
workBuff
[
16
],
state
[
4
];
register
u
int
32
i
,
j
,
k
,
newI
;
u
int
32
l
;
u
int
8
*
input
;
register
u
int
32
*
wbp
;
u
int
32
workBuff
[
16
],
state
[
4
];
l
=
len
;
...
...
@@ -223,19 +221,19 @@ calculateDigestFromBuffer(unsigned8 *b, unsigned32 len, unsigned8 sum[16])
j
=
0
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
k
=
state
[
i
];
sum
[
j
++
]
=
(
k
&
0x
FF
);
sum
[
j
++
]
=
(
k
&
0x
ff
);
k
>>=
8
;
sum
[
j
++
]
=
(
k
&
0x
FF
);
sum
[
j
++
]
=
(
k
&
0x
ff
);
k
>>=
8
;
sum
[
j
++
]
=
(
k
&
0x
FF
);
sum
[
j
++
]
=
(
k
&
0x
ff
);
k
>>=
8
;
sum
[
j
++
]
=
(
k
&
0x
FF
);
sum
[
j
++
]
=
(
k
&
0x
ff
);
}
return
1
;
}
static
void
bytesToHex
(
u
nsigned
8
b
[
16
],
char
*
s
)
bytesToHex
(
u
int
8
b
[
16
],
char
*
s
)
{
static
char
*
hex
=
"0123456789abcdef"
;
int
q
,
w
;
...
...
@@ -280,9 +278,9 @@ bytesToHex(unsigned8 b[16], char *s)
bool
md5_hash
(
const
void
*
buff
,
size_t
len
,
char
*
hexsum
)
{
u
nsigned
8
sum
[
16
];
u
int
8
sum
[
16
];
if
(
!
calculateDigestFromBuffer
((
u
nsigned
8
*
)
buff
,
len
,
sum
))
if
(
!
calculateDigestFromBuffer
((
u
int
8
*
)
buff
,
len
,
sum
))
return
false
;
bytesToHex
(
sum
,
hexsum
);
...
...
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
浏览文件 @
46d7ae75
...
...
@@ -169,11 +169,11 @@ public class Array implements java.sql.Array
}
public
int
getBaseType
()
throws
SQLException
{
return
conn
.
getSQLType
(
getBaseTypeName
()
);
return
Field
.
getSQLType
(
getBaseTypeName
()
);
}
public
String
getBaseTypeName
()
throws
SQLException
{
String
fType
=
field
.
getPGTyp
e
();
String
fType
=
field
.
getTypeNam
e
();
if
(
fType
.
charAt
(
0
)
==
'_'
)
fType
=
fType
.
substring
(
1
);
return
fType
;
...
...
@@ -195,12 +195,12 @@ public class Array implements java.sql.Array
Object
array
=
getArray
(
index
,
count
,
map
);
Vector
rows
=
new
Vector
();
Field
[]
fields
=
new
Field
[
2
];
fields
[
0
]
=
new
Field
(
conn
,
"INDEX"
,
conn
.
getOID
(
"int2"
),
2
);
fields
[
0
]
=
new
Field
(
conn
,
"INDEX"
,
field
.
getOID
(
"int2"
),
2
);
switch
(
getBaseType
()
)
{
case
Types
.
BIT
:
boolean
[]
booleanArray
=
(
boolean
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"bool"
),
1
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"bool"
),
1
);
for
(
int
i
=
0
;
i
<
booleanArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -208,11 +208,11 @@ public class Array implements java.sql.Array
rows
.
addElement
(
tuple
);
}
case
Types
.
SMALLINT
:
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"int2"
),
2
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"int2"
),
2
);
case
Types
.
INTEGER
:
int
[]
intArray
=
(
int
[])
array
;
if
(
fields
[
1
]
==
null
)
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"int4"
),
4
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"int4"
),
4
);
for
(
int
i
=
0
;
i
<
intArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -222,7 +222,7 @@ public class Array implements java.sql.Array
break
;
case
Types
.
BIGINT
:
long
[]
longArray
=
(
long
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"int8"
),
8
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"int8"
),
8
);
for
(
int
i
=
0
;
i
<
longArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -232,7 +232,7 @@ public class Array implements java.sql.Array
break
;
case
Types
.
NUMERIC
:
BigDecimal
[]
bdArray
=
(
BigDecimal
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"numeric"
),
-
1
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"numeric"
),
-
1
);
for
(
int
i
=
0
;
i
<
bdArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -242,7 +242,7 @@ public class Array implements java.sql.Array
break
;
case
Types
.
REAL
:
float
[]
floatArray
=
(
float
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"float4"
),
4
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"float4"
),
4
);
for
(
int
i
=
0
;
i
<
floatArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -252,7 +252,7 @@ public class Array implements java.sql.Array
break
;
case
Types
.
DOUBLE
:
double
[]
doubleArray
=
(
double
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"float8"
),
8
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"float8"
),
8
);
for
(
int
i
=
0
;
i
<
doubleArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -261,11 +261,11 @@ public class Array implements java.sql.Array
}
break
;
case
Types
.
CHAR
:
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"char"
),
1
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"char"
),
1
);
case
Types
.
VARCHAR
:
String
[]
strArray
=
(
String
[])
array
;
if
(
fields
[
1
]
==
null
)
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"varchar"
),
-
1
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"varchar"
),
-
1
);
for
(
int
i
=
0
;
i
<
strArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -275,7 +275,7 @@ public class Array implements java.sql.Array
break
;
case
Types
.
DATE
:
java
.
sql
.
Date
[]
dateArray
=
(
java
.
sql
.
Date
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"date"
),
4
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"date"
),
4
);
for
(
int
i
=
0
;
i
<
dateArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -285,7 +285,7 @@ public class Array implements java.sql.Array
break
;
case
Types
.
TIME
:
java
.
sql
.
Time
[]
timeArray
=
(
java
.
sql
.
Time
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"time"
),
8
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"time"
),
8
);
for
(
int
i
=
0
;
i
<
timeArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
@@ -295,7 +295,7 @@ public class Array implements java.sql.Array
break
;
case
Types
.
TIMESTAMP
:
java
.
sql
.
Timestamp
[]
timestampArray
=
(
java
.
sql
.
Timestamp
[])
array
;
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
conn
.
getOID
(
"timestamp"
),
8
);
fields
[
1
]
=
new
Field
(
conn
,
"VALUE"
,
field
.
getOID
(
"timestamp"
),
8
);
for
(
int
i
=
0
;
i
<
timestampArray
.
length
;
i
++
)
{
byte
[][]
tuple
=
new
byte
[
2
][
0
];
tuple
[
0
]
=
conn
.
getEncoding
().
encode
(
Integer
.
toString
((
int
)
index
+
i
)
);
// Index
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录