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

ee-orm

Package Overview
Dependencies
Maintainers
2
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-orm - npm Package Compare versions

Comparing version 0.9.6 to 0.10.0

7

lib/Model.js

@@ -159,3 +159,8 @@ !function(){

}
else this._values[property] = item;
else {
// convert to date type before sending to the db
if (item && this._defintion.columns[property].jsTypeMapping === 'date' && !type.date(item)) item = new Date(item);
this._values[property] = item;
}
}

@@ -162,0 +167,0 @@ }.bind(this));

8

lib/ModelBuilder.js

@@ -285,7 +285,11 @@ !function(){

definition.get = function(){
definition.get = function() {
return this._values[columnName];
};
definition.set = function(value){
definition.set = function(value) {
// check for valid types, like dates
if (value && column.jsTypeMapping === 'date' && !type.date(value)) value = new Date(value);
// check if there was changed anything
if (this._values[columnName] !== value) {

@@ -292,0 +296,0 @@ this._changedValues.push(columnName);

@@ -33,2 +33,3 @@ !function(){

// driver names

@@ -41,3 +42,2 @@ , _driverNames: {

/*

@@ -44,0 +44,0 @@ * class constructor, initialize everything

@@ -934,2 +934,7 @@ !function(){

// check the types of the values
Object.keys(values).forEach(function(columnName) {
if (values[columnName] && this._definition.columns[columnName].jsTypeMapping === 'date' && !type.date(values[columnName])) values[columnName] = new Date(values[columnName]);
}.bind(this));
this._rootResource.query.values = values;

@@ -936,0 +941,0 @@

{
"name" : "ee-orm"
, "description" : "ORM for postgres and mysql. Loads and saves referenced entites, executes complex queries, supports joins, transactions, complex database clusters, connection pooling and much more. No conventions."
, "version" : "0.9.6"
, "version" : "0.10.0"
, "homepage" : "https://github.com/eventEmitter/ee-orm"

@@ -27,4 +27,4 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)"

, "ee-db-cluster" : "0.2.x"
, "ee-mysql-connection" : "^0.3.1"
, "ee-postgres-connection" : "^0.5.2"
, "ee-mysql-connection" : "^0.4.1"
, "ee-postgres-connection" : "0.6.0"
, "es6-promise" : "2.0.x"

@@ -31,0 +31,0 @@ }

@@ -19,19 +19,21 @@

log('orm loaded');
log('orm loaded', orm);
new db.image({
url: 'mapping deletion test'
, event: db.event({id:2})
}).save().then(function() {
return db.event({id:2}, ['*']).getEvent_image('*').fetchImage(['*']).findOne();
}).then(function(evt) {
log(evt);
return evt.event_image[0].delete();
}).then(function() {
return db.event({id:2}, ['*']).getEvent_image('*').fetchImage(['*']).findOne();
}).then(function(evt) {
log(evt);
}).catch(log);
//return log(db.typeTest.getDefinition());
db.timeZoneTest('*').find(log);
//return;
new db.timeZoneTest({
timstampWithTimezone: '2015-01-20 08:00:00' // '2015-01-20T08:00:00.000Z'
, timstampWithoutTimezone: '2015-01-20 08:00:00' // '2015-01-20T08:00:00.000Z'
}).save().then(function(record) {
log(record);
return db.timeZoneTest('*', {id:record.id}).findOne();
}).then(function(data) {
log(data);
}).catch(err);
/*

@@ -61,2 +63,100 @@ db.shop(['*'], {id: 1})

*/
});
});
/*
/ *
* bring the query into the correcto format
*
* @param <String> SQL
* @param <Mixed> object, array, null, undefined query parameters
* /
, _paramterizeQuery: function(SQLString, parameters) { //log(SQLString, parameters);
var values = []
, reg = /\?([^\b,;\.\s]+)/gi
, match;
// get a list of parameters from the string
while (match = reg.exec(SQLString)) {
//log(match[1]);
values.push(parameters[match[1]]);
}
// replace
reg.lastIndex = 0;
return {
SQL: SQLString.replace(reg, '?')
, values: values
};
}
/ *
* bring the query into the correcto format
*
* @param <String> SQL
* @param <Mixed> object, array, null, undefined query parameters
* /
, _paramterizeQuery: function(SQLString, parameters) { //log(SQLString, parameters);
var values = []
, reg = /\?([a-z0-9_-]+)/gi
, match;
// get a list of parameters from the string
while (match = reg.exec(SQLString)) {
//log(match[1]);
values.push(parameters[match[1]]);
SQLString = SQLString.replace(match[0], '$'+values.length);
reg.lastIndex += ('$'+values.length).length-match[0].length;
}
// replace
reg.lastIndex = 0;
return {
SQL: SQLString //.replace(reg, '?')
, values: values
};
}
, _executeOneQuery: function(mode, query, callback) {
var SQLString;
query.SQLString += ';';
// fill parameterized queries
queryConfig = this._paramterizeQuery(query.SQLString, query.parameters);
// execute the query
this._query(queryConfig.SQL, queryConfig.values, callback);
}
, queryRaw: function() {
var SQLString = arg(arguments, 'string')
, callback = arg(arguments, 'function', function(){})
, parameters = arg(arguments, 'array', arg(arguments, 'object', {}))
, readOnly = arg(arguments, 'boolean', true)
, queryConfig;
this._setBusy();
queryConfig = this._paramterizeQuery(SQLString, parameters);
//SQLString = this._fillSQL(SQLString, parameters);
this._query(queryConfig.SQL, queryConfig.values, function(err, data) {
callback(err, data);
this._setIdle();
}.bind(this));
}
*/

@@ -524,4 +524,2 @@

else {
log(event);
event.save(function(err){

@@ -528,0 +526,0 @@ if (err) done(err);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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