Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mysql-live-select

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql-live-select - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

33

lib/LiveMysql.js

@@ -19,2 +19,9 @@ /* mysql-live-select, MIT License ben@latenightsketches.com

self.zongjiSettings = {
serverId: settings.serverId,
startAtEnd: true,
includeEvents: [ 'tablemap', 'writerows', 'updaterows', 'deleterows' ],
includeSchema: {}
};
db.connect();

@@ -55,7 +62,3 @@

zongji.start({
serverId: settings.serverId,
startAtEnd: true,
includeEvents: [ 'tablemap', 'writerows', 'updaterows', 'deleterows' ]
});
zongji.start(self.zongjiSettings);
}

@@ -65,2 +68,22 @@

var self = this;
if(!(triggers instanceof Array) ||
triggers.length === 0)
throw new Error('triggers array required');
var includeSchema = self.zongjiSettings.includeSchema;
for(var i = 0; i < triggers.length; i++){
var triggerDatabase = triggers[i].database || self.settings.database;
if(triggerDatabase === undefined){
throw new Error('no database selected on trigger');
}
if(!(triggerDatabase in includeSchema)){
includeSchema[triggerDatabase] = [ triggers[i].table ];
}else if(includeSchema[triggerDatabase].indexOf(triggers[i].table) === -1){
includeSchema[triggerDatabase].push(triggers[i].table);
}
}
self.zongji.set(self.zongjiSettings);
var newSelect = new LiveMysqlSelect(query, triggers, this);

@@ -67,0 +90,0 @@ self._select.push(newSelect);

2

package.json
{
"name": "mysql-live-select",
"version": "0.0.6",
"version": "0.0.7",
"description": "Live updating MySQL SELECT statements",

@@ -5,0 +5,0 @@ "main": "lib/LiveMysql.js",

@@ -117,2 +117,21 @@ /* mysql-live-select, MIT License ben@latenightsketches.com

error_no_db_selected: function(test){
server.on('ready', function(conn, esc, escId, queries){
test.throws(function(){
conn.select('SELECT 1+1', [ { table: 'fake_table' } ]);
}, /no database selected on trigger/);
test.throws(function(){
conn.select('SELECT 1+1');
}, /triggers array required/);
test.throws(function(){
conn.select('SELECT 1+1', []);
}, /triggers array required/);
test.done();
});
},
error_invalid_query: function(test){
var table = 'error_no_db';

@@ -126,16 +145,10 @@ server.on('ready', function(conn, esc, escId, queries){

conn.select('SELECT * FROM ' + escId(table), [ {
table: table
conn.select('SELECT notcol FROM ' + escId(table), [ {
table: table,
database: server.database
} ]).on('error', function(error){
test.equal(error.toString(),
'Error: no database selected on trigger');
test.ok(error.toString().match(/ER_BAD_FIELD_ERROR/));
test.done();
});
querySequence(conn.db, [
'UPDATE ' + escId(table) +
' SET `col` = 15'
], function(results){
// ...
});
});

@@ -142,0 +155,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc