??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品自拍偷拍,国内伊人久久久久久网站视频 ,精品久久久久久久久久久下田http://www.aygfsteel.com/WshmAndLily/articles/173442.htmlsemovysemovyMon, 07 Jan 2008 12:14:00 GMThttp://www.aygfsteel.com/WshmAndLily/articles/173442.htmlhttp://www.aygfsteel.com/WshmAndLily/comments/173442.htmlhttp://www.aygfsteel.com/WshmAndLily/articles/173442.html#Feedback0http://www.aygfsteel.com/WshmAndLily/comments/commentRss/173442.htmlhttp://www.aygfsteel.com/WshmAndLily/services/trackbacks/173442.html-------------------------------------------
----- teckotooling database schema --------
----- hsqldb-------------------------------
-------------------------------------------
drop table page if exists ;
--面?br /> create table page
(
 page_id int not null identity primary key ,
 page_name varchar(12) not null,
 title_en varchar(128) default '',
 title_cn varchar(128) default '',
 title_hk varchar(128) default '',
 keyword_en varchar(128) default '',
 keyword_cn varchar(128) default '',
 keyword_hk varchar(128) default '', 
 title_content_en varchar(64) default '',
 title_content_cn varchar(64) default '',
 title_content_hk varchar(64) default '',
 content_en longvarchar  default '',
 content_cn longvarchar default '',
 content_hk longvarchar  default '', 
 readTimes int default 0,
 unique(page_name)
);
drop table if exists comment;
drop table if exists advancedInfo;
drop table if exists basicInfoDoc;
drop table if exists basicInfoImg;
drop table if exists basicInfoText;
drop table item if exists ;
drop table category if exists ;
--cdpdc?br /> create table category
(
 category_id int not null identity primary key ,
 categoryName_en varchar(64) not null,-- unique ,
 categoryName_cn varchar(64) not null,-- unique ,
 categoryName_hk varchar(64) not null,-- unique ,
 description_en longvarchar  default '',
 description_cn longvarchar  default '',
 description_hk longvarchar  default '',
 img varchar(32) default '',
 unique(category_id),
 unique(categoryName_en),
 unique(categoryName_cn),
 unique(categoryName_hk)
);

--目?br /> create table item
(
 item_id int not null identity primary key ,
 item_no varchar(6) not null,
 category_id int not null ,
 itemName_en varchar(64) not null,-- unique ,
 itemName_cn varchar(64) not null,-- unique ,
 itemName_hk varchar(64) not null,-- unique ,
 img varchar(64),
 publishedDt timestamp,
 lastOne char(1) default 'n',
 visible char(1) default 'y',
 readTimes int default 0,
 unique(item_no),
 unique(itemname_en),
 unique(itemname_cn),
 unique(itemname_hk),
        foreign key(category_id) references category(category_id) on update cascade on delete cascade
);

--基本文本属性表
create table basicInfoText
(
 id int not null identity primary key ,
 item_id int not null,
 propertyName_en varchar(128) not null,
 propertyName_cn varchar(128) not null,
 propertyName_hk varchar(128) not null,
 propertyValue_en varchar(256) default '',
 propertyValue_cn varchar(256) default '',
 propertyValue_hk varchar(256) default '',
 unit_en varchar(32) default '',
 unit_cn varchar(32) default '',
 unit_hk varchar(32) default '',
 visible char(1) default 'y',
 foreign key(item_id) references item(item_id) on update cascade on delete cascade
);

--基本囄属性表
create table basicInfoImg
(
 id int not null identity primary key ,
 item_id int not null ,
 imgName_en varchar(64),
 imgName_cn varchar(64),
 imgName_hk varchar(64),
 imgUrl varchar(64),
 visible char(1) default 'y',
 foreign key(item_id) references item(item_id) on update cascade on delete cascade
);

--基本囄属性表
create table basicInfoDoc
(
 id int not null identity primary key ,
 item_id int not null ,
 docName_en varchar(128),
 docName_cn varchar(128),
 docName_hk varchar(128),
 docUrl varchar(64),
 size varchar(16) default '',
 contentType varchar(32) default '',
 readTimes int,
 enable char(1) default 'y',
 password varchar(32),
 visible char(1) default 'y',
 foreign key(item_id) references item(item_id) on update cascade on delete cascade
);

--详细属性表
create table advancedInfo
(
 id int not null identity primary key ,
 item_id int not null ,
 content_en longvarchar ,
 content_cn longvarchar ,
 content_hk longvarchar ,
 visible char(1) default 'y',
 foreign key(item_id) references item(item_id) on update cascade on delete cascade
);

--评论?br /> create table comment
(
 id int not null identity primary key,
 item_id int not null ,
 commenter varchar(32) not null,
 dateTime timestamp,
 content longvarchar default '',
 visible char(1) default 'y',
 foreign key(item_id) references item(item_id) on update cascade on delete cascade
);
drop table if exists leadWord;
--留言?br /> create table leadWord
(
 id int not null identity primary key ,
 leadWorder varchar(32) not null,
 dateTime timestamp,
 content longvarchar  default '',
 visible char(1) default 'y'
);
drop table if exists otherConfig;
--创徏其它讄?br /> create table otherConfig
(
 id int not null primary key,
 enablePress char(1) default 'y',
 isImagePress char(1) default 'y',
 textPress varchar(32) default '',
 imagePress varchar(32) default '',
 userFaceStyle varchar(32) default '',
 afficheEn longvarchar  default '',
 afficheCn longvarchar  default '',
 afficheHk longvarchar  default ''  
);

drop table if exists user_auth;
drop table if exists user;
drop table if exists authority;
--用户?br /> create table user
(
 user_id int not null identity primary key ,
 user_name varchar(32) not null,
 password varchar(32),
 ENABLED tinyint default 0
);

--用户权限表连接表
create table user_auth
(
 user_id int not null,
 auth_id int not null,
 primary key(user_id,auth_id),
   foreign key(user_id) references user(user_id) on update cascade on delete cascade
);

--创徏权限?br /> create table authority
(
 auth_id int not null identity primary key ,
 authority varchar(255) not null,
 auth_type varchar(32) not null,
 protected_res varchar(128) not null,
 display varchar(64) not null,
 note varchar(64) default null
) ;


--初始化表

--用户?br /> insert into user values(1,'admin','21232f297a57a5a743894a0e4a801fc3',1);
--面?br /> insert into page
 values(1,'home','home','home','home','home','home','home','home','home','home','home','home','home',0);
insert into page
 values (2,'about','about','about','about','about','about','about','about','about','about','about','about','about',0);
 insert into page
 values(3,'product','product','product','product','product','product','product','product','product','product','product','product','product',0);
 insert into page
 values(4,'services','services','services','services','services','services','services','services','services','services','services','services','services',0);
 insert into page
 values(5,'contactUs','contactUs','contactUs','contactUs','contactUs','contactUs','contactUs','contactUs','contactUs','contactUs','contactUs','contactUs','contactUs',0);
--其它讄
insert into otherConfig values(1,'y','y','semovy@gmail.com','logo.gif','blue.css','affiche here...','公告在此……','公告在此……');
--初始资源鉴定?/p>

--目资源保护鉴定
   INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (1,'AUTH_FUNC_ItemManager.saveItem','FUNCTION','com.semovy.service.IItemService.saveItem','创徏目',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (2,'AUTH_FUNC_ItemManager.updateItem','FUNCTION','com.semovy.service.IItemService.updateItem','更新目',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (3,'AUTH_FUNC_ItemManager.deleteItemById','FUNCTION','com.semovy.service.IItemService.deleteItemById','删除目',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (4,'AUTH_FUNC_ItemManager.outPutXMLItem','FUNCTION','com.semovy.service.IItemService.outPutXMLItem','讉K目理',NULL);
  --面资源
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (5,'AUTH_FUNC_PageManager.updatePage','FUNCTION','com.semovy.service.IPageService.updatePage','修改面',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (6,'AUTH_FUNC_PageManager.outPutPageXML','FUNCTION','com.semovy.service.IPageService.outPutPageXML','讉K理面',NULL);
  --其它理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (7,'AUTH_FUNC_OtherconfigManager.updateOtherconfig','FUNCTION','com.semovy.service.IOtherconfigService.updateOtherconfig','修改其它理',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (8,'AUTH_FUNC_OtherconfigManager.outPutOtherconfigXML','FUNCTION','com.semovy.service.IOtherconfigService.outPutOtherconfigXML','讉K其它理',NULL);
  --用户理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (9,'AUTH_FUNC_UserManager.updateUser','FUNCTION','com.semovy.service.IUserService.updateUser','修改用户',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (10,'AUTH_FUNC_UserManager.outPutUsersListXML','FUNCTION','com.semovy.service.IUserService.outPutUsersListXML','讉K用户理',NULL);
  --留言理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (11,'AUTH_FUNC_LeadwordManager.updateUser','FUNCTION','com.semovy.service.ILeadwordService.updateLeadword','修改留言',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (12,'AUTH_FUNC_LeadwordManager.outPutUsersListXML','FUNCTION','com.semovy.service.ILeadwordService.deleteLeadwordById','删除一条留a',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES  
  (13,'AUTH_FUNC_LeadwordManager.getLeadWordsOfPageByCriteria','FUNCTION','com.semovy.service.ILeadwordService.getLeadWordsOfPageByCriteria','获取分页留言',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (14,'AUTH_FUNC_LeadwordManager.outPutXMLLeadword','FUNCTION','com.semovy.service.ILeadwordService.outPutXMLLeadword','讉K留言理',NULL);   
  --评论理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (15,'AUTH_FUNC_CommentManager.updateComment','FUNCTION','com.semovy.service.ICommentService.updateComment','修改评论',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (16,'AUTH_FUNC_CommentManager.deleteCommentById','FUNCTION','com.semovy.service.ICommentService.deleteCommentById','删除一条评?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES  
  (17,'AUTH_FUNC_CommentManager.outPutXMLComment','FUNCTION','com.semovy.service.ICommentService.outPutXMLComment','讉K评论理',NULL);
  --目基本文本理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (18,'AUTH_FUNC_BasicinfotextManager.getBasicinfotextById','FUNCTION','com.semovy.service.IBasicinfotextService.getBasicinfotextById','获取一个项目基本文本属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (19,'AUTH_FUNC_BasicinfotextManager.saveBasicinfotext','FUNCTION','com.semovy.service.IBasicinfotextService.saveBasicinfotext','保存目基本文本属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES  
  (20,'AUTH_FUNC_BasicinfotextManager.deleteBasicinfotextById','FUNCTION','com.semovy.service.IBasicinfotextService.deleteBasicinfotextById','删除目基本文本属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  --(21,'AUTH_FUNC_BasicinfotextManager.outPutLocaleUnitXML','FUNCTION','com.semovy.service.IBasicinfotextService.outPutLocaleUnitXML','讉K基本文本属性单?,NULL),
  (22,'AUTH_FUNC_BasicinfotextManager.outPutBasicinfotextXMLOfItem','FUNCTION','com.semovy.service.IBasicinfotextService.outPutBasicinfotextXMLOfItem','讉K基本文本属性管?,NULL);   
  --目基本囄理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (23,'AUTH_FUNC_BasicinfoimgManager.getBasicinfoimgById','FUNCTION','com.semovy.service.IBasicinfoimgService.getBasicinfoimgById','获取一个项目基本图片属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (24,'AUTH_FUNC_BasicinfoimgManager.saveBasicinfoimg','FUNCTION','com.semovy.service.IBasicinfoimgService.saveBasicinfoimg','保存目基本囄属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (25,'AUTH_FUNC_BasicinfoimgManager.updateBasicinfoimg','FUNCTION','com.semovy.service.IBasicinfoimgService.updateBasicinfoimg','修改目基本囄属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (26,'AUTH_FUNC_BasicinfoimgManager.deleteBasicinfoimgById','FUNCTION','com.semovy.service.IBasicinfoimgService.deleteBasicinfoimgById','删除基本囄属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (27,'AUTH_FUNC_BasicinfoimgManager.outputBasicinfoimgXML','FUNCTION','com.semovy.service.IBasicinfoimgService.outputBasicinfoimgXML','讉K基本囄属性管?,NULL);     
  --目基本文档理
  --(28,'AUTH_FUNC_BasicinfodocManager.getBasicinfodocById','FUNCTION','com.semovy.service.IBasicinfodocService.getBasicinfodocById','获取一个项目基本文档属?,NULL),
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (29,'AUTH_FUNC_BasicinfodocManager.saveBasicinfodoc','FUNCTION','com.semovy.service.IBasicinfodocService.saveBasicinfodoc','保存目基本文档属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES  
  (30,'AUTH_FUNC_BasicinfodocManager.updateBasicinfodoc','FUNCTION','com.semovy.service.IBasicinfodocService.updateBasicinfodoc','修改目基本文档属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (31,'AUTH_FUNC_BasicinfodocManager.deleteBasicinfodocById','FUNCTION','com.semovy.service.IBasicinfodocService.deleteBasicinfodocById','删除基本文档属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (32,'AUTH_FUNC_BasicinfodocManager.outputBasicinfodocXML','FUNCTION','com.semovy.service.IBasicinfodocService.outputBasicinfodocXML','讉K基本囄文档理',NULL);       
  --目高文本理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (33,'AUTH_FUNC_AdvancedinfoManager.getAdvancedinfoById','FUNCTION','com.semovy.service.IAdvancedinfoService.getAdvancedinfoById','获取一个项目高U文本属?,NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (34,'AUTH_FUNC_AdvancedinfoManager.saveAdvancedinfo','FUNCTION','com.semovy.service.IAdvancedinfoService.saveAdvancedinfo','保存目目高文本',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES 
  (35,'AUTH_FUNC_AdvancedinfoManager.updateAdvancedinfo','FUNCTION','com.semovy.service.IAdvancedinfoService.updateAdvancedinfo','修改目目高文本',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (36,'AUTH_FUNC_AdvancedinfoManager.deleteAdvancedinfoById','FUNCTION','com.semovy.service.IAdvancedinfoService.deleteAdvancedinfoById','删除目高文本',NULL); 
  --目cd理
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (37,'AUTH_FUNC_CategoryManager.saveCategory','FUNCTION','com.semovy.service.ICategoryService.saveCategory','保存目cd',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (38,'AUTH_FUNC_CategoryManager.updateCategory','FUNCTION','com.semovy.service.ICategoryService.updateCategory','修改目cd',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (39,'AUTH_FUNC_CategoryManager.deleteCategoryById','FUNCTION','com.semovy.service.ICategoryService.deleteCategoryById','删除目cd',NULL);
  INSERT INTO authority (AUTH_ID, AUTHORITY, AUTH_TYPE, PROTECTED_RES, DISPLAY, NOTE) VALUES
  (40,'AUTH_FUNC_CategoryManager.outputCategoriesXML','FUNCTION','com.semovy.service.ICategoryService.outputCategoriesXML','讉K理目cd',NULL);   
--初始化user_auth?br />   insert into user_auth values   (1,1);
  insert into user_auth values   (1,2);
  insert into user_auth values   (1,3); 
  insert into user_auth values   (1,4);
  insert into user_auth values   (1,5);
  insert into user_auth values   (1,6); 
  insert into user_auth values   (1,7);
  insert into user_auth values   (1,8);
  insert into user_auth values   (1,9); 
  insert into user_auth values   (1,10);
  insert into user_auth values   (1,11);
  insert into user_auth values   (1,12); 
  insert into user_auth values   (1,13);
  insert into user_auth values   (1,14);
  insert into user_auth values   (1,15); 
  insert into user_auth values   (1,16);
  insert into user_auth values   (1,17);
  insert into user_auth values   (1,18); 
  insert into user_auth values   (1,19);
  insert into user_auth values   (1,20);
  insert into user_auth values   (1,21); 
  insert into user_auth values   (1,22);
  insert into user_auth values   (1,23);
  insert into user_auth values   (1,24); 
  insert into user_auth values   (1,25);
  insert into user_auth values   (1,26);
  insert into user_auth values   (1,27); 
  insert into user_auth values   (1,28);
  insert into user_auth values   (1,29);
  insert into user_auth values   (1,30);
  insert into user_auth values   (1,31); 
  insert into user_auth values   (1,32);
  insert into user_auth values   (1,33);
  insert into user_auth values   (1,34); 
  insert into user_auth values   (1,35);
  insert into user_auth values   (1,36);
  insert into user_auth values   (1,37); 
  insert into user_auth values   (1,38);
  insert into user_auth values   (1,39);
  insert into user_auth values   (1,40);                                    



semovy 2008-01-07 20:14 发表评论
]]>
HSQL入门http://www.aygfsteel.com/WshmAndLily/articles/145530.htmlsemovysemovySun, 16 Sep 2007 06:36:00 GMThttp://www.aygfsteel.com/WshmAndLily/articles/145530.htmlhttp://www.aygfsteel.com/WshmAndLily/comments/145530.htmlhttp://www.aygfsteel.com/WshmAndLily/articles/145530.html#Feedback0http://www.aygfsteel.com/WshmAndLily/comments/commentRss/145530.htmlhttp://www.aygfsteel.com/WshmAndLily/services/trackbacks/145530.html 1.1. 学习目的
本文档是针对hSQL 数据库方面的基础学习Qؓ了ə目l成员能够达C用hSQL 数据库的目的?br /> 1.2. 培训对象
开发h?br /> 1.3. 常用词及W号说明
常用词:
hsqlQ一U免费的跨^台的数据库系l?br /> E:\hsqldbQ表C是在dos 命oH口下面
1.4. 参考信?br /> doc\guide\guide.pdf

2. HSQL
2.1. HSQL q行工具
java -cp ../lib/hsqldb.jar org.hsqldb.util.DatabaseManager
注意hsqldb.jar 文g的文件\?最好能攑ֈclasspath 里面,或者放到当前\径下.
java -cp hsqldb.jar org.hsqldb.util.DatabaseManager

2.2. q行数据?br /> 启动方式: Server Modes and
In-Process Mode (also called Standalone Mode).

一个test 数据库会包含如下文g:
? test.properties
? test.script
? test.log
? test.data
? test.backup
test.properties 文g包含关于数据库的一般设|?
test.script 文g包含表和其它数据?插入没有~存表的数据.
test.log 文g包含当前数据库的变更.
test.data 文g包含~存表的数据
test.backup 文g是最q持久化状态的表的数据文g的压~备份文?br /> 所有以上这个文仉是必要的,不能被删?如果数据库没有缓存表,test.data 和test.backup 文g不会存?另外,除了以上文gHSQLDB 数据库可以链接到M文本文g,比如cvs 文g.

当操作test 数据库的时? test.log 用于保存数据的变? 当正常SHUTDOWN,q个文g被删除. 否则(不是正常shutdown),q个文g用于再ơ启动的时?重做q些变更.test.lck 文g也用于记录打开的数据库的事? 正常SHUTDOWN,文g也被删除.在一些情况下,test.data.old 文g会被创徏,q删除以前的.






2.3. Server Mode
java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:mydb -dbname.0 xdb

命o行方?


启动数据,数据库文件mydb,数据库名Uxdb

也可以在 server.properties 文g中定义启动的数据?最?0?br /> 例如: server.properties:
server.database.0=file:E:/hsqldb/data/mydb
server.dbname.0=xdb

server.database.1=file:E:/hsqldb/data/testdb
server.dbname.1=testdb

server.database.2=mem:adatabase
server.dbname.2=quickdb
启动命o: java -cp ../lib/hsqldb.jar org.hsqldb.Server
q行l果如下



java 试E序:
package test;
import junit.framework.TestCase;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TestConnect extends TestCase {
Connection connection;
protected void setUp()
{
try {
Class.forName("org.hsqldb.jdbcDriver" );
connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/xdb","sa","");


} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void testselect()
{
Statement stmt=null;
ResultSet rs=null;
try {
stmt = connection.createStatement();
String sql ="select * from test";
rs=stmt.executeQuery( sql);
while(rs.next() )
{
System.out.println("id="+rs.getString("id"));
System.out.println("name="+rs.getString("name"));
}

} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
try {
rs.close() ;
stmt.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
protected void tearDown()
{
try {
connection.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
以上在eclipse 中测试通过.

2.4.In-Process (Standalone) Mode
不需要启动server
connection = DriverManager.getConnection("jdbc:hsqldb:file:E:/hsqldb/data/mydb","sa","");
q样可以连接数据库?br /> 只能在一个jvm 中用,不能在多个jvm 中用?br /> q种模式是在相同的jvm 下作Z的应用程序的一部分Q运行数据库引擎。对大多数应用程序,q种模式q行会相当快Q作为数据,不需要{换和|络传输?br />
主要的缺点就是不可能从外面的应用E序讉K到默认数据库Q因此当你的应用q行时候,你不能通过别的工具查数据库内容。在1.8.0 版本?你可以在相同jvm 中的U程中运行数据库初始化,q提供外面访问你的进E内数据库?br /> 推荐在开发应用中使用q种方式?br /> q接Ԍ
Windows: DriverManager.getConnection("jdbc:hsqldb:file:E:/hsqldb/data/mydb","sa","");
Unix: DriverManager.getConnection("jdbc:hsqldb:file:/opt/db/testdb","sa","");

2.5.Memory-Only Databases
当随卌问内存,数据库不固定Ӟ可以采用内存的方式运行数据库Q由于没有数据写到硬盘上Q这U方式用在应用数据和applets 和特D应用的内部q程中用,URLQ?br />
Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:aname", "sa", "");
2.6.Using Multiple Databases in One JVM
2.7.Different Types of Tables
HSQLDB 支持 TEMP 表和三种cd的持久表QMEMORY ? CACHED 表,TEXT表)

当?CREATE TABLE 命oӞMemory 表时默认cdQ它们的数据整体保存在内存当中,但是M改变它们的结构或者内容,它们会被写到.script 文g中。这个脚本文件在数据库下一ơ打开的时候被对出Q内存表重新被创建内容,根temp 表不同,内存表时持久化的?br />
CACHED 表通过CREATE CACHED TABLE 命o建立. 只有部分的它们的数据或者烦引被保存在内存中Q允许大表占用几癑օ的内存空间。例外一个优点,在数据库引擎中,启动大量数据的缓存表需要花费少量的旉Q缺Ҏ(gu)减慢了运行和使用Hsqldb 的速度。表相对的时候,不要使用cache 表,在小表中使用内存数据库?br />
从版?1.7.0 以后Q支持text 表,使用 CSV (Comma Separated Value) 或者其它分隔符文本文g作ؓ它们的数据源。你可以Ҏ(gu)指定一个存在的CSV 文gQ例如从其它的数据或者程序中导出文gQ作为TXT 表的数据源?同时,你可以指定一个空文gQ通过数据库引擎填充数据。TEXT 表将比cache 表更加效率高。Text 表可以指向不同的数据文g?br />
* memory-only databases 数据库只支持memory 表和cache 表,不支持text 表?br /> 2.8. U束和烦?br /> HSQLDB 支持 PRIMARY KEY, NOT NULL, UNIQUE, CHECK and FOREIGN KEY U束.





3. sql 命o
3.1. sql 支持
select top 1 * from test;
select limit 0 2 * from test;
DROP TABLE test IF EXISTS;
3.2. Constraints and Indexes
dU束QPRIMARY KEY
唯一U束Q?br /> 唯一索引Q?br /> 外健Q?br /> CREATE TABLE child(c1 INTEGER, c2 VARCHAR, FOREIGN KEY (c1, c2) REFERENCES parent(p1, p2));

3.3. 索引和查询速度
索引提高查询速度Q比提高排序速度?br /> d和唯一所列自动创建烦引,否则需要自己创建CREATE INDEX command?br /> 索引Q?唯一索引和非唯一索引
多列的烦引,如果只是使用后面的,不用第一个,不会条查询速度?br />
(TB is a very large table with only a few rows where TB.COL3 = 4)
SELECT * FROM TA JOIN TB ON TA.COL1 = TB.COL2 AND TB.COL3 = 4;
SELECT * FROM TB JOIN TA ON TA.COL1 = TB.COL2 AND TB.COL3 = 4;(faster)

原因?TB.COL3 可以被快速的估计,如果TB 表放到前?index on TB.COL3):
一般规则是把羃?yu)条件的列的表放在前?br />
3.4. 使用where q是join
使用 WHERE 条g链接表可能会降低q行速度.
下面的例子将会比较慢,即使用了烦?
SELECT ... FROM TA, TB, TC WHERE TC.COL3 = TA.COL1 AND TC.COL3=TB.COL2 AND TC.COL4 = 1
q个查询隐含TA.COL1 = TB.COL2 ,但是没有直接讑֮q个条g.如果 TA ?TB 每个表都包含100 条记?10000 l合和 TC 兌,用于TCq个列的条g,管有烦引在q个列上.使用JOIN 关键? 在组合TC 之前,TA.COL1 = TB.COL2 条g直接q羃?yu)组?TA ?TB 的行? 在运行大数据量的表的l果?会很快:
SELECT ... FROM TA JOIN TB ON TA.COL1 = TB.COL2 JOIN TC ON TB.COL2 = TC.COL3 WHERE TC.COL4 = 1
q个查询可以提高一大步,如果改变表的序, 所?TC.COL1 = 1 最先?q样更小的集合将l合在一?
SELECT ... FROM TC JOIN TB ON TC.COL3 = TB.COL2 JOIN TA ON TC.COL3 = TA.COL1 WHERE TC.COL4 = 1
以上例子,数据引擎自动应用于TC.COL4 = 1 l合的集合于其它表兌. Indexes TC.COL4, TB.COL2 TA.COL1 都将使用索引,提高查询速度.
3.5. Subqueries and Joins
使用join 和调整表的顺序提高效?
例如:, W二个查询的速度更快一?TA.COL1 和TB.COL3都有索引):
Example 2.2. Query comparison
SELECT ... FROM TA WHERE TA.COL1 = (SELECT MAX(TB.COL2) FROM TB WHERE TB.COL3 = 4)

SELECT ... FROM (SELECT MAX(TB.COL2) C1 FROM TB WHERE TB.COL3 = 4) T2 JOIN TA ON TA.COL1 = T2.C1
W二个查询将 MAX(TB.COL2) 与一个单记录表相兌. q用TA.COL1索引,q将变得非常? W一个查询是?TA 表中的每一条记录不断地与MAX(TB.COL2)匚w.
3.6. 数据cd
TINYINT, SMALLINT, INTEGER, BIGINT, NUMERIC and DECIMAL (without a decimal point) are supported integral types and map to byte, short, int, long and BigDecimal in Java.

Integral Types:
TINYINT, SMALLINT, INTEGER, BIGINT, NUMERIC and DECIMAL
Other Numeric Types:
REAL, FLOAT or DOUBLE
Bit and Boolean Types:
BOOLEAN: UNDEFINED,TRUE,FALSE
NULL values are treated as undefined.
Storage and Handling of Java Objects
Sequences and Identity

Identity Auto-Increment Columns:
The next IDENTITY value to be used can be set with the
ALTER TABLE ALTER COLUMN RESTART WITH ;
Sequences:
SELECT NEXT VALUE FOR mysequence, col1, col2 FROM mytable WHERE ...

3.7. 事务问题:
SET PROPERTY "sql.tx_no_multi_rewrite" TRUE

4. Connections
通用驱动jdbc:hsqldb: 下列协议标识(mem: file: res: hsql: http: hsqls: https:)
Table 4.1. Hsqldb URL Components
Driver and Protocol Host and Port Database
jdbc:hsqldb:mem:
not available accounts

jdbc:hsqldb:mem:.
jdbc:hsqldb:file:
not available mydb
/opt/db/accounts
C:/data/mydb

数据库\?
jdbc:hsqldb:res:
not available /adirectory/dbname

jars files are accessed in Java programs. The /adirectory above stands for a directory in one of the jars.
jdbc:hsqldb:hsql:
jdbc:hsqldb:hsqls:
jdbc:hsqldb:http:
jdbc:hsqldb:https:
//localhost
//192.0.0.10:9500
//dbserver.somedomain.com
/an_alias
/enrollments
/quickdb

别名在server.properties or webserver.properties文g中指?br /> database.0=file:/opt/db/accounts
dbname.0=an_alias

database.1=file:/opt/db/mydb
dbname.1=enrollments

database.2=mem:adatabase
dbname.2=quickdb
In the example below, the database files lists.* in the /home/dbmaster/ directory are associated with the empty alias:
database.3=/home/dbmaster/lists
dbname.3=
4.1.Connection properties
Connection properties are specified either by establishing the connection via the:
DriverManager.getConnection (String url, Properties info);
method call, or the property can be appended to the full Connection URL.
Table 4.2. Connection Properties
get_column_name true column name in ResultSet
This property is used for compatibility with other JDBC driver implementations. When true (the default), ResultSet.getColumnName(int c) returns the underlying column name
When false, the above method returns the same value as ResultSet.getColumnLabel(int column) Example below:
jdbc:hsqldb:hsql://localhost/enrollments;get_column_name=false

When a ResultSet is used inside a user-defined stored procedure, the default, true, is always used for this property.
ifexists false connect only if database already exists
Has an effect only with mem: and file: database. When true, will not create a new database if one does not already exist for the URL.
When false (the default), a new mem: or file: database will be created if it does not exist.
Setting the property to true is useful when troubleshooting as no database is created if the URL is malformed. Example below:
jdbc:hsqldb:file:enrollments;ifexists=true
shutdown false shut down the database when the last connection is closed
This mimics the behaviour of 1.7.1 and older versions. When the last connection to a database is closed, the database is automatically shut down. The property takes effect only when the first connection is made to the database. This means the connection that opens the database. It has no effect if used with subsequent, simultaneous connections.
This command has two uses. One is for test suites, where connections to the database are made from one JVM context, immediately followed by another context. The other use is for applications where it is not easy to configure the environment to shutdown the database. Examples reported by users include web application servers, where the closing of the last connection conisides with the web app being shut down.


4.2. Properties Files
大小写敏?(e.g. server.silent=FALSE will have no effect, but server.silent=false will work).
属性文件和讑֮存储如下 :
Table 4.3. Hsqldb Server Properties Files
File Name Location Function
server.properties the directory where the command to run the Server class is issued settings for running HSQLDB as a database server communicating with the HSQL protocol
webserver.properties the directory where the command to run the WebServer class is issued settings for running HSQLDB as a database server communicating with the HTTP protocol
.properties the directory where all the files for a database are located settings for each particular database
Properties files for running the servers are not created automatically. You should create your own files that contain server.property=value pairs for each property.
4.2.1. Server and Web Server Properties
server.properties and webserver.properties 文g支持如下讑֮:
Table 4.4. Property File Properties
Value Default Description
server.database.0 test the path and file name of the first database file to use
server.dbname.0 "" lowercase server alias for the first database file
server.urlid.0 NONE SqlTool urlid used by UNIX init script. (This property is not used if your are running Server/Webserver on a platform other than UNIX, or of you are not using our UNIX init script).
server.silent true no extensive messages displayed on console
server.trace false JDBC trace messages displayed on console
In 1.8.0, 每个服务器支持同时启?0个不同的数据? The server.database.0 property defines the filename / path whereas the server.dbname.0 defines the lowercase alias used by clients to connect to that database. The digit 0 is incremented for the second database and so on. Values for the server.database.{0-9} property can use the mem:, file: or res: prefixes and properties as discussed above under CONNECTIONS. For example,
database.0=mem:temp;sql.enforce_strict_size=true;
Values specific to server.properties are:
Table 4.5. Server Property File Properties
Value Default Description
server.port 9001 TCP/IP port used for talking to clients. All databases are served on the same port.
server.no_system_exit true no System.exit() call when the database is closed
Values specific to webserver.properties are:
Table 4.6. WebServer Property File Properties
Value Default Description
server.port 80 TCP/IP port used for talking to clients
server.default_page index.html the default web page for server
server.root ./ the location of served pages
. ? multiple entries such as .html=text/html define the mime types of the static files served by the web server. See the source for WebServer.java for a list.
All the above values can be specified on the command line to start the server by omitting the server. prefix.
5. SqlTool
Mem 数据?
E:\hsqldb>java -jar ./lib/hsqldb.jar mem
Hsql Server:
(前提是xdb server 已经启动):
(java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:mydb -dbname.0 xdb)
java -jar ./hsqldb.jar xdb



执行sql 语句:
1)
Mydb.sql :
CREATE MEMORY TABLE TEST(ID INTEGER,NAME VARCHAR(20));
INSERT INTO TEST VALUES(1,'aaa');
INSERT INTO TEST VALUES(2,'bbb');
E:\hsqldb>java -jar ./lib/hsqldb.jar mem mydb.sql
1 row updated
1 row updated
2)
testuser.sql:
CREATE MEMORY TABLE userTEST(ID INTEGER,NAME VARCHAR(20));
INSERT INTO userTEST VALUES(1,'aaa');
INSERT INTO userTEST VALUES(2,'bbb');
commit; //q样才能提交到数据库
E:\hsqldb>java -jar ./hsqldb.jar xdb testuser.sql > file.txt 2>&1
输出l果到file.txt 文g?


q接oracle:

E:\hsqldb>java -classpath ./classes12.zip;./hsqldb.jar org.hsqldb.util.SqlTool --driver oracle.jdbc.driver.OracleDriver
orcl

sqltool.rc 文g:
urlid orcl
url jdbc:oracle:thin:@localhost:1521:livedoor
username scott
password tiger
driver oracle.jdbc.OracleDriver
以上driver 在一处写出即?也可以连接别的数据库

q接mysql
E:\hsqldb>java -classpath ./lib/mysql-connector-java-3.1.10-bin.jar;./hsqldb.jar org.hsqldb.util.SqlTool mysqltest

.rc 文g内容:
urlid mysqltest
url jdbc:mysql://localhost:3306/test
username root
password root
driver com.mysql.jdbc.Driver
6. sql 语法

6.1.1. ALTER INDEX[1]
ALTER INDEX RENAME TO ;
6.1.2. ALTER SEQUENCE[1]
ALTER SEQUENCE RESTART WITH ;
6.1.3. ALTER SCHEMA[1]
ALTER SCHEMA RENAME TO ;
6.1.4. ALTER TABLE[1]
ALTER TABLE ADD [COLUMN] Datatype
[(columnSize[,precision])] [{DEFAULT |
GENERATED BY DEFAULT AS IDENTITY (START WITH [, INCREMENT BY ])}] |
[[NOT] NULL] [IDENTITY] [PRIMARY KEY]
[BEFORE ];

ALTER TABLE DROP [COLUMN] ;
ALTER TABLE ALTER COLUMN RENAME TO
ALTER TABLE ALTER COLUMN SET DEFAULT };
ALTER TABLE ALTER COLUMN SET [NOT] NULL
ALTER TABLE ALTER COLUMN ;
ALTER TABLE ALTER COLUMN
RESTART WITH

ALTER TABLE ADD [CONSTRAINT ]
CHECK ();
ALTER TABLE ADD [CONSTRAINT ] UNIQUE ();
ALTER TABLE ADD [CONSTRAINT ]
PRIMARY KEY ();
ALTER TABLE
ADD [CONSTRAINT ] FOREIGN KEY ()
REFERENCES ()
[ON {DELETE | UPDATE} {CASCADE | SET DEFAULT | SET NULL}];

ALTER TABLE DROP CONSTRAINT ;
ALTER TABLE RENAME TO ;
6.1.5. ALTER USER[1]
ALTER USER SET PASSWORD ;
ALTER USER SET INITIAL SCHEMA ;
6.1.6. CALL
CALL Expression;
See also: Stored Procedures / Functions, SQL Expression.
6.1.7. CHECKPOINT
CHECKPOINT [DEFRAG[1]];
See also: SHUTDOWN, SET LOGSIZE.
6.1.8. COMMIT
COMMIT [WORK];
See also: ROLLBACK, SET AUTOCOMMIT, SET LOGSIZE.
6.1.9. CONNECT
CONNECT USER PASSWORD ;
See also: GRANT, REVOKE.
6.1.10. CREATE ALIAS
CREATE ALIAS FOR ;
See also: CALL, Stored Procedures / Functions.
6.1.11. CREATE INDEX
CREATE [UNIQUE] INDEX ON ( [DESC] [, ...]) [DESC];
6.1.12. CREATE ROLE[1]
CREATE ROLE ;
6.1.13. CREATE SCHEMA[1]
CREATE SCHEMA AUTHORIZATION
[ [] [...];
CREATE SCHEMA ACCOUNTS AUTHORIZATION DBA
CREATE TABLE AB(A INTEGER, ...)
CREATE TABLE CD(C CHAHR, ...)
CREATE VIEW VI AS SELECT ...
GRANT SELECT TO PUBLIC ON AB
GRANT SELECT TO JOE ON CD;
6.1.14. CREATE SEQUENCE[1]
CREATE SEQUENCE [AS {INTEGER | BIGINT}]
[START WITH ] [INCREMENT BY ];
SELECT [...,] NEXT VALUE FOR [, ...] FROM ;

6.1.15. CREATE TABLE
CREATE [MEMORY | CACHED | [GLOBAL] TEMPORARY | TEMP [1] | TEXT[1]] TABLE
( [, ...] [, ...] )
[ON COMMIT {DELETE | PRESERVE} ROWS];
6.1.16. CREATE TRIGGER[1]
CREATE TRIGGER {BEFORE | AFTER} {INSERT | UPDATE | DELETE} ON
[FOR EACH ROW] [QUEUE n] [NOWAIT] CALL ;
6.1.17. CREATE USER
CREATE USER PASSWORD [ADMIN];
6.1.18. CREATE VIEW[1]
CREATE VIEW [(,..) AS SELECT ... FROM ... [WHERE Expression]
[ORDER BY orderExpression [, ...]]
[LIMIT [OFFSET ]];
CREATE VIEW mealsjv AS
SELECT m.mid mid, m.name name, t.mealtype mt, a.aid aid,
a.gname + ' ' + a.sname author, m.description description,
m.asof asof
FROM meals m, mealtypes t, authors a
WHERE m.mealtype = t.mealtype
AND m.aid = a.aid;

CREATE VIEW mealswebv AS SELECT name, author FROM mealsjv;

CREATE VIEW aview (new_name, new_author) AS
SELECT name, author
FROM mealsjv
6.1.19. DELETE
DELETE FROM table [WHERE Expression];
6.1.20. DISCONNECT
DISCONNECT;
6.1.21. DROP INDEX
DROP INDEX index [IF EXISTS];
6.1.22. DROP ROLE[1]
DROP ROLE ;
6.1.23. DROP SEQUENCE[1]
DROP SEQUENCE [IF EXISTS] [RESTRICT | CASCADE];
6.1.24. DROP SCHEMA[1]
DROP SCHEMA [RESTRICT | CASCADE];
6.1.25. DROP TABLE
DROP TABLE [IF EXISTS] [RESTRICT | CASCADE];
6.1.26. DROP TRIGGER
DROP TRIGGER ;
6.1.27. DROP USER
DROP USER ;
6.1.28. DROP VIEW[1]
DROP VIEW [IF EXISTS] [RESTRICT | CASCADE];
6.1.29. EXPLAIN PLAN
EXPLAIN PLAN FOR { SELECT ... | DELETE ... | INSERT ... | UPDATE ..};
6.1.30. GRANT
GRANT { SELECT | DELETE | INSERT | UPDATE | ALL } [,...]
ON { table | CLASS "package.class" } TO ;
GRANT [,...] TO [1];
GRANT SELECT ON Test TO GUEST;
GRANT ALL ON CLASS "java.lang.Math.abs" TO PUBLIC;

6.1.31. INSERT
INSERT INTO table [( column [,...] )]
{ VALUES(Expression [,...]) | SelectStatement};
6.1.32. REVOKE
REVOKE { SELECT | DELETE | INSERT | UPDATE | ALL } [,...]
ON { table | CLASS "package.class" } FROM ;
REVOKE [,...] FROM [1];
6.1.33. ROLLBACK
ROLLBACK [TO SAVEPOINT [1] | WORK}];
6.1.34. SAVEPOINT[1]
SAVEPOINT ;
6.1.35. SCRIPT
SCRIPT ['file'];
6.1.36. SELECT[1]
SELECT [{LIMIT | TOP }[1]][ALL | DISTINCT]
{ selectExpression | table.* | * } [, ...]
[INTO [CACHED | TEMP | TEXT][1] newTable]
FROM tableList
[WHERE Expression]
[GROUP BY Expression [, ...]]
[HAVING Expression]
[{ UNION [ALL | DISTINCT] | {MINUS [DISTINCT] | EXCEPT [DISTINCT] } |
INTERSECT [DISTINCT] } selectStatement]
[ORDER BY orderExpression [, ...]]
[LIMIT [OFFSET ]];
tableList
table [{CROSS | INNER | LEFT OUTER | RIGHT OUTER}
JOIN table ON Expression] [, ...]
table
{ (selectStatement) [AS] label | tableName}
selectExpression
{ Expression | COUNT(*) | {
COUNT | MIN | MAX | SUM | AVG | SOME | EVERY |
VAR_POP | VAR_SAMP | STDDEV_POP | STDDEV_SAMP
} ([ALL | DISTINCT][1]] Expression) } [[AS] label]
If CROSS JOIN is specified no ON expression is allowed for the join.
orderExpression
{ columnNr | columnAlias | selectExpression }
[ASC | DESC]
LIMIT n m
LIMIT n m

LIMIT m OFFSET n

TOP m

UNION and other set operations

6.1.37. SET AUTOCOMMIT
SET AUTOCOMMIT { TRUE | FALSE };
6.1.38. SET DATABASE COLLATION[1]
SET DATABASE COLLATION ;
6.1.39. SET CHECKPOINT DEFRAG[1]
SET CHECKPOINT DEFRAG ;
6.1.40. SET IGNORECASE
SET IGNORECASE { TRUE | FALSE };
6.1.41. SET INITIAL SCHEMA [1]
Users may change their base default schema name with the comand
SET INITIAL SCHEMA ;
6.1.42. SET LOGSIZE
SET LOGSIZE ;
6.1.43. SET PASSWORD
SET PASSWORD ;
6.1.44. SET PROPERTY[1]
SET PROPERTY ;
6.1.45. SET REFERENTIAL INTEGRITY
SET REFERENTIAL_INTEGRITY { TRUE | FALSE };
6.1.46. SET SCHEMA[1]
SET SCHEMA ;
6.1.47. SET SCRIPTFORMAT[1]
SET SCRIPTFORMAT {TEXT | BINARY | COMPRESSED};
6.1.48. SET TABLE INDEX
SET TABLE tableName INDEX 'index1rootPos index2rootPos ... ';
6.1.49. SET TABLE READONLY[1]
SET TABLE READONLY {TRUE | FALSE};
6.1.50. SET TABLE SOURCE[1]
SET TABLE SOURCE [DESC];
SET TABLE mytable SOURCE "myfile;fs=|;vs=.;lvs=~"
Supported Properties
quoted = { true | false }
default is true. If false, treats double quotes as normal characters
all_quoted = { true | false }
default is false. If true, adds double quotes around all fields.
encoding =
character encoding for text and character fields, for example, encoding=UTF-8
ignore_first = { true | false }
default is false. If true ignores the first line of the file
cache_scale=
exponent to calculate rows of the text file in cache. Default is 8, equivalent to nearly 800 rows
cache_size_scale = r
exponent to calculate average size of each row in cache. Default is 8, equivalent to 256 bytes per row.
fs =
field separator
vs =
varchar separator
lvs =
long varchar separator
Special indicators for Hsqldb Text Table separators
\semi
semicolon
\quote
quote
\space
space character
\apos
apostrophe
\n
newline - Used as an end anchor (like $ in regular expressions)
\r
carriage return
\t
tab
\\
backslash
\u####
a Unicode character specified in hexadecimal
Only an administrator may do this.

6.1.51. SET WRITE DELAY[1]
SET WRITE_DELAY {{ TRUE | FALSE } | | MILLIS};
6.1.52. SHUTDOWN
SHUTDOWN [IMMEDIATELY | COMPACT | SCRIPT[1]];
6.2. Data Types
Table 9.1. Data Types. The types on the same line are equivalent.
Name Range Java Type
INTEGER | INT as Java type int | java.lang.Integer
DOUBLE [PRECISION] | FLOAT as Java type double | java.lang.Double
VARCHAR as Integer.MAXVALUE java.lang.String
VARCHAR_IGNORECASE as Integer.MAXVALUE java.lang.String
CHAR | CHARACTER as Integer.MAXVALUE java.lang.String
LONGVARCHAR as Integer.MAXVALUE java.lang.String
DATE as Java type java.sql.Date
TIME as Java type java.sql.Time
TIMESTAMP | DATETIME as Java type java.sql.Timestamp
DECIMAL No limit java.math.BigDecimal
NUMERIC No limit java.math.BigDecimal
BOOLEAN | BIT as Java type boolean | java.lang.Boolean
TINYINT as Java type byte | java.lang.Byte
SMALLINT as Java type short | java.lang.Short
BIGINT as Java type long | java.lang.Long
REAL as Java type double | java.lang.Double[1]

BINARY as Integer.MAXVALUE byte[]
VARBINARY as Integer.MAXVALUE byte[]
LONGVARBINARY as Integer.MAXVALUE byte[]
OTHER | OBJECT as Integer.MAXVALUE java.lang.Object
The uppercase names are the data types names defined by the SQL standard or commonly used by RDMS's. The data types in quotes are the Ja

6.2.1. 自动增长:
create table user(id IDENTITY,name varchar(20));
sql> create table dept(id int GENERATED BY DEFAULT AS IDENTITY(start with 10,increment by 5) not null PRIMARY KEY,name v
archar(20));
sql> insert into dept(name) values('asc');
1 row updated
sql> insert into dept(name) values('security');
1 row updated
sql> select * from dept;
ID NAME
-- --------
10 asc
15 security

2 rows

6.3. SQL Comments
-- SQL style line comment
// Java style line comment
/* C style line comment */
7. Hsqldb Test Utility
拯 junit.jar ?lib 目录?br /> q行: ant hsqldbtest
生成 hsqldbtest.jar
q行: \hsqldb\testrun\hsqldb>runtest TestSelf


semovy 2007-09-16 14:36 发表评论
]]>
վ֩ģ壺 | ̩| Һ| | ǡ| | կ| | ľ˹| | Ѯ| ̶| | | | | | | | ũ| ֣| º| | ƽԶ| | ʡ| | | | ƽԶ| | | | | | | ϰ| | ľ| | ɽ|