[limb-svn] r6845 - in 3.x/trunk/limb: active_record/src active_record/tests/cases active_record/tests/cases/.fixture dbal/src/drivers/linter
svn at limb-project.com
svn at limb-project.com
Wed Mar 19 18:45:48 MSK 2008
Author: svk
Date: 2008-03-19 18:45:47 +0300 (Wed, 19 Mar 2008)
New Revision: 6845
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6845
Modified:
3.x/trunk/limb/active_record/src/lmbARManyToManyCollection.class.php
3.x/trunk/limb/active_record/tests/cases/.fixture/init_tests.linter
3.x/trunk/limb/active_record/tests/cases/lmbARManyToManyCollectionTest.class.php
3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyCollectionTest.class.php
3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyRelationsTest.class.php
3.x/trunk/limb/active_record/tests/cases/lmbAROneToOneRelationsTest.class.php
3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php
3.x/trunk/limb/active_record/tests/cases/lmbARRecordSetJoinDecoratorTest.class.php
3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordTest.class.php
3.x/trunk/limb/dbal/src/drivers/linter/lmbLinterTypeInfo.class.php
Log:
-- identifiers quoted
Modified: 3.x/trunk/limb/active_record/src/lmbARManyToManyCollection.class.php
===================================================================
--- 3.x/trunk/limb/active_record/src/lmbARManyToManyCollection.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/src/lmbARManyToManyCollection.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -42,8 +42,9 @@
$join_table = $conn->quoteIdentifier($relation_info['table']);
$field = $conn->quoteIdentifier($relation_info['field']);
$foreign_field = $conn->quoteIdentifier($relation_info['foreign_field']);
+ $primary_field = $conn->quoteIdentifier($object->getPrimaryKeyName());
- $sql = "SELECT %fields% FROM {$table} INNER JOIN {$join_table} ON {$table}.{$object->getPrimaryKeyName()} = {$join_table}.{$foreign_field}" .
+ $sql = "SELECT %fields% FROM {$table} INNER JOIN {$join_table} ON {$table}.{$primary_field} = {$join_table}.{$foreign_field}" .
" %tables% %left_join% %where% %group% %having% %order%";
$query = lmbARQuery :: create($class, $params, $conn, $sql);
Modified: 3.x/trunk/limb/active_record/tests/cases/.fixture/init_tests.linter
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/.fixture/init_tests.linter 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/.fixture/init_tests.linter 2008-03-19 15:45:47 UTC (rev 6845)
@@ -2,7 +2,7 @@
"id" INT NOT NULL AUTOINC,
"annotation" blob,
"content" blob,
- "news_date" date default NULL,
+ "news_date" varchar(255) default NULL,
"ordr" int NULL,
PRIMARY KEY ("id")
) ;
@@ -24,7 +24,7 @@
) ;
-CREATE OR REPLACE TABLE course_for_typed_test (
+CREATE OR REPLACE TABLE "course_for_typed_test" (
"id" INT NOT NULL AUTOINC,
"title" varchar(255) default NULL,
PRIMARY KEY ("id")
@@ -41,7 +41,7 @@
-CREATE OR REPLACE TABLE social_security_for_test (
+CREATE OR REPLACE TABLE "social_security_for_test" (
"id" INT NOT NULL AUTOINC,
"code" varchar(255) default NULL,
PRIMARY KEY ("id")
@@ -50,7 +50,7 @@
CREATE OR REPLACE TABLE "person_for_test" (
"id" INT NOT NULL AUTOINC,
-name varchar(255) default NULL,
+"name" varchar(255) default NULL,
"ss_id" int default NULL,
PRIMARY KEY ("id")
) ;
@@ -81,7 +81,7 @@
) ;
-CREATE OR TABLE "lesson_for_test" (
+CREATE OR REPLACE TABLE "lesson_for_test" (
"id" INT NOT NULL AUTOINC,
"date_start" int default NULL,
"date_end" int default NULL,
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbARManyToManyCollectionTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbARManyToManyCollectionTest.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbARManyToManyCollectionTest.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -423,7 +423,7 @@
$user = $this->_createUserAndSave(array($group1, $group2, $group3));
- $groups = $user->getGroups()->find("group_id=" . $group1->getId());
+ $groups = $user->getGroups()->find(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("group_id") . "=" . $group1->getId());
$this->assertEqual($groups->count(), 1);
$this->assertEqual($groups->at(0)->getTitle(), $group1->getTitle());
}
@@ -450,7 +450,7 @@
$user = $this->_createUserAndSave(array($group1, $group2, $group3));
- $group = $user->getGroups()->findFirst("group_id=" . $group1->getId() . " OR group_id=" . $group2->getId());
+ $group = $user->getGroups()->findFirst(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("group_id") . "=" . $group1->getId() . " OR " . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("group_id") . "=" . $group2->getId());
$this->assertEqual($group->getTitle(), $group1->getTitle());
}
@@ -462,7 +462,7 @@
try
{
- $group = $user->getGroups()->findFirst("group_id=" . $g1->getId() . " OR group_id=" . $g2->getId());
+ $group = $user->getGroups()->findFirst(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("group_id") . "=" . $g1->getId() . " OR " . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("group_id") . "=" . $g2->getId());
$this->assertTrue(false);
}
catch(lmbException $e){}
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyCollectionTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyCollectionTest.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyCollectionTest.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -525,7 +525,7 @@
$course = $this->_createCourseAndSave(array($l1, $l2, $l3));
- $lectures = $course->getLectures()->find("id=" . $l1->getId());
+ $lectures = $course->getLectures()->find(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l1->getId());
$this->assertEqual($lectures->count(), 1);
$this->assertEqual($lectures->at(0)->getTitle(), $l1->getTitle());
}
@@ -538,7 +538,7 @@
try
{
- $lectures = $course->getLectures()->find("id=" . $l1->getId());
+ $lectures = $course->getLectures()->find(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l1->getId());
$this->assertTrue(false);
}
catch(lmbException $e){}
@@ -552,7 +552,7 @@
$course = $this->_createCourseAndSave(array($l1, $l2, $l3));
- $lecture = $course->getLectures()->findFirst("id=" . $l1->getId() . " OR id=" . $l2->getId());
+ $lecture = $course->getLectures()->findFirst(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l1->getId() . " OR " . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l2->getId());
$this->assertEqual($lecture->getTitle(), $l1->getTitle());
}
@@ -564,7 +564,7 @@
try
{
- $lecture = $course->getLectures()->findFirst("id=" . $l1->getId() . " OR id=" . $l2->getId());
+ $lecture = $course->getLectures()->findFirst(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l1->getId() . " OR " . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l2->getId());
$this->assertTrue(false);
}
catch(lmbException $e){}
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyRelationsTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyRelationsTest.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbAROneToManyRelationsTest.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -300,8 +300,8 @@
$course2 = lmbActiveRecord :: findById('CourseForTest', $course->getId());
$course2->destroy();
- $this->assertNull(lmbActiveRecord :: findFirst('LectureForTest', array('criteria' => 'id = ' . $l1->getId())));
- $this->assertNull(lmbActiveRecord :: findFirst('LectureForTest', array('criteria' => 'id = ' . $l2->getId())));
+ $this->assertNull(lmbActiveRecord :: findFirst('LectureForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $l1->getId())));
+ $this->assertNull(lmbActiveRecord :: findFirst('LectureForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $l2->getId())));
}
function testNullifyOnDestroy()
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbAROneToOneRelationsTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbAROneToOneRelationsTest.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbAROneToOneRelationsTest.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -234,8 +234,8 @@
$person->destroy();
- $this->assertNull(lmbActiveRecord :: findFirst('SocialSecurityForTest', array('criteria' => 'id = ' . $number_id)));
- $this->assertNull(lmbActiveRecord :: findFirst('PersonForTest', array('criteria' => 'id = ' . $person_id)));
+ $this->assertNull(lmbActiveRecord :: findFirst('SocialSecurityForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $number_id)));
+ $this->assertNull(lmbActiveRecord :: findFirst('PersonForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $person_id)));
}
function testParentDeleteAllDeletesChildren()
@@ -253,8 +253,8 @@
lmbActiveRecord :: delete('PersonForTest');
- $this->assertNull(lmbActiveRecord :: findFirst('SocialSecurityForTest', array('criteria' => 'id = ' . $number_id)));
- $this->assertNull(lmbActiveRecord :: findFirst('PersonForTest', array('criteria' => 'id = ' . $person_id)));
+ $this->assertNull(lmbActiveRecord :: findFirst('SocialSecurityForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $number_id)));
+ $this->assertNull(lmbActiveRecord :: findFirst('PersonForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $person_id)));
$number2 = lmbActiveRecord :: findById('SocialSecurityForTest', $untouched_number->getId());
$this->assertEqual($number2->getCode(), $untouched_number->getCode());
@@ -273,7 +273,7 @@
$person->destroy();
- $ss2 = lmbActiveRecord :: findFirst('SocialSecurityForTest', array('criteria' => 'id = ' . $number_id));
+ $ss2 = lmbActiveRecord :: findFirst('SocialSecurityForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $number_id));
$this->assertEqual($ss2->getCode(), $number->getCode());
}
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -218,7 +218,7 @@
$person1 = $this->creator->createPerson();
$person2 = $this->creator->createPerson();
- $this->db->delete('person_for_test', 'id = ' . $id);
+ $this->db->delete('person_for_test', $this->conn->quoteIdentifier("id") . '= ' . $id);
$this->conn->resetStats();
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbARRecordSetJoinDecoratorTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbARRecordSetJoinDecoratorTest.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbARRecordSetJoinDecoratorTest.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -19,9 +19,10 @@
$lecture = new LectureForTest();
$course_info = $lecture->getRelationInfo('course');
- $db = new lmbSimpleDb(lmbToolkit :: instance()->getDefaultDbConnection());
- $sql = 'SELECT lecture_for_test.*, course_for_test.id as course__id, course_for_test.title as course__title
- FROM lecture_for_test LEFT JOIN course_for_test ON course_for_test.id = lecture_for_test.course_id';
+ $conn = lmbToolkit :: instance()->getDefaultDbConnection();
+ $db = new lmbSimpleDb($conn);
+ $sql = 'SELECT ' . $conn->quoteIdentifier("lecture_for_test") . '.*, ' . $conn->quoteIdentifier("course_for_test.id") . ' as ' . $conn->quoteIdentifier("course__id") . ', ' . $conn->quoteIdentifier("course_for_test.title") . ' as ' . $conn->quoteIdentifier("course__title") . '
+ FROM ' . $conn->quoteIdentifier("lecture_for_test") . ' LEFT JOIN ' . $conn->quoteIdentifier("course_for_test") . ' ON ' . $conn->quoteIdentifier("course_for_test.id") . ' = ' . $conn->quoteIdentifier("lecture_for_test.course_id");
$decorated = lmbDBAL :: fetch($sql);
$iterator = new lmbARRecordSetJoinDecorator($decorated, new LectureForTest(), null, array('course' => $course_info));
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordTest.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordTest.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -319,14 +319,14 @@
$object2 = $this->creator->createOneTableObject();
$this->assertFalse($object2->isNew());
- $found = lmbActiveRecord :: findFirst('TestOneTableObject', array('criteria' => 'id=' . $object1->getId()));
+ $found = lmbActiveRecord :: findFirst('TestOneTableObject', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId()));
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
$this->assertEqual($found->get('id'), $object1->getId());
//testing convenient alias
- $found = TestOneTableObject :: findFirst(array('criteria' => 'id=' . $object1->getId()));
+ $found = TestOneTableObject :: findFirst(array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId()));
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
@@ -339,14 +339,14 @@
$object2 = $this->creator->createOneTableObject();
$this->assertFalse($object2->isNew());
- $found = lmbActiveRecord :: findFirst('TestOneTableObject', 'id=' . $object1->getId());
+ $found = lmbActiveRecord :: findFirst('TestOneTableObject', lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId());
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
$this->assertEqual($found->get('id'), $object1->getId());
//testing convenient alias
- $found = TestOneTableObject :: findFirst('id=' . $object1->getId());
+ $found = TestOneTableObject :: findFirst(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId());
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
@@ -359,14 +359,14 @@
$object2 = $this->creator->createOneTableObject();
$this->assertFalse($object2->isNew());
- $found = lmbActiveRecord :: findFirst('TestOneTableObject', new lmbSQLRawCriteria('id=' . $object1->getId()));
+ $found = lmbActiveRecord :: findFirst('TestOneTableObject', new lmbSQLRawCriteria(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId()));
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
$this->assertEqual($found->get('id'), $object1->getId());
//testing convenient alias
- $found = TestOneTableObject :: findFirst(new lmbSQLRawCriteria('id=' . $object1->getId()));
+ $found = TestOneTableObject :: findFirst(new lmbSQLRawCriteria(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId()));
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
@@ -379,14 +379,14 @@
$object2 = $this->creator->createOneTableObject();
$this->assertFalse($object2->isNew());
- $found = lmbActiveRecord :: findFirst('TestOneTableObject', array('id=?', $object1->getId()));
+ $found = lmbActiveRecord :: findFirst('TestOneTableObject', array(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=?', $object1->getId()));
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
$this->assertEqual($found->get('id'), $object1->getId());
//testing convenient alias
- $found = TestOneTableObject :: findFirst(array('id=?', $object1->getId()));
+ $found = TestOneTableObject :: findFirst(array(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=?', $object1->getId()));
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
@@ -430,14 +430,14 @@
$object2 = $this->creator->createOneTableObject();
$this->assertFalse($object2->isNew());
- $found = lmbActiveRecord :: findOne('TestOneTableObject', 'id=' . $object1->getId());
+ $found = lmbActiveRecord :: findOne('TestOneTableObject', lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId());
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
$this->assertEqual($found->get('id'), $object1->getId());
//testing convenient alias
- $found = TestOneTableObject :: findOne('id=' . $object1->getId());
+ $found = TestOneTableObject :: findOne(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId());
$this->assertEqual($found->get('annotation'), $object1->get('annotation'));
$this->assertEqual($found->get('content'), $object1->get('content'));
$this->assertEqual($found->get('news_date'), $object1->get('news_date'));
@@ -532,14 +532,14 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- $rs = lmbActiveRecord :: find('TestOneTableObject', 'id=' . $object2->getId());
+ $rs = lmbActiveRecord :: find('TestOneTableObject', lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object2->getId());
$rs->rewind();
$this->assertEqual($object2->getId(), $rs->current()->getId());
$rs->next();
$this->assertFalse($rs->valid());
//testing convenient alias
- $rs = TestOneTableObject :: find('id=' . $object2->getId());
+ $rs = TestOneTableObject :: find(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object2->getId());
$rs->rewind();
$this->assertEqual($object2->getId(), $rs->current()->getId());
$rs->next();
@@ -551,14 +551,14 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- $rs = lmbActiveRecord :: find('TestOneTableObject', array('id=?', $object2->getId()));
+ $rs = lmbActiveRecord :: find('TestOneTableObject', array(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=?', $object2->getId()));
$rs->rewind();
$this->assertEqual($object2->getId(), $rs->current()->getId());
$rs->next();
$this->assertFalse($rs->valid());
//testing convenient alias
- $rs = TestOneTableObject :: find(array('id=?', $object2->getId()));
+ $rs = TestOneTableObject :: find(array(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=?', $object2->getId()));
$rs->rewind();
$this->assertEqual($object2->getId(), $rs->current()->getId());
$rs->next();
@@ -694,7 +694,7 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- $rs = lmbActiveRecord :: findBySql('TestOneTableObject', 'select * from test_one_table_object order by id desc');
+ $rs = lmbActiveRecord :: findBySql('TestOneTableObject', 'select * from ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("test_one_table_object") . ' order by ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . ' desc');
$rs->rewind();
$this->assertEqual($object2->getId(), $rs->current()->getId());
$rs->next();
@@ -703,7 +703,7 @@
$this->assertFalse($rs->valid());
//testing convenient alias
- $rs = TestOneTableObject :: findBySql('select * from test_one_table_object order by id desc');
+ $rs = TestOneTableObject :: findBySql('select * from ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("test_one_table_object") . ' order by ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . ' desc');
$rs->rewind();
$this->assertEqual($object2->getId(), $rs->current()->getId());
$rs->next();
@@ -717,11 +717,11 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- $object = lmbActiveRecord :: findFirstBySql('TestOneTableObject', 'select * from test_one_table_object order by id desc');
+ $object = lmbActiveRecord :: findFirstBySql('TestOneTableObject', 'select * from ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("test_one_table_object") . ' order by ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . ' desc');
$this->assertEqual($object2->getId(), $object->getId());
//testing convenient alias
- $object = TestOneTableObject :: findFirstBySql('select * from test_one_table_object order by id desc');
+ $object = TestOneTableObject :: findFirstBySql('select * from ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("test_one_table_object") . ' order by ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . ' desc');
$this->assertEqual($object2->getId(), $object->getId());
}
@@ -730,11 +730,11 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- $object = lmbActiveRecord :: findOneBySql('TestOneTableObject', 'select * from test_one_table_object order by id desc');
+ $object = lmbActiveRecord :: findOneBySql('TestOneTableObject', 'select * from ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("test_one_table_object") . ' order by ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . ' desc');
$this->assertEqual($object2->getId(), $object->getId());
//testing convenient alias
- $object = TestOneTableObject :: findOneBySql('select * from test_one_table_object order by id desc');
+ $object = TestOneTableObject :: findOneBySql('select * from ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("test_one_table_object") . ' order by ' . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . ' desc');
$this->assertEqual($object2->getId(), $object->getId());
}
@@ -976,7 +976,7 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- lmbActiveRecord :: updateRaw('TestOneTableObject', 'ordr=1');
+ lmbActiveRecord :: updateRaw('TestOneTableObject', lmbActiveRecord::getDefaultConnection()->quoteIdentifier("ordr") . '=1');
$rs = lmbActiveRecord :: find('TestOneTableObject');
$rs->rewind();
@@ -992,7 +992,7 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- TestOneTableObject :: updateRaw('ordr=1');
+ TestOneTableObject :: updateRaw(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("ordr") . '=1');
$rs = TestOneTableObject :: find();
$rs->rewind();
@@ -1008,7 +1008,7 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- lmbActiveRecord :: updateRaw('TestOneTableObject', array('content' => 'blah'), 'id=' . $object2->getId());
+ lmbActiveRecord :: updateRaw('TestOneTableObject', array('content' => 'blah'), lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object2->getId());
$rs = lmbActiveRecord :: find('TestOneTableObject');
$rs->rewind();
@@ -1024,7 +1024,7 @@
$object1 = $this->creator->createOneTableObject();
$object2 = $this->creator->createOneTableObject();
- TestOneTableObject :: updateRaw(array('content' => 'blah'), 'id=' . $object2->getId());
+ TestOneTableObject :: updateRaw(array('content' => 'blah'), lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object2->getId());
$rs = TestOneTableObject :: find();
$rs->rewind();
Modified: 3.x/trunk/limb/dbal/src/drivers/linter/lmbLinterTypeInfo.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/linter/lmbLinterTypeInfo.class.php 2008-03-18 17:10:33 UTC (rev 6844)
+++ 3.x/trunk/limb/dbal/src/drivers/linter/lmbLinterTypeInfo.class.php 2008-03-19 15:45:47 UTC (rev 6845)
@@ -24,7 +24,9 @@
'INT' => LIMB_DB_TYPE_INTEGER,
'BIGINT' => LIMB_DB_TYPE_DECIMAL,
'BYTE' => LIMB_DB_TYPE_CHAR,
+ 'NCHAR VARYING' => LIMB_DB_TYPE_VARCHAR,
'NCHAR_VARYING' => LIMB_DB_TYPE_VARCHAR,
+ 'NCHAR' => LIMB_DB_TYPE_VARCHAR,
'REAL' => LIMB_DB_TYPE_FLOAT,
'FLOAT' => LIMB_DB_TYPE_FLOAT,
'cash' => LIMB_DB_TYPE_FLOAT,
More information about the limb-svn
mailing list