crud problem in unix/linux type system

followed the instructions of your tutorial about creating the first webapp, I found out there is no problem creating crud page on win platform but not on unix/linux platform . it always alerts "no primary key".

my setting inside config/main.php about db is

'db'=>array(

		'username' => 'XXXX',


		'password' => 'YYYYY',


		'autoConnect' => true,


		'persistent' => true,


		'connectionString'=>'mysql:host=localhost;dbname=test;',


	),

tested under XP is ok but no for both freebsd and ubuntu

Should it be:

'db'=>array(

        'class'=>'CDbConnection',

        'username' => 'XXXX',

        'password' => 'YYYYY',

        'autoConnect' => true,

        'persistent' => true,

        'connectionString'=>'mysql:host=localhost;dbname=test;',

      ),

?

What is version of MySQL on your linux? What is the execution result of the SQL "SHOW CREATE TABLE tableName" ?

mysql 5.1.X.X  I forgot and newly installed into ubuntu server inside vmplayer

php 5.2.X 

show create table result:

CREATE TABLE user (

  id int(11) NOT NULL auto_increment,

  username varchar(128) NOT NULL,

  password varchar(128) NOT NULL,

  email varchar(128) NOT NULL,

  PRIMARY KEY  (id)

) ENGINE=MyISAM DEFAULT CHARSET=utf8

Followed jonah to add a line ,

        'class'=>'CDbConnection',

error still occurs.

Oh, sorry, I should ask what is the output of executing SQL "SHOW COLUMNS FROM tableName" ?

I have restart a new folder to redo the tutorial again but errors still occurs.  here is the log:

Stack trace:

#0 /var/www/yii/framework/db/CDbCommand.php(231): CDbCommand->queryInternal('fetch', 2)

#1 /var/www/yii/framework/db/schema/mysql/CMysqlSchema.php(165): CDbCommand->queryRow()

#2 /var/www/yii/framework/db/schema/mysql/CMysqlSchema.php(68): CMysqlSchema->findConstraints(Object(CMysqlTableSchema))

#3 /var/www/yii/framework/db/schema/CDbSchema.php(72): CMysqlSchema->createTable('user')

#4 /var/www/yii/framework/cli/commands/shell/ModelCommand.php(95): CDbSchema->getTable('user')

#5 [internal function]: ModelCommand->generateModel('/var/www/yii/fr…', Array)

#6 /var/www/yii/framework/console/CConsoleCommand.php(116): call_user_func(Array, '/var/www/yii/fr…', Array)

#7 /var/www/yii/framework/cli/commands/shell/ModelCommand.php(72): CConsoleCommand->copyFiles(Array)

#8 /var/www/yii/framework/cli/commands/ShellCommand.php(98): ModelCommand->run(Array)

#9 /var/www/yii/framework/cli/commands/ShellCommand.php(78): ShellCommand->runShell()

#10 /var/www/yii/framework/console/CConsoleCommandRunner.php(62): ShellCommand->run(Array)

#11 /var/www/yii/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)

#12 /var/www/yii/framework/base/CApplication.php(146): CConsoleApplication->processRequest()

#13 /var/www/yii/framework/yiic.php(30): CApplication->run()

#14 /var/www/yii/framework/yiic(15): require_once('/var/www/yii/fr…')

and my phpinfo() shows

PDO

PDO support enabled

PDO drivers mysql

pdo_mysql

PDO Driver for MySQL, client library version 5.0.67

I doubt that the  driver doesnt support  the CActiveRecord

missing log:

exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet' in /var/www/yii/framework/db/CDbCommand.php:284

So what is the output of "SHOW COLUMNS FROM tableName" ?

Also, check this: http://www.yiiframew…#emulatePrepare

You may need to set this property to be true. This is related with PDO, not AR.

thx for your help. it works now.

'db'=>array(

        'class'=>'CDbConnection',

        'emulatePrepare' => true,

        'username' => 'XXXX',

        'password' => 'YYYYY',

        'autoConnect' => true,

        'persistent' => true,

        'connectionString'=>'mysql:host=localhost;dbname=test;',

      ),