Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ad1425ae
Commit
ad1425ae
authored
Dec 28, 2006
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add send and recv functions for xml type.
parent
d9e1c97f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
9 deletions
+58
-9
src/backend/utils/adt/xml.c
src/backend/utils/adt/xml.c
+45
-3
src/include/catalog/catversion.h
src/include/catalog/catversion.h
+2
-2
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc.h
+6
-1
src/include/catalog/pg_type.h
src/include/catalog/pg_type.h
+2
-2
src/include/utils/xml.h
src/include/utils/xml.h
+3
-1
No files found.
src/backend/utils/adt/xml.c
View file @
ad1425ae
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.
6 2006/12/28 03:17:38
petere Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.
7 2006/12/28 14:28:36
petere Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -34,6 +34,7 @@
#endif
/* USE_LIBXML */
#include "fmgr.h"
#include "libpq/pqformat.h"
#include "mb/pg_wchar.h"
#include "nodes/execnodes.h"
#include "utils/builtins.h"
...
...
@@ -83,8 +84,7 @@ xml_in(PG_FUNCTION_ARGS)
/*
* Parse the data to check if it is well-formed XML data. Assume
* that ERROR occurred if parsing failed. Do we need DTD
* validation (if DTD exists)?
* that ERROR occurred if parsing failed.
*/
xml_parse
(
vardata
,
false
,
true
);
...
...
@@ -112,6 +112,48 @@ xml_out(PG_FUNCTION_ARGS)
}
Datum
xml_recv
(
PG_FUNCTION_ARGS
)
{
#ifdef USE_LIBXML
StringInfo
buf
=
(
StringInfo
)
PG_GETARG_POINTER
(
0
);
xmltype
*
result
;
char
*
str
;
int
nbytes
;
str
=
pq_getmsgtext
(
buf
,
buf
->
len
-
buf
->
cursor
,
&
nbytes
);
result
=
(
xmltype
*
)
palloc
(
nbytes
+
VARHDRSZ
);
VARATT_SIZEP
(
result
)
=
nbytes
+
VARHDRSZ
;
memcpy
(
VARDATA
(
result
),
str
,
nbytes
);
pfree
(
str
);
/*
* Parse the data to check if it is well-formed XML data. Assume
* that ERROR occurred if parsing failed.
*/
xml_parse
(
result
,
false
,
true
);
PG_RETURN_XML_P
(
result
);
#else
NO_XML_SUPPORT
();
return
0
;
#endif
}
Datum
xml_send
(
PG_FUNCTION_ARGS
)
{
xmltype
*
x
=
PG_GETARG_XML_P
(
0
);
StringInfoData
buf
;
pq_begintypsend
(
&
buf
);
pq_sendbytes
(
&
buf
,
VARDATA
(
x
),
VARSIZE
(
x
)
-
VARHDRSZ
);
PG_RETURN_BYTEA_P
(
pq_endtypsend
(
&
buf
));
}
#ifdef USE_LIBXML
static
void
appendStringInfoText
(
StringInfo
str
,
const
text
*
t
)
...
...
src/include/catalog/catversion.h
View file @
ad1425ae
...
...
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.36
6 2006/12/24 00:29:19 tgl
Exp $
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.36
7 2006/12/28 14:28:36 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 2006122
3
1
#define CATALOG_VERSION_NO 2006122
8
1
#endif
src/include/catalog/pg_proc.h
View file @
ad1425ae
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.43
2 2006/12/24 00:29:19 tgl
Exp $
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.43
3 2006/12/28 14:28:36 petere
Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
...
...
@@ -3987,6 +3987,11 @@ DATA(insert OID = 2896 ( xml PGNSP PGUID 12 f f t f i 1 142 "25" _null_ _n
DESCR
(
"perform a non-validating parse of a character string to produce an XML value"
);
DATA
(
insert
OID
=
2897
(
xmlvalidate
PGNSP
PGUID
12
f
f
t
f
i
2
16
"142 25"
_null_
_null_
_null_
xmlvalidate
-
_null_
));
DESCR
(
"validate an XML value"
);
DATA
(
insert
OID
=
2898
(
xml_recv
PGNSP
PGUID
12
f
f
t
f
s
1
142
"2281"
_null_
_null_
_null_
xml_recv
-
_null_
));
DESCR
(
"I/O"
);
DATA
(
insert
OID
=
2899
(
xml_send
PGNSP
PGUID
12
f
f
t
f
s
1
17
"142"
_null_
_null_
_null_
xml_send
-
_null_
));
DESCR
(
"I/O"
);
/*
* Symbolic values for provolatile column: these indicate whether the result
...
...
src/include/catalog/pg_type.h
View file @
ad1425ae
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.17
4 2006/12/28 01:09:01 tgl
Exp $
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.17
5 2006/12/28 14:28:36 petere
Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -316,7 +316,7 @@ DATA(insert OID = 83 ( pg_class PGNSP PGUID -1 f c t \054 1259 0 record_in reco
#define PG_CLASS_RELTYPE_OID 83
/* OIDS 100 - 199 */
DATA
(
insert
OID
=
142
(
xml
PGNSP
PGUID
-
1
f
b
t
\
054
0
0
xml_in
xml_out
-
-
-
i
x
f
0
-
1
0
_null_
_null_
));
DATA
(
insert
OID
=
142
(
xml
PGNSP
PGUID
-
1
f
b
t
\
054
0
0
xml_in
xml_out
xml_recv
xml_send
-
i
x
f
0
-
1
0
_null_
_null_
));
DESCR
(
"XML content"
);
#define XMLOID 142
DATA
(
insert
OID
=
143
(
_xml
PGNSP
PGUID
-
1
f
b
t
\
054
0
142
array_in
array_out
array_recv
array_send
-
i
x
f
0
-
1
0
_null_
_null_
));
...
...
src/include/utils/xml.h
View file @
ad1425ae
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.
3 2006/12/24 00:29:20 tgl
Exp $
* $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.
4 2006/12/28 14:28:36 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -26,6 +26,8 @@ typedef struct varlena xmltype;
extern
Datum
xml_in
(
PG_FUNCTION_ARGS
);
extern
Datum
xml_out
(
PG_FUNCTION_ARGS
);
extern
Datum
xml_recv
(
PG_FUNCTION_ARGS
);
extern
Datum
xml_send
(
PG_FUNCTION_ARGS
);
extern
Datum
xmlcomment
(
PG_FUNCTION_ARGS
);
extern
Datum
texttoxml
(
PG_FUNCTION_ARGS
);
extern
Datum
xmlvalidate
(
PG_FUNCTION_ARGS
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment