Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
die_coolen_jungs
our_own_cloud_project
Commits
2cc94cbc
Commit
2cc94cbc
authored
11 years ago
by
Bart Visscher
Browse files
Options
Downloads
Patches
Plain Diff
Style fixes
parent
95a959b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/db.php
+2
-2
2 additions, 2 deletions
lib/db.php
lib/db/adapteroci8.php
+2
-1
2 additions, 1 deletion
lib/db/adapteroci8.php
lib/db/adapterpgsql.php
+2
-1
2 additions, 1 deletion
lib/db/adapterpgsql.php
lib/db/statementwrapper.php
+2
-2
2 additions, 2 deletions
lib/db/statementwrapper.php
with
8 additions
and
6 deletions
lib/db.php
+
2
−
2
View file @
2cc94cbc
...
...
@@ -249,7 +249,7 @@ class OC_DB {
static
public
function
executeAudited
(
$stmt
,
array
$parameters
=
null
)
{
if
(
is_string
(
$stmt
))
{
// convert to an array with 'sql'
if
(
stripos
(
$stmt
,
'LIMIT'
)
!==
false
)
{
//OFFSET requires LIMIT, s
e
we only nee
t
to check for LIMIT
if
(
stripos
(
$stmt
,
'LIMIT'
)
!==
false
)
{
//OFFSET requires LIMIT, s
o
we only nee
d
to check for LIMIT
// TODO try to convert LIMIT OFFSET notation to parameters, see fixLimitClauseForMSSQL
$message
=
'LIMIT and OFFSET are forbidden for portability reasons,'
.
' pass an array with \'limit\' and \'offset\' instead'
;
...
...
@@ -257,7 +257,7 @@ class OC_DB {
}
$stmt
=
array
(
'sql'
=>
$stmt
,
'limit'
=>
null
,
'offset'
=>
null
);
}
if
(
is_array
(
$stmt
)){
if
(
is_array
(
$stmt
))
{
// convert to prepared statement
if
(
!
array_key_exists
(
'sql'
,
$stmt
)
)
{
$message
=
'statement array must at least contain key \'sql\''
;
...
...
This diff is collapsed.
Click to expand it.
lib/db/adapteroci8.php
+
2
−
1
View file @
2cc94cbc
...
...
@@ -18,10 +18,11 @@ class AdapterOCI8 extends Adapter {
return
$this
->
conn
->
realLastInsertId
(
$table
);
}
const
UNIX_TIMESTAMP_REPLACEMENT
=
"(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400"
;
public
function
fixupStatement
(
$statement
)
{
$statement
=
str_replace
(
'`'
,
'"'
,
$statement
);
$statement
=
str_ireplace
(
'NOW()'
,
'CURRENT_TIMESTAMP'
,
$statement
);
$statement
=
str_ireplace
(
'UNIX_TIMESTAMP()'
,
"(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400"
,
$statement
);
$statement
=
str_ireplace
(
'UNIX_TIMESTAMP()'
,
self
::
UNIX_TIMESTAMP_REPLACEMENT
,
$statement
);
return
$statement
;
}
}
This diff is collapsed.
Click to expand it.
lib/db/adapterpgsql.php
+
2
−
1
View file @
2cc94cbc
...
...
@@ -14,9 +14,10 @@ class AdapterPgSql extends Adapter {
return
$this
->
conn
->
fetchColumn
(
'SELECT lastval()'
);
}
const
UNIX_TIMESTAMP_REPLACEMENT
=
'cast(extract(epoch from current_timestamp) as integer)'
;
public
function
fixupStatement
(
$statement
)
{
$statement
=
str_replace
(
'`'
,
'"'
,
$statement
);
$statement
=
str_ireplace
(
'UNIX_TIMESTAMP()'
,
'cast(extract(epoch from current_timestamp) as integer)'
,
$statement
);
$statement
=
str_ireplace
(
'UNIX_TIMESTAMP()'
,
self
::
UNIX_TIMESTAMP_REPLACEMENT
,
$statement
);
return
$statement
;
}
}
This diff is collapsed.
Click to expand it.
lib/db/statementwrapper.php
+
2
−
2
View file @
2cc94cbc
...
...
@@ -53,7 +53,7 @@ class OC_DB_StatementWrapper {
*/
public
function
execute
(
$input
=
array
())
{
if
(
OC_Config
::
getValue
(
"log_query"
,
false
))
{
$params_str
=
str_replace
(
"
\n
"
,
" "
,
var_export
(
$input
,
true
));
$params_str
=
str_replace
(
"
\n
"
,
" "
,
var_export
(
$input
,
true
));
OC_Log
::
write
(
'core'
,
'DB execute with arguments : '
.
$params_str
,
OC_Log
::
DEBUG
);
}
$this
->
lastArguments
=
$input
;
...
...
@@ -134,7 +134,7 @@ class OC_DB_StatementWrapper {
$host
=
OC_Config
::
getValue
(
"dbhost"
,
""
);
$user
=
OC_Config
::
getValue
(
"dbuser"
,
""
);
$pass
=
OC_Config
::
getValue
(
"dbpassword"
,
""
);
if
(
strpos
(
$host
,
':'
))
{
if
(
strpos
(
$host
,
':'
))
{
list
(
$host
,
$port
)
=
explode
(
':'
,
$host
,
2
);
}
else
{
$port
=
false
;
...
...
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