|
|
Subject: 4787 - in trunk/Template: . src src/parsers/source_to_tst/implementations tests/regression_tests/array_fetch/correct tests/regression_tests/expressions/incorrect tests/regression_tests/use/incorrect [eZComponents: Trunk] - msg#00093
List: web.ezcomponents.cvs
Author: Raymond Bosman
Date: 2007-03-30 14:23:35 +0200 (Fri, 30 Mar 2007)
New Revision: 4787
Log:
- Fixed issue 10261: Template: {$address->_failures[$propertyName]}
Added:
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.in
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.out
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.send
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.in
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.out
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.in
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.out
Modified:
trunk/Template/ChangeLog
trunk/Template/src/error_messages.php
trunk/Template/src/parsers/source_to_tst/implementations/expression.php
trunk/Template/tests/regression_tests/use/incorrect/object.out
Modified: trunk/Template/ChangeLog
===================================================================
--- trunk/Template/ChangeLog 2007-03-29 13:14:12 UTC (rev 4786)
+++ trunk/Template/ChangeLog 2007-03-30 12:23:35 UTC (rev 4787)
@@ -3,6 +3,8 @@
- Implemented issue #9965: Support for delayed initialization through
ezcBaseInit.
+- Fixed issue #10261: Array fetch and property fetch could not be used
+ together.
1.1 - Monday 18 December 2006
Modified: trunk/Template/src/error_messages.php
===================================================================
--- trunk/Template/src/error_messages.php 2007-03-29 13:14:12 UTC (rev
4786)
+++ trunk/Template/src/error_messages.php 2007-03-30 12:23:35 UTC (rev
4787)
@@ -70,6 +70,7 @@
const MSG_LHS_IS_NOT_VARIABLE = "Unexpected operator '%s'.
The left hand side must be variable.";
const MSG_LHS_IS_NOT_VARIABLE_NO_SYMBOL = "The left hand side must be
variable.";
+ const MSG_EXPECT_IDENTIFIER = "Expect an identifier.";
const MSG_EXPECT_ARRAY = "Expecting an array.";
const MSG_EXPECT_VALUE_NOT_ARRAY = "Expecting a value and not
an array.";
const MSG_PARAMETER_EXPECTS_EXPRESSION = "Parameter %s expects a
value.";
Modified:
trunk/Template/src/parsers/source_to_tst/implementations/expression.php
===================================================================
--- trunk/Template/src/parsers/source_to_tst/implementations/expression.php
2007-03-29 13:14:12 UTC (rev 4786)
+++ trunk/Template/src/parsers/source_to_tst/implementations/expression.php
2007-03-30 12:23:35 UTC (rev 4787)
@@ -57,7 +57,6 @@
parent::__construct( $parser, $parentParser, $startCursor );
$this->currentOperator = null;
$this->rootOperator = null;
- $this->allowIdentifier = false;
$this->minPrecedence = false;
}
@@ -229,9 +228,11 @@
$this->findNextElement();
- if ( $this->parseArrayFetch( $cursor, $allowArrayAppend ) )
+ while ( (($res = $this->parseArrayFetch( $cursor,
$allowArrayAppend )) && $res[0]) || $this->parsePropertyFetch( $cursor) )
{
$this->findNextElement();
+
+ if( !$res[1] ) break;
}
$parsedType = "Variable";
@@ -243,15 +244,6 @@
$this->currentOperator = $this->parser->handleOperand(
$this->currentOperator, $this->lastParser->functionCall );
$parsedType = "FunctionCall";
}
- elseif ( $this->allowIdentifier && $this->parseOptionalType(
'Identifier' ) )
- {
- $this->operatorRhsCheck( $this->currentOperator,
$this->lastParser->element, $cursor );
-
- // Try parsing an identifier since it is allowed
- $this->currentOperator = $this->parser->handleOperand(
$this->currentOperator, $this->lastParser->element );
-
- $parsedType = "Identifier";
- }
elseif( $cursor->match( '(' ) && sizeof( $allowedTypes ) == 0 )
{
$expressionCursor = clone $cursor;
@@ -430,7 +422,7 @@
*
* @param ezcTemplateCursor $cursor
* @param bool $allowArrayAppend
- * @return bool
+ * @return array(bool,bool) = Continue, repeat.
*/
protected function parseArrayFetch( $cursor, $allowArrayAppend = false )
{
@@ -448,14 +440,14 @@
$this->currentOperator =
$this->parser->handleOperatorPrecedence( $this->currentOperator, $operator );
$this->lastCursor = clone $cursor;
- return true;
+ return array(true, false);
}
else
{
$operatorStartCursor = clone $cursor;
if ( !$this->parseRequiredType( 'ArrayFetch' ) )
{
- return false;
+ return array(false, true);
}
$this->findNextElement();
@@ -473,7 +465,7 @@
$operator->precedence < $this->minPrecedence )
{
$cursor->copy( $operatorStartCursor );
- return true;
+ return array(true, true);
}
$this->currentOperator = $this->parser->handleOperatorPrecedence(
$this->currentOperator, $operator );
@@ -482,9 +474,37 @@
$this->findNextElement();
}
- return ($operator !== null);
+ return array(($operator !== null), true);
}
+ protected function parsePropertyFetch($cursor)
+ {
+ $operator = null;
+ while ( $cursor->match( '->' ) )
+ {
+ $this->findNextElement();
+
+ $operator = new ezcTemplatePropertyFetchOperatorTstNode(
$this->parser->source, $this->startCursor, $cursor );
+
+ if ( !$this->parseRequiredType( 'Identifier' ) )
+ {
+ throw new ezcTemplateParserException( $this->parser->source,
$cursor, $cursor,
+
ezcTemplateSourceToTstErrorMessages::MSG_EXPECT_IDENTIFIER );
+ }
+
+
+ $this->currentOperator = $this->parser->handleOperatorPrecedence(
$this->currentOperator, $operator );
+
+
+ $this->currentOperator = $this->parser->handleOperand(
$this->currentOperator, $this->lastParser->element );
+
+ $this->findNextElement();
+
+ //$operator = $this->lastParser->value;
+ }
+ return $operator !== null;
+ }
+
/**
* Parse assignment operator
*
@@ -526,7 +546,7 @@
array( 3,
array( '===', '!==' ) ),
array( 2,
- array( '->',
+ array(
'==', '!=',
'<=', '>=',
'&&', '||',
@@ -572,8 +592,6 @@
'/' => 'DivisionOperator',
'%' => 'ModuloOperator',
- '->' => 'PropertyFetchOperator',
-
'==' => 'EqualOperator',
'!=' => 'NotEqualOperator',
@@ -620,12 +638,6 @@
$this->lastCursor->copy( $cursor );
- // -> operator can have an identifier as the next operand
- if ( $requestedName == '->' )
- {
- $this->allowIdentifier = true;
- }
-
return $operatorName;
}
Added:
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.in
===================================================================
--- trunk/Template/tests/regression_tests/array_fetch/correct/from_property.in
2007-03-29 13:14:12 UTC (rev 4786)
+++ trunk/Template/tests/regression_tests/array_fetch/correct/from_property.in
2007-03-30 12:23:35 UTC (rev 4787)
@@ -0,0 +1,9 @@
+{use $obj}
+
+{$obj->a[0]}
+{$obj->b->a[0]}
+
+{$obj->c[0]->a[0]}
+
+{$obj->d[0][0]->c[0]->a[0]}
+
Property changes on:
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.in
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.out
===================================================================
--- trunk/Template/tests/regression_tests/array_fetch/correct/from_property.out
2007-03-29 13:14:12 UTC (rev 4786)
+++ trunk/Template/tests/regression_tests/array_fetch/correct/from_property.out
2007-03-30 12:23:35 UTC (rev 4787)
@@ -0,0 +1,7 @@
+
+hello
+hello
+
+hello
+
+hello
Property changes on:
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.out
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.send
===================================================================
---
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.send
2007-03-29 13:14:12 UTC (rev 4786)
+++
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.send
2007-03-30 12:23:35 UTC (rev 4787)
@@ -0,0 +1,24 @@
+<?php
+
+class Class8239
+{
+ public $a;
+ public $b;
+ public $c;
+ public $d;
+
+ public function __construct()
+ {
+ $this->a = array("hello", "world");
+ $this->b = $this;
+ $this->c = array($this, $this);
+ $this->d = array( array($this));
+ }
+}
+
+$v = new ezcTemplateVariableCollection();
+$v->obj = new Class8239();
+
+
+return $v;
+?>
Property changes on:
trunk/Template/tests/regression_tests/array_fetch/correct/from_property.send
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.in
===================================================================
---
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.in
2007-03-29 13:14:12 UTC (rev 4786)
+++
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.in
2007-03-30 12:23:35 UTC (rev 4787)
@@ -0,0 +1,3 @@
+{use $obj = null}
+
+{$obj->$bla}
Property changes on:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.in
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.out
===================================================================
---
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.out
2007-03-29 13:14:12 UTC (rev 4786)
+++
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.out
2007-03-30 12:23:35 UTC (rev 4787)
@@ -0,0 +1,4 @@
+mock:3:8: Expect an identifier.
+
+{$obj->$bla}
+ ^
Property changes on:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch.out
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.in
===================================================================
---
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.in
2007-03-29 13:14:12 UTC (rev 4786)
+++
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.in
2007-03-30 12:23:35 UTC (rev 4787)
@@ -0,0 +1 @@
+{5->hello}
Property changes on:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.in
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.out
===================================================================
---
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.out
2007-03-29 13:14:12 UTC (rev 4786)
+++
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.out
2007-03-30 12:23:35 UTC (rev 4787)
@@ -0,0 +1,4 @@
+mock:1:4: Expecting an operand without a pre- or post operator.
+
+{5->hello}
+ ^
Property changes on:
trunk/Template/tests/regression_tests/expressions/incorrect/property_fetch_on_number.out
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/Template/tests/regression_tests/use/incorrect/object.out
===================================================================
--- trunk/Template/tests/regression_tests/use/incorrect/object.out
2007-03-29 13:14:12 UTC (rev 4786)
+++ trunk/Template/tests/regression_tests/use/incorrect/object.out
2007-03-30 12:23:35 UTC (rev 4787)
@@ -1,4 +1,4 @@
-mock:5:15: Calling a method from an imported object is not allowed.
+mock:5:28: Expecting a closing curly bracket: '}'
Say: {$myObj->getHelloWorld(2 + 2)}
- ^
+ ^
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
您该考虑考虑相亲了
春天来了,大地复苏了,劳动节就是为了让大家暂时的放下手里的工作。享受一下假期给我们带来的欢乐,放松一下心情.爱一个人需要缘分,也需要勇气。用你的真心,抓住一切机会,大胆追求你的幸福,愿天下有情人终成眷属!。
5.1 特别节日,情缘京城大型相亲会,欢迎你的光临,精彩不容期待……
活动时间: 2007 年 5 月 1 日 ―― 2007 年 5 月 7 日 ( 9 : 00 ― 16 : 00 )
活动地点:地坛 公园 (东城区安定门外大街地坛公园,北区,紧挨公园北门)
活动费用: 3 0 元 / 人次 ; 12 0 元 / 人( 7 日通票 )
报名者提前订购活动入场券 优惠条款 :
1 、 只需加 10 元享受网上会员半年免费服务!
2 、 前 10 名加 30 元,享受公司赠送大展板;
前 20 名加 20 元,享受公司赠送中展板;
前 30 名加 10 元,享受公司赠送小展板!
咨询电话: 010― 51268521 / 64421410
>> 活动详情
>> 商务合作
Next Message by Date:
click to view message preview
4788 - in trunk/PersistentObject/tests: . data [eZComponents: Trunk]
Author: Tobias Schlitt
Date: 2007-03-31 11:46:58 +0200 (Sat, 31 Mar 2007)
New Revision: 4788
Log:
- Added more quoting to test cases.
# Oracle is very pedantic here.
Modified:
trunk/PersistentObject/tests/data/manual_generator_test.php
trunk/PersistentObject/tests/data/persistent_test_object.php
trunk/PersistentObject/tests/data/relation_test.php
trunk/PersistentObject/tests/find_iterator_test.php
trunk/PersistentObject/tests/one_to_many_relation_test.php
trunk/PersistentObject/tests/one_to_one_relation_test.php
trunk/PersistentObject/tests/persistent_session_test.php
Modified: trunk/PersistentObject/tests/data/manual_generator_test.php
===================================================================
--- trunk/PersistentObject/tests/data/manual_generator_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/data/manual_generator_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -30,19 +30,28 @@
public static function insertCleanData()
{
$db = ezcDbInstance::get();
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ( 1, 'Sweden', 9006405, 449.96, 'Sweden has nice
girls!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES (2, 'Norway', 4593041, 385.19, 'Norway has brown
goat cheese!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES (3, 'Ukraine', 47732079, 603.70, 'Ukraine has a
long coastline to the black see.' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES (4, 'Germany', 82443000, 357.02, 'Home of the
lederhosen!.' )" );
}
@@ -73,7 +82,7 @@
public static function cleanup()
{
$db = ezcDbInstance::get();
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) . ";" );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) );
}
/*
Modified: trunk/PersistentObject/tests/data/persistent_test_object.php
===================================================================
--- trunk/PersistentObject/tests/data/persistent_test_object.php
2007-03-30 12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/data/persistent_test_object.php
2007-03-31 09:46:58 UTC (rev 4788)
@@ -30,20 +30,24 @@
public static function insertCleanData()
{
$db = ezcDbInstance::get();
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Sweden', 9006405, 449.96, 'Sweden has nice
girls!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Norway', 4593041, 385.19, 'Norway has brown goat
cheese!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Ukraine', 47732079, 603.70, 'Ukraine has a long
coastline to the black see.' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Germany', 82443000, 357.02, 'Home of the
lederhosen!.' )" );
}
@@ -83,7 +87,11 @@
public static function cleanup()
{
$db = ezcDbInstance::get();
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) . ";" );
+ if ( $db->getName() == "oracle" )
+ {
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_test_id_seq" ) );
+ }
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) );
}
/*
Modified: trunk/PersistentObject/tests/data/relation_test.php
===================================================================
--- trunk/PersistentObject/tests/data/relation_test.php 2007-03-30 12:23:35 UTC
(rev 4787)
+++ trunk/PersistentObject/tests/data/relation_test.php 2007-03-31 09:46:58 UTC
(rev 4788)
@@ -11,29 +11,29 @@
{
$db = ezcDbInstance::get();
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Httproad 23" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Ftpstreet 42" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Phpavenue 21" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Pythonstreet 13" ) . ", " . $db->quote( "12345" ) .
", " . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ");" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Httproad 23" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Ftpstreet 42" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Phpavenue 21" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Pythonstreet 13" ) . ", " . $db->quote( "12345" ) .
", " . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ")" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Great Web 2.0
company" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Oldschool Web
1.x company" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Very
oldschool print media company" ) . ");" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Great Web 2.0
company" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Oldschool Web
1.x company" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Very
oldschool print media company" ) . ")" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Theodor" ) . ", " . $db->quote( "Gopher" ) . ", 2);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Frederick" ) . ", " . $db->quote( "Ajax" ) . ", 1);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Raymond" ) . ", " . $db->quote( "Socialweb" ) . ", 1);" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Theodor" ) . ", " . $db->quote( "Gopher" ) . ", 2)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Frederick" ) . ", " . $db->quote( "Ajax" ) . ", 1)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Raymond" ) . ", " . $db->quote( "Socialweb" ) . ", 1)" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 1);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 2);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 4);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 1);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 3);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 4);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 3, 4);" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 1)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 2)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 4)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 1)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 3)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 4)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 3, 4)" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (1, 327535201);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (2, -138243599);" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (1, 327535201)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (2, -138243599)" );
}
/**
@@ -62,11 +62,17 @@
public static function cleanup()
{
$db = ezcDbInstance::get();
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_addresses" ) . ""
);
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_birthdays" ) . ""
);
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_employers" ) . ""
);
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_persons" ) . "" );
- $db->exec( "DROP TABLE " . $db->quoteIdentifier(
"PO_persons_addresses" ) . "" );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_addresses" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_birthdays" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_employers" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_persons" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier(
"PO_persons_addresses" ) );
+ if ( $db->getName() === "oracle" )
+ {
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_addresses_id_seq" ) );
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_employers_id_seq" ) );
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_persons_id_seq" ) );
+ }
}
}
Modified: trunk/PersistentObject/tests/find_iterator_test.php
===================================================================
--- trunk/PersistentObject/tests/find_iterator_test.php 2007-03-30 12:23:35 UTC
(rev 4787)
+++ trunk/PersistentObject/tests/find_iterator_test.php 2007-03-31 09:46:58 UTC
(rev 4788)
@@ -52,7 +52,7 @@
public function testFaultyStmtReturnsNull()
{
- $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from PO_test" ),
+ $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from " . $this->db->quoteIdentifier( "PO_test" ) ),
$this->manager->fetchDefinition(
'PersistentTestObject' ) );
$this->assertEquals( null, $it->current() );
$this->assertEquals( null, $it->next() );
@@ -61,7 +61,7 @@
public function testFaultyDefinitionReturnsNull()
{
- $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from PO_test" ),
+ $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from " . $this->db->quoteIdentifier( "PO_test" ) ),
new ezcPersistentObjectDefinition
);
$this->assertEquals( null, $it->current() );
$this->assertEquals( null, $it->next() );
@@ -71,7 +71,7 @@
public function testValidIsInvalidBeforeRewind()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -82,7 +82,7 @@
public function testValidIsValidWhenNextWithoutRewind()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -94,7 +94,7 @@
public function testValidIsValidWhenRewindIsCalled()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -106,7 +106,7 @@
public function testValidNoResults()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 42 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 42 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -122,7 +122,7 @@
public function testValidOneResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 3 ) );
+ $q->where( $q->expr->eq( $this->db->quoteIdentifier( 'id' ), 3 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -141,7 +141,7 @@
public function testValidManyResults()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -166,7 +166,7 @@
public function testThatOnlyOneObjectIsUsed()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
Modified: trunk/PersistentObject/tests/one_to_many_relation_test.php
===================================================================
--- trunk/PersistentObject/tests/one_to_many_relation_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/one_to_many_relation_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -494,7 +494,7 @@
$q = $this->session->createFindQuery( "RelationTestPerson" );
$q->where(
$q->expr->eq(
- "id",
+ $this->session->database->quoteIdentifier( "id" ),
$q->bindValue( $person->id )
)
);
@@ -509,7 +509,7 @@
$q = $this->session->createFindQuery( "RelationTestBirthday" );
$q->where(
$q->expr->eq(
- "person_id",
+ $this->session->database->quoteIdentifier( "person_id" ),
$q->bindValue( $person->id )
)
);
Modified: trunk/PersistentObject/tests/one_to_one_relation_test.php
===================================================================
--- trunk/PersistentObject/tests/one_to_one_relation_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/one_to_one_relation_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -351,7 +351,7 @@
$q = $this->session->createFindQuery( "RelationTestBirthday" );
$q->where(
$q->expr->eq(
- "person_id",
+ $this->session->database->quoteIdentifier( "person_id" ),
$q->bindValue( $birthday->person )
)
);
Modified: trunk/PersistentObject/tests/persistent_session_test.php
===================================================================
--- trunk/PersistentObject/tests/persistent_session_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/persistent_session_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -388,7 +388,7 @@
public function testFindNoResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 999 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 999 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 0, count( $objects ) );
}
@@ -396,7 +396,7 @@
public function testFindSingleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 1 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 1 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 1, count( $objects ) );
}
@@ -404,7 +404,7 @@
public function testFindMultipleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->session->database->quoteIdentifier(
'id' ), 2 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 2, count( $objects ) );
@@ -425,7 +425,7 @@
public function testFindIteratorNoResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 999 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 999 ) );
$it = $this->session->findIterator( $q, 'PersistentTestObject' );
$this->assertEquals( null, $it->next() );
}
@@ -433,7 +433,7 @@
public function testFindIteratorSingleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 1 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 1 ) );
$it = $this->session->findIterator( $q, 'PersistentTestObject' );
$i = 0;
foreach ( $it as $object )
@@ -446,7 +446,7 @@
public function testFindIteratorMultipleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->session->database->quoteIdentifier(
'id' ), 2 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 2, count( $objects ) );
Previous Message by Thread:
click to view message preview
您该考虑考虑相亲了
春天来了,大地复苏了,劳动节就是为了让大家暂时的放下手里的工作。享受一下假期给我们带来的欢乐,放松一下心情.爱一个人需要缘分,也需要勇气。用你的真心,抓住一切机会,大胆追求你的幸福,愿天下有情人终成眷属!。
5.1 特别节日,情缘京城大型相亲会,欢迎你的光临,精彩不容期待……
活动时间: 2007 年 5 月 1 日 ―― 2007 年 5 月 7 日 ( 9 : 00 ― 16 : 00 )
活动地点:地坛 公园 (东城区安定门外大街地坛公园,北区,紧挨公园北门)
活动费用: 3 0 元 / 人次 ; 12 0 元 / 人( 7 日通票 )
报名者提前订购活动入场券 优惠条款 :
1 、 只需加 10 元享受网上会员半年免费服务!
2 、 前 10 名加 30 元,享受公司赠送大展板;
前 20 名加 20 元,享受公司赠送中展板;
前 30 名加 10 元,享受公司赠送小展板!
咨询电话: 010― 51268521 / 64421410
>> 活动详情
>> 商务合作
Next Message by Thread:
click to view message preview
4788 - in trunk/PersistentObject/tests: . data [eZComponents: Trunk]
Author: Tobias Schlitt
Date: 2007-03-31 11:46:58 +0200 (Sat, 31 Mar 2007)
New Revision: 4788
Log:
- Added more quoting to test cases.
# Oracle is very pedantic here.
Modified:
trunk/PersistentObject/tests/data/manual_generator_test.php
trunk/PersistentObject/tests/data/persistent_test_object.php
trunk/PersistentObject/tests/data/relation_test.php
trunk/PersistentObject/tests/find_iterator_test.php
trunk/PersistentObject/tests/one_to_many_relation_test.php
trunk/PersistentObject/tests/one_to_one_relation_test.php
trunk/PersistentObject/tests/persistent_session_test.php
Modified: trunk/PersistentObject/tests/data/manual_generator_test.php
===================================================================
--- trunk/PersistentObject/tests/data/manual_generator_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/data/manual_generator_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -30,19 +30,28 @@
public static function insertCleanData()
{
$db = ezcDbInstance::get();
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ( 1, 'Sweden', 9006405, 449.96, 'Sweden has nice
girls!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES (2, 'Norway', 4593041, 385.19, 'Norway has brown
goat cheese!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES (3, 'Ukraine', 47732079, 603.70, 'Ukraine has a
long coastline to the black see.' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " (id,
type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "id" ) . ", "
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES (4, 'Germany', 82443000, 357.02, 'Home of the
lederhosen!.' )" );
}
@@ -73,7 +82,7 @@
public static function cleanup()
{
$db = ezcDbInstance::get();
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) . ";" );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) );
}
/*
Modified: trunk/PersistentObject/tests/data/persistent_test_object.php
===================================================================
--- trunk/PersistentObject/tests/data/persistent_test_object.php
2007-03-30 12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/data/persistent_test_object.php
2007-03-31 09:46:58 UTC (rev 4788)
@@ -30,20 +30,24 @@
public static function insertCleanData()
{
$db = ezcDbInstance::get();
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Sweden', 9006405, 449.96, 'Sweden has nice
girls!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Norway', 4593041, 385.19, 'Norway has brown goat
cheese!' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Ukraine', 47732079, 603.70, 'Ukraine has a long
coastline to the black see.' )" );
- $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . "
(type_varchar, type_integer,
- type_decimal, type_text )
+ $db->exec( "insert into " . $db->quoteIdentifier( "PO_test" ) . " ("
+ . $db->quoteIdentifier( "type_varchar" ) . ", " .
$db->quoteIdentifier( "type_integer" ) . ", "
+ . $db->quoteIdentifier( "type_decimal" ) . ", " .
$db->quoteIdentifier( "type_text" ) . " )
VALUES ('Germany', 82443000, 357.02, 'Home of the
lederhosen!.' )" );
}
@@ -83,7 +87,11 @@
public static function cleanup()
{
$db = ezcDbInstance::get();
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) . ";" );
+ if ( $db->getName() == "oracle" )
+ {
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_test_id_seq" ) );
+ }
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_test" ) );
}
/*
Modified: trunk/PersistentObject/tests/data/relation_test.php
===================================================================
--- trunk/PersistentObject/tests/data/relation_test.php 2007-03-30 12:23:35 UTC
(rev 4787)
+++ trunk/PersistentObject/tests/data/relation_test.php 2007-03-31 09:46:58 UTC
(rev 4788)
@@ -11,29 +11,29 @@
{
$db = ezcDbInstance::get();
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Httproad 23" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Ftpstreet 42" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Phpavenue 21" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Pythonstreet 13" ) . ", " . $db->quote( "12345" ) .
", " . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ");" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Httproad 23" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Ftpstreet 42" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "work" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Phpavenue 21" ) . ", " . $db->quote( "12345" ) . ",
" . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_addresses" ) . "
(" . $db->quoteIdentifier( "street" ) . ", " . $db->quoteIdentifier( "zip" ) .
", " . $db->quoteIdentifier( "city" ) . ", " . $db->quoteIdentifier( "type" ) .
") VALUES (" . $db->quote( "Pythonstreet 13" ) . ", " . $db->quote( "12345" ) .
", " . $db->quote( "Internettown" ) . ", " . $db->quote( "private" ) . ")" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Great Web 2.0
company" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Oldschool Web
1.x company" ) . ");" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Very
oldschool print media company" ) . ");" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Great Web 2.0
company" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Oldschool Web
1.x company" ) . ")" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_employers" ) . "
(" . $db->quoteIdentifier( "name" ) . ") VALUES (" . $db->quote( "Very
oldschool print media company" ) . ")" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Theodor" ) . ", " . $db->quote( "Gopher" ) . ", 2);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Frederick" ) . ", " . $db->quote( "Ajax" ) . ", 1);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Raymond" ) . ", " . $db->quote( "Socialweb" ) . ", 1);" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Theodor" ) . ", " . $db->quote( "Gopher" ) . ", 2)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Frederick" ) . ", " . $db->quote( "Ajax" ) . ", 1)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_persons" ) . "
(" . $db->quoteIdentifier( "firstname" ) . ", " . $db->quoteIdentifier(
"surname" ) . ", " . $db->quoteIdentifier( "employer" ) . ") VALUES (" .
$db->quote( "Raymond" ) . ", " . $db->quote( "Socialweb" ) . ", 1)" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 1);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 2);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 4);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 1);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 3);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 4);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 3, 4);" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 1)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 2)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 1, 4)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 1)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 3)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 2, 4)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier(
"PO_persons_addresses" ) . " ( " . $db->quoteIdentifier( "person_id" ) . ", " .
$db->quoteIdentifier( "address_id" ) . ") VALUES ( 3, 4)" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (1, 327535201);" );
- $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (2, -138243599);" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (1, 327535201)" );
+ $db->exec( "INSERT INTO " . $db->quoteIdentifier( "PO_birthdays" ) . "
(" . $db->quoteIdentifier( "person_id" ) . ", " . $db->quoteIdentifier(
"birthday" ) . ") VALUES (2, -138243599)" );
}
/**
@@ -62,11 +62,17 @@
public static function cleanup()
{
$db = ezcDbInstance::get();
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_addresses" ) . ""
);
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_birthdays" ) . ""
);
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_employers" ) . ""
);
- $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_persons" ) . "" );
- $db->exec( "DROP TABLE " . $db->quoteIdentifier(
"PO_persons_addresses" ) . "" );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_addresses" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_birthdays" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_employers" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier( "PO_persons" ) );
+ $db->exec( "DROP TABLE " . $db->quoteIdentifier(
"PO_persons_addresses" ) );
+ if ( $db->getName() === "oracle" )
+ {
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_addresses_id_seq" ) );
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_employers_id_seq" ) );
+ $db->exec( "DROP SEQUENCE " . $db->quoteIdentifier(
"PO_persons_id_seq" ) );
+ }
}
}
Modified: trunk/PersistentObject/tests/find_iterator_test.php
===================================================================
--- trunk/PersistentObject/tests/find_iterator_test.php 2007-03-30 12:23:35 UTC
(rev 4787)
+++ trunk/PersistentObject/tests/find_iterator_test.php 2007-03-31 09:46:58 UTC
(rev 4788)
@@ -52,7 +52,7 @@
public function testFaultyStmtReturnsNull()
{
- $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from PO_test" ),
+ $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from " . $this->db->quoteIdentifier( "PO_test" ) ),
$this->manager->fetchDefinition(
'PersistentTestObject' ) );
$this->assertEquals( null, $it->current() );
$this->assertEquals( null, $it->next() );
@@ -61,7 +61,7 @@
public function testFaultyDefinitionReturnsNull()
{
- $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from PO_test" ),
+ $it = new ezcPersistentFindIterator( $this->db->prepare( "select *
from " . $this->db->quoteIdentifier( "PO_test" ) ),
new ezcPersistentObjectDefinition
);
$this->assertEquals( null, $it->current() );
$this->assertEquals( null, $it->next() );
@@ -71,7 +71,7 @@
public function testValidIsInvalidBeforeRewind()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -82,7 +82,7 @@
public function testValidIsValidWhenNextWithoutRewind()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -94,7 +94,7 @@
public function testValidIsValidWhenRewindIsCalled()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -106,7 +106,7 @@
public function testValidNoResults()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 42 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 42 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -122,7 +122,7 @@
public function testValidOneResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 3 ) );
+ $q->where( $q->expr->eq( $this->db->quoteIdentifier( 'id' ), 3 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -141,7 +141,7 @@
public function testValidManyResults()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
@@ -166,7 +166,7 @@
public function testThatOnlyOneObjectIsUsed()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->db->quoteIdentifier( 'id' ), 2 ) );
$stmt = $q->prepare();
$stmt->execute();
$it = new ezcPersistentFindIterator( $stmt,
$this->manager->fetchDefinition( 'PersistentTestObject' ) );
Modified: trunk/PersistentObject/tests/one_to_many_relation_test.php
===================================================================
--- trunk/PersistentObject/tests/one_to_many_relation_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/one_to_many_relation_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -494,7 +494,7 @@
$q = $this->session->createFindQuery( "RelationTestPerson" );
$q->where(
$q->expr->eq(
- "id",
+ $this->session->database->quoteIdentifier( "id" ),
$q->bindValue( $person->id )
)
);
@@ -509,7 +509,7 @@
$q = $this->session->createFindQuery( "RelationTestBirthday" );
$q->where(
$q->expr->eq(
- "person_id",
+ $this->session->database->quoteIdentifier( "person_id" ),
$q->bindValue( $person->id )
)
);
Modified: trunk/PersistentObject/tests/one_to_one_relation_test.php
===================================================================
--- trunk/PersistentObject/tests/one_to_one_relation_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/one_to_one_relation_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -351,7 +351,7 @@
$q = $this->session->createFindQuery( "RelationTestBirthday" );
$q->where(
$q->expr->eq(
- "person_id",
+ $this->session->database->quoteIdentifier( "person_id" ),
$q->bindValue( $birthday->person )
)
);
Modified: trunk/PersistentObject/tests/persistent_session_test.php
===================================================================
--- trunk/PersistentObject/tests/persistent_session_test.php 2007-03-30
12:23:35 UTC (rev 4787)
+++ trunk/PersistentObject/tests/persistent_session_test.php 2007-03-31
09:46:58 UTC (rev 4788)
@@ -388,7 +388,7 @@
public function testFindNoResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 999 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 999 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 0, count( $objects ) );
}
@@ -396,7 +396,7 @@
public function testFindSingleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 1 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 1 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 1, count( $objects ) );
}
@@ -404,7 +404,7 @@
public function testFindMultipleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->session->database->quoteIdentifier(
'id' ), 2 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 2, count( $objects ) );
@@ -425,7 +425,7 @@
public function testFindIteratorNoResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 999 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 999 ) );
$it = $this->session->findIterator( $q, 'PersistentTestObject' );
$this->assertEquals( null, $it->next() );
}
@@ -433,7 +433,7 @@
public function testFindIteratorSingleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->eq( 'id', 1 ) );
+ $q->where( $q->expr->eq( $this->session->database->quoteIdentifier(
'id' ), 1 ) );
$it = $this->session->findIterator( $q, 'PersistentTestObject' );
$i = 0;
foreach ( $it as $object )
@@ -446,7 +446,7 @@
public function testFindIteratorMultipleResult()
{
$q = $this->session->createFindQuery( 'PersistentTestObject' );
- $q->where( $q->expr->gt( 'id', 2 ) );
+ $q->where( $q->expr->gt( $this->session->database->quoteIdentifier(
'id' ), 2 ) );
$objects = $this->session->find( $q, 'PersistentTestObject' );
$this->assertEquals( 2, count( $objects ) );
|
|