npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ksfks/oracle-client

v1.0.1

Published

远程调用oreacleServer ksf服务

Downloads

3

Readme

作用

远程调用oreacleServer ksf服务

用法示例

    var oracleClientHelper = require("@ksfks/oracle-client")("testbus","upapp")

    /**
     * oracle查询
     * @param string   查询SQL语句
     * @param json     JSON格式的绑定数据(如果SQL语句不带绑定标志位,可以不传)
     * @param number   最大查询记录数(如果不传,将读取默认值)
     */

    //如果不带绑定参数,可以只传SQL语句和最大查询数
    oracleClientHelper.query('select * from (select t.*,rownum from UPAPP.NEWS_MAIN_ELE t)', 100).then(data =>{
        console.log(data);
    })

    //最简单时候可以只传一条SQL语句作为参数,此时最大查询数将读取默认值
    oracleClientHelper.query('select * from (select t.*,rownum from UPAPP.NEWS_MAIN_ELE t)').then(data =>{
        console.log(data);
    })

    //绑定数据查询,推荐传入JSON对象,标识符和键值保持一致
    oracleClientHelper.query('select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = :skt_uni_code', {skt_uni_code: '2010003382'}, 100).then(data =>{
        console.log(data);
    })

    //如果偷懒的话也可以传数组,不过这样将会按顺序对号入座
    oracleClientHelper.query('select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = :skt_uni_code', ['2010003382'], 100).then(data =>{
        console.log(data);
    })

    //兼容了老接口:queryBindParams
    oracleClientHelper.queryBindParams('select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = :skt_uni_code', ['2010003382'], 100).then(data =>{
        console.log(data);
    })

    /**
     * oracle查询,加入缓存机制
     *
     * @param json sqlString  查询SQL语句
     *             bindParams JSON格式的绑定数据(如果SQL语句不带绑定标志位,可以不传)
     *             maxRowNum  最大查询记录数,如果不传,读取服务默认配置
     *             expireTime 缓存过期时间,单位秒,如果不传,读取服务默认配置
     *             isForce    是否强刷,如果不传,读取服务默认配置
     */
     
    //最简单的用法,会优先去缓存拿数据,如果没有直接查数据库
    oracleClientHelper.queryCache({
        sqlString:  'select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = 2010003382',
    }).then(data => {console.log(data);}).catch(err => {console.log(err);});
     
    //可以限制最大查询数量,如果不传,读取服务默认配置
    oracleClientHelper.queryCache({
        sqlString:  'select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = 2010003382',
        maxRowNum:  100
    }).then(data => {console.log(data);}).catch(err => {console.log(err);});
     
    //可以绑定参数
    oracleClientHelper.queryCache({
        sqlString:  'select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = :skt_uni_code',
        bindParams: {skt_uni_code: '2010003382'},
        maxRowNum:  100
    }).then(data => {console.log(data);}).catch(err => {console.log(err);});
     
    //同时我们也可以手动设置缓存过期时间,单位秒,如果没设置,读取服务默认配置
    oracleClientHelper.queryCache({
        sqlString:  'select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = :skt_uni_code',
        bindParams: {skt_uni_code: '2010003382'},
        maxRowNum:  100,
        expireTime: 60
    }).then(data => {console.log(data);}).catch(err => {console.log(err);});
     
    //服务器配置默认取缓存,如果不想拿缓存的数据,也可以强刷
    oracleClientHelper.queryCache({
        sqlString:  'select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = :skt_uni_code',
        bindParams: {skt_uni_code: '2010003382'},
        maxRowNum:  100,
        expireTime: 60,
        isForce:    true
    }).then(data => {console.log(data);}).catch(err => {console.log(err);});

    //最后我们也可以人为指定缓存key
    oracleClientHelper.queryCache({
        sqlString:  'select * from UPAPP.STK_BASIC_INFO where STK_UNI_CODE = :skt_uni_code',
        bindParams: {skt_uni_code: '2010003382'},
        maxRowNum:  100,
        expireTime: 60,
        isForce:    true,
        cacheKey:   'oracle_srv_test'
    }).then(data => {console.log(data);}).catch(err => {console.log(err);});