Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
02680868
Commit
02680868
authored
Mar 18, 2005
by
mkanat%kerio.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 285740: DBD::Pg must have the PG_BYTEA type specified for inserting BLOBs
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=Tomas.Kopal, a=justdave
parent
17844d97
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
DB.pm
Bugzilla/DB.pm
+15
-0
Pg.pm
Bugzilla/DB/Pg.pm
+2
-0
attachment.cgi
attachment.cgi
+11
-3
No files found.
Bugzilla/DB.pm
View file @
02680868
...
...
@@ -51,6 +51,16 @@ use Bugzilla::Error;
use
Bugzilla::DB::
Schema
;
use
Bugzilla::
User
;
#####################################################################
# Constants
#####################################################################
use
constant
BLOB_TYPE
=>
DBI::
SQL_BLOB
;
#####################################################################
# Deprecated Functions
#####################################################################
# All this code is backwards compat fu. As such, its a bit ugly. Note the
# circular dependencies on Bugzilla.pm
# This is old cruft which will be removed, so theres not much use in
...
...
@@ -787,6 +797,11 @@ constants are required to be subroutines or "use constant" variables.
=over 4
=item C<BLOB_TYPE>
The C<\%attr> argument that must be passed to bind_param in order to
correctly escape a C<LONGBLOB> type.
=item C<REQUIRED_VERSION>
This is the minimum required version of the database server that the
...
...
Bugzilla/DB/Pg.pm
View file @
02680868
...
...
@@ -42,10 +42,12 @@ package Bugzilla::DB::Pg;
use
strict
;
use
Bugzilla::
Error
;
use
DBD::
Pg
;
# This module extends the DB interface via inheritance
use
base
qw(Bugzilla::DB)
;
use
constant
BLOB_TYPE
=>
{
pg_type
=>
DBD::Pg::
PG_BYTEA
};
use
constant
REQUIRED_VERSION
=>
'7.03.0000'
;
use
constant
PROGRAM_NAME
=>
'PostgreSQL'
;
use
constant
MODULE_NAME
=>
'Pg'
;
...
...
attachment.cgi
View file @
02680868
...
...
@@ -913,7 +913,6 @@ sub insert
$filename
=
SqlQuote
(
$filename
);
my
$description
=
SqlQuote
(
$::FORM
{
'description'
});
my
$contenttype
=
SqlQuote
(
$::FORM
{
'contenttype'
});
my
$thedata
=
SqlQuote
(
$data
);
my
$isprivate
=
$::FORM
{
'isprivate'
}
?
1
:
0
;
# Figure out when the changes were made.
...
...
@@ -921,8 +920,17 @@ sub insert
my
$sql_timestamp
=
SqlQuote
(
$timestamp
);
# Insert the attachment into the database.
SendSQL
(
"INSERT INTO attachments (bug_id, creation_ts, filename, description, mimetype, ispatch, isprivate, submitter_id, thedata)
VALUES ($::FORM{'bugid'}, $sql_timestamp, $filename, $description, $contenttype, $::FORM{'ispatch'}, $isprivate, $::userid, $thedata)"
);
my
$sth
=
$dbh
->
prepare
(
"INSERT INTO attachments
(thedata, bug_id, creation_ts, filename, description,
mimetype, ispatch, isprivate, submitter_id)
VALUES (?, $::FORM{'bugid'}, $sql_timestamp, $filename,
$description, $contenttype, $::FORM{'ispatch'},
$isprivate, $::userid)"
);
# We only use $data here in this INSERT with a placeholder,
# so it's safe.
trick_taint
(
$data
);
$sth
->
bind_param
(
1
,
$data
,
$dbh
->
BLOB_TYPE
);
$sth
->
execute
();
# Retrieve the ID of the newly created attachment record.
my
$attachid
=
$dbh
->
bz_last_key
(
'attachments'
,
'attach_id'
);
...
...
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