Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
8436f9a0
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,发现更多精彩内容 >>
提交
8436f9a0
编写于
3月 19, 2008
作者:
T
Tatsuo Ishii
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add libpq new API lo_import_with_oid() which is similar to lo_import()
except that lob's oid can be specified.
上级
f755f2fe
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
57 addition
and
6 deletion
+57
-6
doc/src/sgml/lobj.sgml
doc/src/sgml/lobj.sgml
+23
-1
src/interfaces/libpq/exports.txt
src/interfaces/libpq/exports.txt
+2
-1
src/interfaces/libpq/fe-lobj.c
src/interfaces/libpq/fe-lobj.c
+30
-3
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-fe.h
+2
-1
未找到文件。
doc/src/sgml/lobj.sgml
浏览文件 @
8436f9a0
<!-- $PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.4
6 2007/03/14 00:15:26 tgl
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.4
7 2008/03/19 00:39:33 ishii
Exp $ -->
<chapter id="largeObjects">
<title id="largeObjects-title">Large Objects</title>
...
...
@@ -161,6 +161,28 @@ Oid lo_import(PGconn *conn, const char *filename);
the server; so it must exist in the client file system and be readable
by the client application.
</para>
<para>
The function
<synopsis>
Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
</synopsis>
<indexterm><primary>lo_import_with_oid</></>
also imports a new large object. The OID to be assigned can be
specified by <replaceable class="parameter">lobjId</replaceable>;
if so, failure occurs if that OID is already in use for some large
object. If <replaceable class="parameter">lobjId</replaceable>
is <symbol>InvalidOid</symbol> (zero) then <function>lo_import_with_oid</> assigns an unused
OID (this is the same behavior as <function>lo_import</>).
The return value is the OID that was assigned to the new large object,
or <symbol>InvalidOid</symbol> (zero) on failure.
</para>
<para>
<function>lo_import_with_oid</> is new as of <productname>PostgreSQL</productname>
8.4 and uses <function>lo_create</function> internally which is new in 8.1; if this function is run against 8.0 or before, it will
fail and return <symbol>InvalidOid</symbol>.
</para>
</sect2>
<sect2>
...
...
src/interfaces/libpq/exports.txt
浏览文件 @
8436f9a0
# $PostgreSQL: pgsql/src/interfaces/libpq/exports.txt,v 1.1
8 2007/12/09 19:01:40 tgl
Exp $
# $PostgreSQL: pgsql/src/interfaces/libpq/exports.txt,v 1.1
9 2008/03/19 00:39:33 ishii
Exp $
# Functions to be exported by libpq DLLs
PQconnectdb 1
PQsetdbLogin 2
...
...
@@ -140,3 +140,4 @@ lo_truncate 137
PQconnectionUsedPassword 138
pg_valid_server_encoding_id 139
PQconnectionNeedsPassword 140
lo_import_with_oid 141
src/interfaces/libpq/fe-lobj.c
浏览文件 @
8436f9a0
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.6
4 2008/01/01 19:46:00 momjian
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.6
5 2008/03/19 00:39:33 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -41,6 +41,8 @@
static
int
lo_initialize
(
PGconn
*
conn
);
static
Oid
lo_import_internal
(
PGconn
*
conn
,
const
char
*
filename
,
const
Oid
oid
);
/*
* lo_open
...
...
@@ -483,6 +485,27 @@ lo_unlink(PGconn *conn, Oid lobjId)
Oid
lo_import
(
PGconn
*
conn
,
const
char
*
filename
)
{
return
lo_import_internal
(
conn
,
filename
,
InvalidOid
);
}
/*
* lo_import_with_oid -
* imports a file as an (inversion) large object.
* large object id can be specified.
*
* returns the oid of that object upon success,
* returns InvalidOid upon failure
*/
Oid
lo_import_with_oid
(
PGconn
*
conn
,
const
char
*
filename
,
Oid
lobjId
)
{
return
lo_import_internal
(
conn
,
filename
,
lobjId
);
}
static
Oid
lo_import_internal
(
PGconn
*
conn
,
const
char
*
filename
,
Oid
oid
)
{
int
fd
;
int
nbytes
,
...
...
@@ -507,10 +530,14 @@ lo_import(PGconn *conn, const char *filename)
/*
* create an inversion object
*/
if
(
oid
==
InvalidOid
)
lobjOid
=
lo_creat
(
conn
,
INV_READ
|
INV_WRITE
);
else
lobjOid
=
lo_create
(
conn
,
oid
);
if
(
lobjOid
==
InvalidOid
)
{
/* we assume lo_creat() already set a suitable error message */
/* we assume lo_creat
e
() already set a suitable error message */
(
void
)
close
(
fd
);
return
InvalidOid
;
}
...
...
src/interfaces/libpq/libpq-fe.h
浏览文件 @
8436f9a0
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.14
1 2008/01/01 19:46:00 momjian
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.14
2 2008/03/19 00:39:33 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -495,6 +495,7 @@ extern int lo_tell(PGconn *conn, int fd);
extern
int
lo_truncate
(
PGconn
*
conn
,
int
fd
,
size_t
len
);
extern
int
lo_unlink
(
PGconn
*
conn
,
Oid
lobjId
);
extern
Oid
lo_import
(
PGconn
*
conn
,
const
char
*
filename
);
extern
Oid
lo_import_with_oid
(
PGconn
*
conn
,
const
char
*
filename
,
Oid
lobjId
);
extern
int
lo_export
(
PGconn
*
conn
,
Oid
lobjId
,
const
char
*
filename
);
/* === in fe-misc.c === */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录