GithubHelp home page GithubHelp logo

mysql-libmysqlclient-transaction's Introduction

mysql-libmysqlclient-transaction

nodejs modules node-mysql-libmysqlclient 事务处理模块

用法:

var Mysql = require('mysql-libmysqlclient');
var transaction = require(__dirname + '/');
var client = Mysql.createConnectionSync(
    '192.168.109.40',
    'root',
    'root',
    'idmp',
    3306
);
var sql1 = 'insert into test(name) values("333")';
var sql2 = 'insert into test(name) values("4444")';
const DEBUG = true;
transaction(client, DEBUG);
var trans = client.startTransaction();
function error(err) {
    if(err && trans.rollback) {
        trans.rollback();
        console.trace(err);
        //throw err;
    }
}
trans.query(sql1, error);
trans.query(sql2, error);
trans.commit();
console.log("success!");
console.log("mysql-queues: An exception occurred for this query:\n\t",
    sql1);
    */
/*
var sql1 = 'START TRANSACTION';
var sql2 = 'insert into test(name) vdalues("333")';
var sql3 = 'insert into test(name) values("4444")';
var sql4 = 'COMMIT';
var sql5 = 'ROLLBACK';
try{
    conn.querySync(sql1);
    conn.querySync(sql2);
    conn.querySync(sql3);
    conn.querySync(sql4);
}catch(error){
    conn.querySync(sql5);
    console.log(error.stack);
}
*/

mysql-libmysqlclient-transaction's People

Contributors

wangbinlml avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.