Yii Framework Forum: Cdbauthmanager Error With Oracle Database - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cdbauthmanager Error With Oracle Database Rate Topic: -----

#1 User is offline   xsirro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 12-July 10

Posted 01 October 2012 - 04:15 AM

Hello,.. I am a newbie here, sorry for my bad english,

I start using yii authorization feature,

:using CDBAuthManager
:using ORACLE 10g
:using last yii version (got from svn)
:has created table AuthAssignment,AuthItem and AuthItemChild, using schema in framework
:has setup in main.php(config), component authManager
:has created
- role authenticated, bizRule=> 'return !Yii::app()->user->isGuest;'
- role guest, bizRule => 'return Yii::app()->user->isGuest;'
:has assign userid and role name using $auth->assign('admin',1);, 1 is the userid one of my user
:put Yii::app()->user->checkAccess('admin') at the beginning one of my controller

The problem is.. I got error like this :

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000] [904] OCIStmtExecute: ORA-00904: "USERID": invalid identifier. The SQL statement executed was: SELECT *
FROM "AuthAssignment"
WHERE userid=:userid

for comparation, above mentioned error would not happen when I use sqlite database for the authManager db.

Could someone help me? or face the same problem with me? I still hope can use oracle db for authManager db.

Thank you
0

#2 User is offline   xsirro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 12-July 10

Posted 01 October 2012 - 04:39 AM

View Postxsirro, on 01 October 2012 - 04:15 AM, said:

:put Yii::app()->user->checkAccess('admin') at the beginning one of my controller

I also has created admin role
$auth->createRole('admin', 'administrator');
0

#3 User is offline   Lilt 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 06-July 10

Posted 01 October 2012 - 04:59 AM

I've never used Oracle, but it looks to me like Oracle must keep USERID as a reserved word, much like ORDER or SELECT. Obviously as the framework claims compatibility with Oracle, these column names should be identified as such using backticks (`). I'd search and replace on framework/web/auth/CDbAuthManager.php file as a quick fix. Replacing "userid=" with "`userid`=" should get them all.
0

#4 User is offline   xsirro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 12-July 10

Posted 01 October 2012 - 03:10 PM

Thanks for quick fix tips, I've added backticks (`)as you suggested, unfortunately, it raises error like this :

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000] [911] OCIStmtExecute: ORA-00911: invalid character. The SQL statement executed was: SELECT *
FROM "AuthAssignment"
WHERE `userid`=:userid
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users