SQLite bug?

I have a simple table in a sqlite database called Unit with three fields: id, name and description.

When I try to execute any writable operation within the classess generated by the CRUD option in shell - like UPDATE or INSERT (DELETE works like a charm) - it gives me an internal server error with message:

error:




SQL: SQLSTATE[23000]: Integrity constraint violation: 19 unit.name may not be NULL



sql log from profiler:




system.db.CDbCommand.execute(INSERT INTO 'unit' ("id") VALUES (NULL))

system.db.CDbCommand.query(PRAGMA table_info('unit'))

system.db.CDbCommand.query(PRAGMA foreign_key_list('unit'))



You probably try to insert a null value in a column that doesn’t accept null.


INSERT INTO 'unit' ("id") VALUES (NULL)

This tries to insert a row with null name and null description

No, I didn’t do anything. Just used webapp’s create form:




	public function actionCreate()

	{

		$model=new Unit;

		if(isset($_POST['Unit']))

		{

			$model->attributes=$_POST['Unit'];

			if($model->save())

				$this->redirect(array('show','id'=>$model->id));

		}

		$this->render('create',array('model'=>$model));

	}



Check if the attributes you use in the form are in the safe attributes in the model class

my bad :blink:

that did the trick, thank you so much