Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
ff0ac57d
Commit
ff0ac57d
authored
19 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Remove extremely old, incomplete, broken example code.
Per my proposal a few days ago.
parent
7868590c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tutorial/beard.c
+0
-78
0 additions, 78 deletions
src/tutorial/beard.c
with
0 additions
and
78 deletions
src/tutorial/beard.c
deleted
100644 → 0
+
0
−
78
View file @
7868590c
/*-------------------------------------------------------------------------
*
* beard.c
* sample routines to use large objects
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/tutorial/beard.c,v 1.15 2006/03/05 15:59:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
typedef
struct
ImageHdr
{
int
size
;
}
ImageHdr
;
#define BUFSIZE 10
/*
* beard -
* clips lower 1/3 of picture and return as large object
*/
Oid
beard
(
Oid
picture
)
{
Oid
beard
;
int
pic_fd
,
beard_fd
;
ImageHdr
ihdr
;
char
buf
[
BUFSIZE
];
int
cc
;
pic_fd
=
DatumGetInt32
(
DirectFunctionCall2
(
lo_open
,
ObjectIdGetDatum
(
picture
),
Int32GetDatum
(
INV_READ
)));
if
(
pic_fd
<
0
)
elog
(
ERROR
,
"could not access picture large object"
);
if
(
lo_read
(
pic_fd
,
(
char
*
)
&
ihdr
,
sizeof
(
ihdr
))
!=
sizeof
(
ihdr
))
elog
(
ERROR
,
"picture large object corrupted"
);
beardOffset
=
(
ihdr
.
size
/
3
)
*
2
;
/*
* new large object
*/
beard
=
DatumGetObjectId
(
DirectFunctionCall1
(
lo_creat
,
Int32GetDatum
(
INV_MD
)));
if
(
beard
==
InvalidOid
)
elog
(
ERROR
,
"could not create new large object"
);
beard_fd
=
DatumGetInt32
(
DirectFunctionCall2
(
lo_open
,
ObjectIdGetDatum
(
beard
),
Int32GetDatum
(
INV_WRITE
)));
if
(
beard_fd
<
0
)
elog
(
ERROR
,
"could not access beard large object"
);
if
(
DatumGetInt32
(
DirectFunctionCall3
(
lo_lseek
,
Int32GetDatum
(
pic_fd
),
Int32GetDatum
(
beardOffset
),
Int32GetDatum
(
SEEK_SET
)))
<
0
)
elog
(
ERROR
,
"could not seek in picture large object"
);
while
((
cc
=
lo_read
(
pic_fd
,
buf
,
BUFSIZE
))
>
0
)
{
if
(
lo_write
(
beard_fd
,
buf
,
cc
)
!=
cc
)
elog
(
ERROR
,
"error while writing large object"
);
}
DirectFunctionCall1
(
lo_close
,
Int32GetDatum
(
pic_fd
));
DirectFunctionCall1
(
lo_close
,
Int32GetDatum
(
beard_fd
));
return
beard
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment