by agate - Published: 2008-09-17 [5:39 下午] - Category: 数据库

从 MySQL 迁移到 SQLite 发现了很多原有程序中出现错误…… 这个问题我也在 <<Agile Web Development With Rails>> 书中的 Depot 工程里体会到了 now 的问题, 在这个文章中作为这些小区别的一个累计.

1. 日期类
SQLite包含了如下时间/日期函数:
datetime().......................产生日期和时间
date()..............................产生日期
time()..............................产生时间
strftime()........................对以上三个函数产生的日期和时间进行格式化
(以上函数都可加参数)

2. Boolean 类型
普通的 SQL 语句都可以直接使用 FALSE 和 TRUE 关键字执行. 但是 SQLite 必须使用 't' 和 '0' (注意必须小写)

[ 不断更新中... ]

Tags: [ ] - Comments: View Comments
by agate - Published: 2008-06-18 [5:31 下午] - Category: 程序编码

if you are using rails 2.0+. congratulations! your rails default db engine is sqlite3 and you don't need to do any other work. just type the command:
$rails {your app name}
if you are using rails 1.2.6 or older version. the sqlite3 is not the default db engine for the project. but you can use one command to create the sqlite3 base app.
$rails {your app name} -d sqlite3

ps. if you get the error when you runing the server. it maybe cause by the db engine. make sure you have install the sqlite3-ruby gem.
$sudo gem install sqlite3-ruby

Tags: [ , ] - Comments: View Comments