CakePHP Cookbook 2.x
AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50), body TEXT, created DATETIME DEFAULT NULL, modified DATETIME DEFAULT NULL ); /* Then insert some posts for testing: */ INSERT INTO posts (title, body, created) index() { $this->set('posts', $this->Post->find('all')); } public function view($id = null) { if (!$id) { throw new NotFoundException(__('Invalid post')); } Here’s what the edit() action of the PostsController would look like: public function edit($id = null) { if (!$id) { throw new NotFoundException(__('Invalid post')); } $post = $this0 码力 | 1096 页 | 958.62 KB | 1 年前3CakePHP Cookbook 4.x
VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, created DATETIME, modified DATETIME ); CREATE TABLE articles ( id INT AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, title VARCHAR(255) VARCHAR(255) NOT NULL, slug VARCHAR(191) NOT NULL, body TEXT, published BOOLEAN DEFAULT FALSE, created DATETIME, modified DATETIME, UNIQUE KEY (slug), FOREIGN KEY user_key (user_id) UNIQUE KEY (title) ) CHARSET=utf8mb4; CREATE TABLE articles_tags ( article_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY (article_id, tag_id), FOREIGN KEY tag_key(tag_id) REFERENCES tags(id)0 码力 | 1249 页 | 1.04 MB | 1 年前3CakePHP Cookbook Documentation 5.x
VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, created DATETIME, modified DATETIME ); CREATE TABLE articles ( id INT AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, title VARCHAR(255) VARCHAR(255) NOT NULL, slug VARCHAR(191) NOT NULL, body TEXT, published BOOLEAN DEFAULT FALSE, created DATETIME, modified DATETIME, UNIQUE KEY (slug), FOREIGN KEY user_key (user_id) UNIQUE KEY (title) ) CHARSET=utf8mb4; CREATE TABLE articles_tags ( article_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY (article_id, tag_id), FOREIGN KEY tag_key(tag_id) REFERENCES tags(id)0 码力 | 1080 页 | 939.39 KB | 1 年前3CakePHP Cookbook 3.x
VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, created DATETIME, modified DATETIME ); CREATE TABLE articles ( id INT AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, title VARCHAR(255) VARCHAR(255) NOT NULL, slug VARCHAR(191) NOT NULL, body TEXT, published BOOLEAN DEFAULT FALSE, created DATETIME, modified DATETIME, UNIQUE KEY (slug), FOREIGN KEY user_key (user_id) UNIQUE KEY (title) ) CHARSET=utf8mb4; CREATE TABLE articles_tags ( article_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY (article_id, tag_id), FOREIGN KEY tag_key(tag_id) REFERENCES tags(id)0 码力 | 1244 页 | 1.05 MB | 1 年前3Kotlin 1.9.10 官方文档 中文版
请注意 readLine() 函数调用之后的空断言操作符 !! 的使用。 Kotlin 的 readLine() 函数定义为返回可空类型 String? 并且在输入结束时返回 null ,这样显式迫使开发人员处理缺少输入的情况。 在竞技程序设计中无需处理输入格式错误的情况。 在竞技程序设计中,输入 格式总是精确指定并且实际输入不能偏离问题陈述中的输入规范。 这就是空 断言操作符 'org.samples/MyEnumClass.REMOVED_ENTRY|null[0]' Function 'getMyRemovedClass' can not be called: Function uses unlinked class symbol 'org.samples/MyRemovedClass|null[0]' You can further configure or even = ... class A { val s: String by impl } A constant expression, an enum entry, this , or null . Here's an example of this : class A { operator fun getValue(thisRef: Any?, property: KProperty<*>)0 码力 | 3753 页 | 29.69 MB | 1 年前3peewee Documentation Release 3.6.0
otherwise) Integers, floats, and Decimal numbers. Boolean values Dates, times and datetimes None (NULL) Binary data Creating tables In order to start using the models, its necessary to create the tables initialization arguments Parameters accepted by all field types and their default values: null = False – allow null values index = False – create an index on this column unique = False – create a unique index for fields when objects are created. For example to have an IntegerField default to zero rather than NULL, you could declare the field with a default value: class Message(Model): context = TextField()0 码力 | 377 页 | 399.12 KB | 1 年前3peewee Documentation Release 2.10.2
otherwise) Integers, floats, and Decimal numbers. Boolean values Dates, times and datetimes None (NULL) Binary data Creating tables In order to start using the models, its necessary to create the tables migrator = SqliteMigrator(my_db) title_field = CharField(default='') status_field = IntegerField(null=True) with my_db.transaction(): migrate( migrator.add_column('some_table', 'title', title_field) arguments Parameters accepted by all field types and their default values: null = False – boolean indicating whether null values are allowed to be stored index = False – boolean indicating whether to0 码力 | 275 页 | 276.96 KB | 1 年前3peewee Documentation Release 3.5.0
otherwise) Integers, floats, and Decimal numbers. Boolean values Dates, times and datetimes None (NULL) Binary data Creating tables In order to start using the models, its necessary to create the tables initialization arguments Parameters accepted by all field types and their default values: null = False – allow null values index = False – create an index on this column unique = False – create a unique index for fields when objects are created. For example to have an IntegerField default to zero rather than NULL, you could declare the field with a default value: class Message(Model): context = TextField()0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.0.0
otherwise) Integers, floats, and Decimal numbers. Boolean values Dates, times and datetimes None (NULL) Binary data Creating tables In order to start using the models, its necessary to create the tables ForeignKeyField('self', backref='recommended', column_name='recommendedby', null=True) joindate = DateTimeField() class Meta: table_name = 'members' # Conveniently recommendedby IS NOT NULL GROUP BY recommendedby ORDER BY recommendedby query = (Member .select(Member.recommendedby, fn.COUNT(Member.memid)) .where(Member.recommendedby.is_null(False))0 码力 | 319 页 | 361.50 KB | 1 年前3peewee Documentation Release 3.4.0
otherwise) Integers, floats, and Decimal numbers. Boolean values Dates, times and datetimes None (NULL) Binary data Creating tables In order to start using the models, its necessary to create the tables ForeignKeyField('self', backref='recommended', column_name='recommendedby', null=True) joindate = DateTimeField() class Meta: table_name = 'members' # Conveniently recommendedby IS NOT NULL GROUP BY recommendedby ORDER BY recommendedby query = (Member .select(Member.recommendedby, fn.COUNT(Member.memid)) .where(Member.recommendedby.is_null(False))0 码力 | 349 页 | 382.34 KB | 1 年前3
共 527 条
- 1
- 2
- 3
- 4
- 5
- 6
- 53