Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
5c47f144
Commit
5c47f144
authored
8 years ago
by
Giovannoni Laurent
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #4576 delete ref to class dbquery
parent
d790b2be
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/trunk/core/class/class_db_pdo.php
+27
-22
27 additions, 22 deletions
core/trunk/core/class/class_db_pdo.php
with
27 additions
and
22 deletions
core/trunk/core/class/class_db_pdo.php
+
27
−
22
View file @
5c47f144
...
...
@@ -275,12 +275,13 @@ class Database extends functions
* @param string $queryString The SQL query string
* @param array $parameters An indexed or associative array of parameters
* @param bool $catchExceptions Indicates wheter the PDO exceptions must be caught
* @param bool $multi Indicates wheter multi queries likes in sql file is required
*
* @return PDOStatement The prepared and executed statement
*
* @throws PDOException If a PDO error occurs during preparation or execution
*/
public
function
query
(
$queryString
,
$parameters
=
null
,
$catchExceptions
=
false
)
public
function
query
(
$queryString
,
$parameters
=
null
,
$catchExceptions
=
false
,
$multi
=
false
)
{
if
(
$parameters
)
{
foreach
(
$parameters
as
$key
=>
$value
)
{
...
...
@@ -317,32 +318,36 @@ class Database extends functions
}
}
try
{
$this
->
stmt
=
$this
->
prepare
(
$queryString
);
preg_match_all
(
"/\?|\:/"
,
$queryString
,
$matches
,
PREG_OFFSET_CAPTURE
);
if
(
empty
(
$matches
[
0
]))
{
//echo $queryString;
$executed
=
$this
->
stmt
->
execute
();
}
else
{
$executed
=
$this
->
stmt
->
execute
(
$parameters
);
}
}
catch
(
PDOException
$PDOException
)
{
if
(
$catchExceptions
)
{
$this
->
error
=
$PDOException
->
getMessage
();
if
(
$multi
)
{
$this
->
pdo
->
setAttribute
(
PDO
::
ATTR_EMULATE_PREPARES
,
0
);
$this
->
pdo
->
exec
(
$queryString
);
return
true
;
}
else
{
try
{
$this
->
stmt
=
$this
->
prepare
(
$queryString
);
preg_match_all
(
"/\?|\:/"
,
$queryString
,
$matches
,
PREG_OFFSET_CAPTURE
);
if
(
empty
(
$matches
[
0
]))
{
//echo $queryString;
$executed
=
$this
->
stmt
->
execute
();
}
else
{
$executed
=
$this
->
stmt
->
execute
(
$parameters
);
}
}
catch
(
PDOException
$PDOException
)
{
if
(
$catchExceptions
)
{
$this
->
error
=
$PDOException
->
getMessage
();
return
false
;
}
else
{
if
(
$_SESSION
[
'config'
][
'debug'
]
==
'true'
)
{
echo
$queryString
;
var_export
(
$parameters
);
return
false
;
}
else
{
if
(
$_SESSION
[
'config'
][
'debug'
]
==
'true'
)
{
echo
$queryString
;
var_export
(
$parameters
);
}
throw
$PDOException
;
}
throw
$PDOException
;
}
}
return
$this
->
stmt
;
}
public
function
limit_select
(
$start
,
$count
,
$select_expr
,
$table_refs
,
$where_def
=
'1=1'
,
$other_clauses
=
''
,
$select_opts
=
''
)
...
...
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