|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* expression-types.php. |
|
5
|
|
|
* |
|
6
|
|
|
* |
|
7
|
|
|
* Copyright (c) 2010-2013, Justin Swanhart |
|
8
|
|
|
* with contributions by André Rothe <[email protected], [email protected]> |
|
9
|
|
|
* and David Négrier <[email protected]> |
|
10
|
|
|
* |
|
11
|
|
|
* All rights reserved. |
|
12
|
|
|
* |
|
13
|
|
|
* Redistribution and use in source and binary forms, with or without modification, |
|
14
|
|
|
* are permitted provided that the following conditions are met: |
|
15
|
|
|
* |
|
16
|
|
|
* * Redistributions of source code must retain the above copyright notice, |
|
17
|
|
|
* this list of conditions and the following disclaimer. |
|
18
|
|
|
* * Redistributions in binary form must reproduce the above copyright notice, |
|
19
|
|
|
* this list of conditions and the following disclaimer in the documentation |
|
20
|
|
|
* and/or other materials provided with the distribution. |
|
21
|
|
|
* |
|
22
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
|
23
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
24
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
|
25
|
|
|
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
26
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
|
27
|
|
|
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
|
28
|
|
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
29
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
30
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
|
31
|
|
|
* DAMAGE. |
|
32
|
|
|
*/ |
|
33
|
|
|
|
|
34
|
|
|
namespace SQLParser\Node; |
|
35
|
|
|
|
|
36
|
|
|
use Doctrine\DBAL\Connection; |
|
37
|
|
|
use Mouf\MoufInstanceDescriptor; |
|
38
|
|
|
use Mouf\MoufManager; |
|
39
|
|
|
use SQLParser\Node\Traverser\VisitorInterface; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* This class represents a parameter (as in parameterized query). |
|
43
|
|
|
* |
|
44
|
|
|
* @author David MAECHLER <[email protected]> |
|
45
|
|
|
*/ |
|
46
|
|
|
class UnquotedParameter extends Parameter |
|
47
|
|
|
{ |
|
48
|
|
|
/** |
|
49
|
|
|
* Renders the object as a SQL string without quote if its a numeric |
|
50
|
|
|
* |
|
51
|
|
|
* @param array $parameters |
|
52
|
|
|
* @param Connection $dbConnection |
|
53
|
|
|
* @param int|number $indent |
|
54
|
|
|
* @param int $conditionsMode |
|
55
|
|
|
* @return string |
|
56
|
|
|
*/ |
|
57
|
|
|
public function toSql(array $parameters = array(), Connection $dbConnection = null, $indent = 0, $conditionsMode = self::CONDITION_APPLY) |
|
58
|
|
|
{ |
|
59
|
|
|
$name = parent::toSql($parameters, $dbConnection, $indent, $conditionsMode); |
|
60
|
|
|
$name = str_replace("'", "", $name); |
|
61
|
|
|
return $name; |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|