Postgresql Orm Doesn't Have Any Exception Control

Hi,

I have a geo-spatial project and I decided to use postgreSql rather than mysql and the way you implemented the ORM for postgres is loose and has loads of unexpected errors.

For example if I try to enter an invalid data or an invalid key I will redirected to exception page rather than getting a proper error msg inside form.

this is my connection string, let me know if you need further information




		'db'=>array(

			'connectionString' => 'pgsql:host=localhost;port=5432;dbname=db',


			'username' => 'postgres',

			'password' => '123456',

			'charset' => 'utf8',

		),

Best

All DB drivers are working the same way throwing exceptions. If you need you can use try-catch to handle these. As for form fields and errors, there are validation rules that should be enough to make sure all data is fine before saving it.

No it’s not work the same way

In my particular example when I create a field in postgreSql with type of Point.

when I want to search it using the regular CRUD search tool I always get such error :




Error 500: <h1>CDbException</h1>

<p>CDbCommand failed to execute the SQL statement: SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: point ~~ unknown

LINE 1: SELECT COUNT(*) FROM "advertise" "t" WHERE lat_lon LIKE $1

                                                           ^

HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.. The SQL statement executed was: SELECT COUNT(*) FROM "advertise" "t" WHERE lat_lon LIKE :ycp0 (/var/www/yii/framework/db/CDbCommand.php:528)</p><pre>#0 /var/www/yii/framework/db/CDbCommand.php(425): CDbCommand->queryInternal('fetchColumn', 0, Array)

#1 /var/www/yii/framework/db/ar/CActiveRecord.php(1540): CDbCommand->queryScalar()

#2 /var/www/yii/framework/web/CActiveDataProvider.php(179): CActiveRecord->count(Object(CDbCriteria))

#3 /var/www/yii/framework/web/CDataProvider.php(193): CActiveDataProvider->calculateTotalItemCount()

#4 /var/www/yii/framework/web/CActiveDataProvider.php(129): CDataProvider->getTotalItemCount()

#5 /var/www/yii/framework/web/CDataProvider.php(137): CActiveDataProvider->fetchData()

#6 /var/www/yii/framework/zii/widgets/CBaseListView.php(108): CDataProvider->getData()

#7 /var/www/yii/framework/zii/widgets/grid/CGridView.php(289): CBaseListView->init()

#8 /var/www/yii/framework/web/CBaseController.php(148): CGridView->init()

#9 /var/www/yii/framework/web/CBaseController.php(173): CBaseController->createWidget('zii.widgets.gri...', Array)

#10 /var/www/blog/protected/views/advertise/admin.php(58): CBaseController->widget('zii.widgets.gri...', Array)

#11 /var/www/yii/framework/web/CBaseController.php(127): require('/var/www/blog/p...')

#12 /var/www/yii/framework/web/CBaseController.php(96): CBaseController->renderInternal('/var/www/blog/p...', Array, true)

#13 /var/www/yii/framework/web/CController.php(870): CBaseController->renderFile('/var/www/blog/p...', Array, true)

#14 /var/www/yii/framework/web/CController.php(783): CController->renderPartial('admin', Array, true)

#15 /var/www/blog/protected/controllers/AdvertiseController.php(143): CController->render('admin', Array)

#16 /var/www/yii/framework/web/actions/CInlineAction.php(50): AdvertiseController->actionAdmin()

#17 /var/www/yii/framework/web/CController.php(309): CInlineAction->runWithParams(Array)

#18 /var/www/yii/framework/web/filters/CFilterChain.php(134): CController->runAction(Object(CInlineAction))

#19 /var/www/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()

#20 /var/www/yii/framework/web/CController.php(1146): CFilter->filter(Object(CFilterChain))

#21 /var/www/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))

#22 /var/www/yii/framework/web/filters/CFilterChain.php(131): CInlineFilter->filter(Object(CFilterChain))

#23 /var/www/yii/framework/web/CController.php(292): CFilterChain->run()

#24 /var/www/yii/framework/web/CController.php(266): CController->runActionWithFilters(Object(CInlineAction), Array)

...

I think the yii’s ORM needs to take care of this kind of special datatypes as well if I want to write sql statement for these special cases then what is the usage of framework?