Приобрел данную книгу. http://www.packtpub.com/yii-rapid-appli ... tshot/book
Думаю тема подойдет под раздел документации. К тому же сам Sam Dark причастен к сему творению.
В главе 4, где рассматривается RBAC, при настройке проекта, столкнулся с ошибкой при выполнении запроса из schema.sql https://github.com/nsanitate/yii-exerci ... schema.sql
При вставке данных в таблицу book не совпадает количество полей в таблице 13, с количеством вставляемых данных 12.
Погуглив, я не нашел, чтобы кто-то столкнулся с этим. Может кто сталкивался?
Книга Yii Rapid Application Development Hotspot - ch4 Rbac
Re: Книга Yii Rapid Application Development Hotspot - ch4 Rb
какаю БД? там последнее поле current_timestamp, проблем быть не должно
Re: Книга Yii Rapid Application Development Hotspot - ch4 Rb
База MySQL.
Error : Column count doesn't match value count at row 1
Повторил на домашнем компьютере. Такая же ошибка.
Error : Column count doesn't match value count at row 1
Повторил на домашнем компьютере. Такая же ошибка.
- samdark
- Администратор
- Сообщения: 9489
- Зарегистрирован: 2009.04.02, 13:46
- Откуда: Воронеж
- Контактная информация:
Re: Книга Yii Rapid Application Development Hotspot - ch4 Rb
Пишите авторам. Я участвовал как reviewer отдельных глав, рассказывал авторам про явные косяки в описаниях и, собственно, всё. Код я не проверял.
Нравится Yii? Давайте сделаем его лучше!.
Re: Книга Yii Rapid Application Development Hotspot - ch4 Rb
Авторы ответили. Может кому сгодится
We got in touch with the support team and they informed that the offending line is Chapter 4/protected/data/schema.sql line 36.
Insert statement provided there is syntactically incorrect. Maybe it was working in previous versions of MySQL but at least with MySQL 5.5 it does not.
This insert statement does not declare the columns of records to be inserted and records themselves have the last column `create_time` omitted completely. Most possibly the intention was to let MySQL fill this column with the default value (which should be the CURRENT_TIMESTAMP value), but MySQL gives error to us instead.
Fix is obvious here, however, we need to provide the list of columns to be inserted. Change the
INSERT INTO `book` VALUES
to
INSERT INTO `book` (`id`, `title`, `type_id`, `publication_date`, `value`, `price`, `notes`, `signed`, `grade_id`, `bagged`, `publisher_id`, `issue_number`) VALUES
That is, list all fields except `create_time`, which we do not provide value for anyway. Now the query should correctly insert records to `book` table.
We haven't uploaded this on the site as of now but will upload it once the author confirms us. We would inform you once we upload this erratum on our site.