bigbaby-oracle
v1.0.13
Published
oracle orm
Downloads
20
Readme
// 服务代码
const app = new (require('koa'))();
const koaBody = require("koa-body")
const moment =require("moment")
app.use(koaBody({
formLimit: '20MB',
jsonLimit: '20MB',
textLimit: '20MB',
multipart: true,
includeUnparsed:true,
formidable: {
uploadDir:'d:/uploads',
keepExtensions: true,
maxFileSize: 200 * 1024 * 1024 // 设置上传文件大小最大限制,默认2M
},
}));
const oradb = require('bigbaby-oracle').create(__dirname +'/dbhome' ,'/api/dbop')
let db =oradb.getdb('sysdb')
// async function f1() {
// //let r = await db.gettrdeffile({tname:'A2014_SMS',uname:'ZMHAPP'})
// //let r = await db.createdboplogtr({tname:'A2014_SMS',uname:'ZMHAPP'})
// //let r = await db.removedboplogtr({tname:'A2014_SMS',uname:'ZMHAPP'})
// // let r = await db.createdboplog({uname:'ZMHAPP'})
// //let r = await db.tableInsert({tname:'A2014_SMS',data:[{"收信人":"13"},{"收信人":"13"}]})
// //let r = await db.tableUpdate({tname:'A2014_SMS',data:[{"收信人":"132","ID":126},{"收信人":"133","ID":132}]})
// //let r = await db.tableDelete({tname:'A2014_SMS',data:[{"收信人":"132","ID":"114"},{"收信人":"133","ID":"120"}]})
// //let p = {tname:'A2014_SMS',page:1,pageSize:1}
// let p = {tname:'A2014_SMS',
// pageSize:10,page:1,
// sort:[{field:'ID',dir:'desc'}],
// filter:{logic:' and ',filters:[{field:"ID",operator:'gt',value:"0"},{field:"ID",operator:'lt',value:"10"}]},
// }
// let r = await db.tableSelect(p)
// p.data = r.data
// p=await db.dtproc(p)
// console.log(p.data)
// console.log(new Date('2021-04-11 12:00:00').toLocaleString())
// //console.log(p.data)
// }
// f1()
app.use(oradb.router.routes())
app.listen(12345)
//数据库链接配置文件示例,放在应用的的dbhome目录下,文件名sysdb.js;
const Db = require('bigbaby-oracle').Db;
const config = {
_enableStats: true,
user: 'zmhapp',
password: '1',
connectString: '10.10.13.5/orcl',
poolMax: 20,
poolMin: 1,
poolPingInterval: 20,
poolTimeout: 0
};
let oradb = new Db(config,__filename)
module.exports =oradb
//在test目录下有 调用实例,可配合kendo grid 后台使用