首先,domino自己本身就是一种数据库,所以,楼主所谓的是否支持mysql我不知道是什么意思,只能猜测一下。
domino中有个数据同步工具LEI(简易版DECS)可以实现domino数据与关系型数据库的实时同步,这个工具支持连接MySQL。
除此之外,domino也可以使用java代理或调用web service,这些方法都可以支持连接MySQL,不知道楼主具体是想要实现什么了。
SQL SERVRE 2000 测试通过CREATE DATABASE shop
GO
use shop
/* ************************** 用户信息 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'UserInfo_table')
DROP TABLE UserInfo_table
GO
CREATE TABLE UserInfo_table
(
userId smallint /*用户编号*/
IDENTITY(1,1),
loginName varchar(20) not null, /*登陆名称*/
userName varchar(20) not null, /*用户名称*/
userPwd varchar(10) not null, /*用户密码*/
userType varchar(20) not null, /*用户类型*/
userSex varchar(2),/*用户性别*/
userPhone varchar(20),/*用户电话*/
userEmail varchar(40),/*用户邮件*/
userAddress varchar(200),/*用户地址*/
userZip varchar(10),/*用户邮编*/
createTime datetime default getdate(), /*注册时间*/
updateTime datetime, /*更新时间*/
userStatus varchar(4) not null,/*用户状态*/
userLevel int, /*用户级别*/
constraint pk_userinfo primary key(userId)
)
/* ************************** 系统代码表 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'CommonCode_table')
DROP TABLE CommonCode_table
GO
CREATE TABLE CommonCode_table
(
codeType varchar(20) not null, /*代码类型*/
codeName varchar(20) not null, /*代码名称*/
codeValue varchar(100) not null, /*代码值*/
constraint pk_commoncode primary key(codeType, codeName)
)
/* ************************** 菜单信息 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'MenuShop_table')
DROP TABLE MenuShop_table
GO
CREATE TABLE MenuShop_table
(
menuId varchar(50) not null,
menuName varchar(50),
menuImg varchar(50),
menuSelImg varchar(50),
menuAction varchar(50),
menuLevel smallint not null,
parentMenuId varchar(50),
menuLine smallint not null,
isUserMenu bit not null,
constraint pk_menushop primary key(menuId)
)
/* ************************** 用户订单 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'UserOrder_table')
DROP TABLE UserOrder_table
GO
CREATE TABLE UserOrder_table
(
orderId varchar(50) not null, /*订单号*/
userId smallint not null, /*订购人ID*/
orderTime datetime not null, /*订单产生日期*/
orderStatus char(2) not null, /*订单是否确认,0/1*/
orderPassTime datetime, /*确认时间*/
orderPassId smallint, /*订单处理人*/
orderSendState char(2), /*订单发送状态*/
orderRecName varchar(20), /*订单接收人姓名*/
orderRecMail varchar(20),
orderRecAddress varchar(200), /*订单接收地址*/
orderRecZip varchar(10), /*订单接受地址邮编*/
orderTotalPrice decimal(10,2), /*订单总价*/
lineIndexNext int,
constraint pk_userorder primary key(orderId)
)
/* ************************** 订单中项目信息 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'LineItem_table')
DROP TABLE LineItem_table
GO
CREATE TABLE LineItem_table
(
orderId varchar(50) not null, /*订单号*/
lineIndex int not null, /*订单索引*/
itemId varchar(50) not null,
productId int not null, /*产品ID*/
quantity int not null, /*订单项数量*/
unitPrice decimal(10, 2) not null, /*该订单项的价格*/
orderStatus int not null,
constraint pk_lineitem primary key(orderId, lineIndex)
)
/* ************************** 商品类别信息 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'ProductCategory_table')
DROP TABLE ProductCategory_table
GO
CREATE TABLE ProductCategory_table
(
catId int
IDENTITY(1,1),/*类别编号*/
catName varchar(100) not null, /*类别名称*/
parentId int,/*父级类别ID*/
catHaveChild varchar(2) not null, /*是否有子类别Y/N*/
sort int not null,/*排序标志*/
inputdate datetime default getdate(), /*建立时间*/
isValid varchar(2), /*此类别是否有效*/
decs varchar(255), /*说明*/
constraint pk_productcategory primary key(catId)
)
/* ************************** 产品信息 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'ProductInfo_table')
DROP TABLE ProductInfo_table
GO
CREATE TABLE ProductInfo_table
(
productId int
IDENTITY(1,1),/*编号*/
catId int not null, /*类别ID*/
productName varchar(100), /*物品名称*/
productContent varchar(4000),
productDesc varchar(1000), /*物品简介*/
isPrompt bit default 0, /*是否优惠*/
registerTime datetime default getdate(), /*上架日期*/
listPrice decimal(10, 2), /*物品价格*/
unitPrice decimal(10, 2), /*会员价格*/
orderDesc varchar(1000), /*订购说明*/
productImgUrl varchar(200), /*物品图片*/
sort int, /*排序标记*/
productCount int,/*库存量*/
isValid bit not null,
constraint pk_productInfo primary key(productId),
constraint fk_product foreign key(catId)
references ProductCategory_table(catId)
)
/* ***************************************************************************** */
create index ProductCategory on ProductInfo_table(catId)
create index ProdcutName on ProductInfo_table(productName)
/* ************************** 公告信息 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'BulletinInfo_table')
DROP TABLE BulletinInfo_table
GO
CREATE TABLE BulletinInfo_table
(
bulletinId int
IDENTITY(1,1),/*编号*/
bulletinTitle varchar(100) not null, /*公告板标题*/
bulletinBody varchar(4000), /*公告板内容*/
inputDate datetime default getdate(), /*添加日期*/
updateDate datetime,/*更新日期*/
inputUserId smallint, /*添加管理员ID*/
bulletinPoint int,/*浏览量*/
bulletinSort int, /*排序标记*/
isValid char(2) default 1, /*是否有效*/
constraint pk_bulletinInfo primary key(bulletinId)
)
/* ************************** 公告信息 ************************** */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'ItemInfo_table')
DROP TABLE ItemInfo_table
GO
CREATE TABLE ItemInfo_table
(
itemId varchar(50),/*项目ID*/
productId int not null, /*项目产品ID*/
quantity int not null,
listPrice decimal(10,2), /*物品价格*/
unitPrice decimal(10,2), /*会员价格*/
status varchar(2), /*更新日期*/
constraint pk_iteminfo primary key(itemId)
)
/* ************************************************************* */
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'Serial_Number')
DROP TABLE Serial_Number
GO
CREATE TABLE Serial_Number
(
serialId varchar(50) not null,
SerialNumber int,
constraint pk_SerialNumber primary key(serialId)
)
三种解决方式:1 viewport属性 2 CSS控制 3 JS控制1 viewport属性放在HTML的<meta>中
<SPAN style="FONT-SIZE: x-small"> <head>
<title>Exmaple</title>
<meta name=”viewport” content=”width=device-width,user-scalable=no”/>
</head></SPAN>
meta中viewport的属性如下
<SPAN style="FONT-SIZE: x-small"> <meta name="viewport"
content="
height = [pixel_value | device-height] ,
width = [pixel_value | device-width ] ,
initial-scale = float_value ,
minimum-scale = float_value ,
maximum-scale = float_value ,
user-scalable = [yes | no] ,
target-densitydpi = [dpi_value | device-dpi |
high-dpi | medium-dpi | low-dpi]
"
/></SPAN>
2 CSS控制设备密度
为每种密度创建独立的样式表(注意其中的webkit-device-pixel-ratio 3个数值对应3种分辨率)
<link rel="stylesheet" media="screen and (-webkit-device-pixel-ratio: 1.5)" href="hdpi.css" />
<link rel="stylesheet" media="screen and (-webkit-device-pixel-ratio: 1.0)" href="mdpi.css" />
<link rel="stylesheet" media="screen and (-webkit-device-pixel-ratio: 0.75)" href="ldpi.css" />
在一个样式表中,指定不同的样式
WebView myWebView = (WebView) findViewById(R.id.webview)
myWebView.setWebViewClient(new MyWebViewClient())
另外出于用户习惯上的考虑 需要将WebView表现得更像一个浏览器,也就是需要可以回退历史记录
因此需要覆盖系统的回退键 goBack,goForward可向前向后浏览历史页面
Java代码
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) &&myWebView.canGoBack() {
myWebView.goBack()
return true
}
return super.onKeyDown(keyCode, event)
}
//处理javascript中的confirm
public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
Builder builder = new Builder(MainActivity.this)
builder.setTitle("confirm")
builder.setMessage(message)
builder.setPositiveButton(android.R.string.ok,
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
result.confirm()
}
})
builder.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
result.cancel()
}
})
builder.setCancelable(false)
builder.create()
builder.show()
return true
}
@Override
//设置网页加载的进度条
public void onProgressChanged(WebView view, int newProgress) {
MainActivity.this.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, newProgress * 100)
super.onProgressChanged(view, newProgress)
}
//设置应用程序的标题title
public void onReceivedTitle(WebView view, String title) {
MainActivity.this.setTitle(title)
super.onReceivedTitle(view, title)
}
})
● Android中的调试
通过JS代码输出log信息
Js代码
Js代码: console.log("Hello World")
Log信息: Console: Hello World http://www.example.com/hello.html :82
在WebChromeClient中实现onConsoleMesaage()回调方法,让其在LogCat中打印信息
Java代码 复制代码 收藏代码
WebView myWebView = (WebView) findViewById(R.id.webview)
myWebView.setWebChromeClient(new WebChromeClient() {
public void onConsoleMessage(String message, int lineNumber, String sourceID) {
Log.d("MyApplication", message + " -- From line "
+ lineNumber + " of "
+ sourceID)
}
})
以及
Java代码
WebView myWebView = (WebView) findViewById(R.id.webview)
myWebView.setWebChromeClient(new WebChromeClient() {
public boolean onConsoleMessage(ConsoleMessage cm) {
Log.d("MyApplication", cm.message() + " -- From line "
+ cm.lineNumber() + " of "
+ cm.sourceId() )
return true
}
})
*ConsoleMessage 还包括一个 MessageLevel 表示控制台传递信息类型。 您可以用messageLevel()查询信息级别,以确定信息的严重程度,然后使用适当的Log方法或采取其他适当的措施。
● HTML5本地存储在Android中的应用
HTML5提供了2种客户端存储数据新方法:
localStorage 没有时间限制
sessionStorage 针对一个Session的数据存储
Js代码
<script type="text/javascript">
localStorage.lastname="Smith"
document.write(localStorage.lastname)
</script>
<script type="text/javascript">
sessionStorage.lastname="Smith"
document.write(sessionStorage.lastname)
</script>
WebStorage的API:
//清空storage
localStorage.clear()
//设置一个键值
localStorage.setItem(“yarin”,“yangfegnsheng”)
//获取一个键值
localStorage.getItem(“yarin”)
//获取指定下标的键的名称(如同Array)
localStorage.key(0)
//return “fresh” //删除一个键值
localStorage.removeItem(“yarin”)
注意一定要在设置中开启哦
setDomStorageEnabled(true)
在Android中进行 *** 作
//启用数据库
webSettings.setDatabaseEnabled(true)
String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath()
//设置数据库路径
webSettings.setDatabasePath(dir)
//使用localStorage则必须打开
webSettings.setDomStorageEnabled(true)
//扩充数据库的容量(在WebChromeClinet中实现)
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota,
long estimatedSize, long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(estimatedSize * 2)
}
在JS中按常规进行数据库 *** 作
function initDatabase() {
try {
if (!window.openDatabase) {
alert('Databases are not supported by your browser')
} else {
var shortName = 'YARINDB'
var version = '1.0'
var displayName = 'yarin db'
var maxSize = 100000// in bytes
YARINDB = openDatabase(shortName, version, displayName, maxSize)
createTables()
selectAll()
}
} catch(e) {
if (e == 2) {
// Version mismatch.
console.log("Invalid database version.")
} else {
console.log("Unknown error "+ e +".")
}
return
}
}
function createTables(){
YARINDB.transaction(
function (transaction) {
transaction.executeSql('CREATE TABLE IF NOT EXISTS yarin(id INTEGER NOT NULL PRIMARY KEY, name TEXT NOT NULL,desc TEXT NOT NULL)', [], nullDataHandler, errorHandler)
}
)
insertData()
}
function insertData(){
YARINDB.transaction(
function (transaction) {
//Starter data when page is initialized
var data = ['1','yarin yang','I am yarin']
transaction.executeSql("INSERT INTO yarin(id, name, desc) VALUES (?, ?, ?)", [data[0], data[1], data[2]])
}
)
}
function errorHandler(transaction, error){
if (error.code==1){
// DB Table already exists
} else {
// Error is a human-readable string.
console.log('Oops. Error was '+error.message+' (Code '+error.code+')')
}
return false
}
function nullDataHandler(){
console.log("SQL Query Succeeded")
}
function selectAll(){
YARINDB.transaction(
function (transaction) {
transaction.executeSql("SELECT * FROM yarin", [], dataSelectHandler, errorHandler)
}
)
}
function dataSelectHandler(transaction, results){
// Handle the results
for (var i=0i<results.rows.lengthi++) {
var row = results.rows.item(i)
var newFeature = new Object()
newFeature.name = row['name']
newFeature.decs = row['desc']
document.getElementByIdx_x_x_x("name").innerHTML="name:"+newFeature.name
document.getElementByIdx_x_x_x("desc").innerHTML="desc:"+newFeature.decs
}
}
function updateData(){
YARINDB.transaction(
function (transaction) {
var data = ['fengsheng yang','I am fengsheng']
transaction.executeSql("UPDATE yarin SET name=?, desc=? WHERE id = 1", [data[0], data[1]])
}
)
selectAll()
}
function ddeleteTables(){
YARINDB.transaction(
function (transaction) {
transaction.executeSql("DROP TABLE yarin", [], nullDataHandler, errorHandler)
}
)
console.log("Table 'page_settings' has been dropped.")
}
注意onLoad中的初始化工作
function initLocalStorage(){
if (window.localStorage) {
textarea.addEventListener("keyup", function() {
window.localStorage["value"] = this.value
window.localStorage["time"] = new Date().getTime()
}, false)
} else {
alert("LocalStorage are not supported in this browser.")
}
}
window.onload = function() {
initDatabase()
initLocalStorage()
}
● HTML5地理位置服务在Android中的应用
//启用地理定位
webSettings.setGeolocationEnabled(true)
//设置定位的数据库路径
webSettings.setGeolocationDatabasePath(dir)
//配置权限(同样在WebChromeClient中实现)
public void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false)
super.onGeolocationPermissionsShowPrompt(origin, callback)
}
HTML5中 通过navigator.geolocation对象获取地理位置信息
常用的navigator.geolocation对象有以下三种方法:
Js代码
//获取当前地理位置
navigator.geolocation.getCurrentPosition(success_callback_function, error_callback_function, position_options)
//持续获取地理位置
navigator.geolocation.watchPosition(success_callback_function, error_callback_function, position_options)
//清除持续获取地理位置事件
navigator.geolocation.clearWatch(watch_position_id)
其中success_callback_function为成功之后处理的函数,error_callback_function为失败之后返回的处理函数,参数position_options是配置项
//定位
function get_location() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(show_map,handle_error,{enableHighAccuracy:false,maximumAge:1000,timeout:15000})
} else {
alert("Your browser does not support HTML5 geoLocation")
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)