Sir*_*ber 7 php mysql orm redbean
从这段代码:
$toolbox = RedBean_Setup::kickstartDev("mysql:*****************");
$r = $toolbox->getRedBean();
$test = $r->dispense("test");
$test->nom = 'Test #1';
$test->date = '2010-07-08';
$test->date_deux = '08/07/2010';
$test->num = 5;
$id = $r->store( $test );
Run Code Online (Sandbox Code Playgroud)
我得到这个SQL:
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) unsigned NOT NULL auto_increment,
`nom` varchar(255) collate utf8_unicode_ci default NULL,
`date` varchar(255) collate utf8_unicode_ci default NULL,
`num` tinyint(3) unsigned default NULL,
`date_deux` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ;
--
-- Dumping data for table `test`
--
INSERT INTO `test` (`id`, `nom`, `date`, `num`, `date_deux`) VALUES
(1, 'Test #1', '2010-07-08', NULL, NULL),
(2, 'Test #1', '2010-07-08', 5, NULL),
(3, 'Test #1', '2010-07-08', 5, '08/07/2010'),
(4, 'Test #1', '2010-07-08', 5, '08/07/2010'),
(5, 'Test #1', '2010-07-08', 5, '08/07/2010');
Run Code Online (Sandbox Code Playgroud)
是否有一种特殊的方式date与RedBean 一起使用?
发现这个:http ://groups.google.com/group/redbeanorm/browse_thread/thread/6961ac635e6886f6
优化器现在会将具有日期时间值的列转换为日期时间字段。如果插入不同的值,OODB 将在流体模式下恢复该列。
| 归档时间: |
|
| 查看次数: |
21458 次 |
| 最近记录: |