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
4945a8fa
Commit
4945a8fa
authored
Jan 20, 2007
by
Neil Conway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach psql's \lo slash commands to respect quiet mode, and to output
HTML in HTML mode. Patch from Jeremy Drake.
parent
24ac4c96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
10 deletions
+45
-10
doc/src/sgml/ref/psql-ref.sgml
doc/src/sgml/ref/psql-ref.sgml
+7
-6
src/bin/psql/large_obj.c
src/bin/psql/large_obj.c
+38
-4
No files found.
doc/src/sgml/ref/psql-ref.sgml
View file @
4945a8fa
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.1
79 2006/12/19 01:53:36 adunstan
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.1
80 2007/01/20 16:57:31 neilc
Exp $
PostgreSQL documentation
-->
...
...
@@ -1329,11 +1329,12 @@ Tue Oct 26 21:40:57 CEST 1999
foo=> <userinput>\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</userinput>
lo_import 152801
</programlisting>
The response indicates that the large object received object ID
152801 which one ought to remember if one wants to access the
object ever again. For that reason it is recommended to always
associate a human-readable comment with every object. Those can
then be seen with the <command>\lo_list</command> command.
The response indicates that the large object received object
ID 152801, which can be used to access the newly-created large
object in the future. For the sake of readability, it is
recommended to always associate a human-readable comment with
every object. Both OIDs and comments can be viewed with the
<command>\lo_list</command> command.
</para>
<para>
...
...
src/bin/psql/large_obj.c
View file @
4945a8fa
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.4
7 2007/01/05 22:19:49 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.4
8 2007/01/20 16:57:31 neilc
Exp $
*/
#include "postgres_fe.h"
#include "large_obj.h"
...
...
@@ -12,6 +12,39 @@
#include "settings.h"
#include "common.h"
static
void
print_lo_result
(
const
char
*
fmt
,...)
__attribute__
((
format
(
printf
,
1
,
2
)));
static
void
print_lo_result
(
const
char
*
fmt
,...)
{
va_list
ap
;
if
(
!
pset
.
quiet
)
{
if
(
pset
.
popt
.
topt
.
format
==
PRINT_HTML
)
fputs
(
"<p>"
,
pset
.
queryFout
);
va_start
(
ap
,
fmt
);
vfprintf
(
pset
.
queryFout
,
fmt
,
ap
);
va_end
(
ap
);
if
(
pset
.
popt
.
topt
.
format
==
PRINT_HTML
)
fputs
(
"</p>
\n
"
,
pset
.
queryFout
);
else
fputs
(
"
\n
"
,
pset
.
queryFout
);
}
if
(
pset
.
logfile
)
{
va_start
(
ap
,
fmt
);
vfprintf
(
pset
.
logfile
,
fmt
,
ap
);
va_end
(
ap
);
fputs
(
"
\n
"
,
pset
.
logfile
);
}
}
/*
* Prepare to do a large-object operation. We *must* be inside a transaction
...
...
@@ -129,7 +162,7 @@ do_lo_export(const char *loid_arg, const char *filename_arg)
if
(
!
finish_lo_xact
(
"
\\
lo_export"
,
own_transaction
))
return
false
;
fprintf
(
pset
.
queryFout
,
"lo_export
\n
"
);
print_lo_result
(
"lo_export
"
);
return
true
;
}
...
...
@@ -189,7 +222,8 @@ do_lo_import(const char *filename_arg, const char *comment_arg)
if
(
!
finish_lo_xact
(
"
\\
lo_import"
,
own_transaction
))
return
false
;
fprintf
(
pset
.
queryFout
,
"lo_import %u
\n
"
,
loid
);
print_lo_result
(
"lo_import %u"
,
loid
);
sprintf
(
oidbuf
,
"%u"
,
loid
);
SetVariable
(
pset
.
vars
,
"LASTOID"
,
oidbuf
);
...
...
@@ -225,7 +259,7 @@ do_lo_unlink(const char *loid_arg)
if
(
!
finish_lo_xact
(
"
\\
lo_unlink"
,
own_transaction
))
return
false
;
fprintf
(
pset
.
queryFout
,
"lo_unlink %u
\n
"
,
loid
);
print_lo_result
(
"lo_unlink %u
"
,
loid
);
return
true
;
}
...
...
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