Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
762bd0df
Commit
762bd0df
authored
May 01, 2009
by
stronk7
Browse files
MDL-18577 drop enums support - step3: fix native pgsql set_field_select() handling of BLOBs
parent
74c288a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/dml/pgsql_native_moodle_database.php
View file @
762bd0df
...
...
@@ -958,6 +958,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @throws dml_exception if error
*/
public
function
set_field_select
(
$table
,
$newfield
,
$newvalue
,
$select
,
array
$params
=
null
)
{
if
(
$select
)
{
$select
=
"WHERE
$select
"
;
}
...
...
@@ -967,6 +968,21 @@ class pgsql_native_moodle_database extends moodle_database {
list
(
$select
,
$params
,
$type
)
=
$this
->
fix_sql_params
(
$select
,
$params
);
$i
=
count
(
$params
)
+
1
;
/// Get column metadata
$columns
=
$this
->
get_columns
(
$table
);
$column
=
$columns
[
$newfield
];
if
(
$column
->
meta_type
==
'B'
)
{
/// If the column is a BLOB
/// Update BYTEA and return
$newvalue
=
pg_escape_bytea
(
$this
->
pgsql
,
$newvalue
);
$sql
=
"UPDATE
{
$this
->
prefix
}
$table
SET
$newfield
= '
$newvalue
'::bytea
$select
"
;
$this
->
query_start
(
$sql
,
NULL
,
SQL_QUERY_UPDATE
);
$result
=
pg_query_params
(
$this
->
pgsql
,
$sql
,
$params
);
$this
->
query_end
(
$result
);
pg_free_result
(
$result
);
return
true
;
}
if
(
is_bool
(
$newvalue
))
{
$newvalue
=
(
int
)
$newvalue
;
// prevent "false" problems
}
...
...
Write
Preview
Supports
Markdown
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