易截截图软件、单文件、免安装、纯绿色、仅160KB

SQLITE入门 逐步讲解SQLITE命令行(六)


.nullvalue STRING 用STRING代替null值显示,不难理解,就不再累述了。
.output FILENAME 设置把查询输出到文件,后面的输出结果都保存到文件中,如:
sqlite> .mode list
sqlite> .output websites.txt
sqlite> select * from websites;
sqlite>
可以在F盘下发现建立了websites.txt文件,其内容如下:
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
5|技术
.output stdout 设置把查询结果输出到屏幕,这是默认输出方式。如:
sqlite> .output stdout
sqlite> select * from websites;
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
5|技术
sqlite>
.prompt MAIN CONTINUE Replace the standard prompts(修改提示符)请补充?
.quit 退出SQLite程序,同.exit命令
.read FILENAME Execute SQL in FILENAME 执行文件中的SQL语句,文件中的语句一定要带上分号(;).
我们在F盘下建sqldata.txt文件,其内容为:
insert into websites(WebName) values('测试插入数据0');
insert into websites(WebName) values('测试插入数据1');
select * from websites;
我们执行.read命令如下:
sqlite> .read sqldata.txt
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
5|技术
6|测试插入数据0
7|测试插入数据1
sqlite>
.schema ?TABLE? Show the Create statements 以SQL格式输出表结构,如:
sqlite> .schema websites
CREATE TABLE [websites] (
[WebID] INTEGER NOT NULL PRIMARY KEY,
[WebName] VARCHAR(20) NULL
);
CREATE INDEX mytestindex on websites([webID]);
sqlite>
.separator STRING Change separator used by output mode and .import 修改分隔符,如:
sqlite> select * from websites limit 4;
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
sqlite> .separator /
sqlite> select * from websites limit 4;
1/CTOChina.net
2/搜狐
3/雅虎
4/开源
sqlite>
.show Show the current values for various settings 显示配置信息,如:
sqlite> .show
echo: off
explain: off
headers: off
mode: list
nullvalue: ""
output: stdout
separator: "/"
width:
sqlite>
.tables ?PATTERN? List names of tables matching a LIKE pattern 显示库中表的列表。
.timeout MS Try opening locked tables for MS milliseconds 超时时间,单位:毫秒
.width NUM NUM ... Set c


相关文档:

SQLite Tutorial in PHP

 
SQLite Tutorial in PHP
SQLite is an SQL database manager used locally or on a website, and compatible
in particularly with PHP.
Summary
Installing SQLite and creating a database
.
Installing SQLite. Verifying the installation by creating a base.
Creating and using a SQLite tabl ......

rails使用sqlite3和mysql的问题

1、如果使用sqlite3时出现如下错误:
/!\ FAILSAFE /!\  Thu Jul 30 22:16:15 +0800 2009
  Status: 500 Internal Server Error
  unknown error
    c:/ruby/lib/ruby/1.8/dl/import.rb:29:in `initialize'
    c:/ruby/lib/ruby/1.8/dl/import.rb:29:in `dlopen'
&nb ......

Sqlite实现默认时间为当前时间列的方法

    在SQL Server中,创建表格的时候,对于时间列有时候我们可以根据需要指定默认值为当前时间(也就是说记录生成的时候有默认的时间戳)。例如:
    create table log(
content varchar(256),
logtime datetime default getdate()
)
  
    然 ......

Sqlite DB使用例子

前一阵字做项目(嵌入式linux),由于要保存大量的数据,而且最长要保存30天的时间。本来打算保存到文件中,每次启动应用程序的时候重新解析一遍,可是当数据量很大的时候,就出现效率的问题了。所以最后还是放弃了使用文件的打算,决定使用数据库存取数据。
linux下的数据库也很多,有开源的,也有收费的。对于我们来说,肯 ......

Sqlite DateTime 类型 读取和写入格式注意的问题

本文转载自 http://www.tntserver.cn/article.asp?id=41
今天遇到个问题.
首先插入一个DataTime格式的数据:
string sql="insert into [table] (date_time) values('" + date_time.ToString() + "'";
执行如上命令.插入没有报告错误.
但是,我又用一条命令读取时:
string sql="select * from [table];
.....
IDataRea ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号