Skip to content

Commit

Permalink
removed adapters that will not be shipped for browser build
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Johnson authored and Ryan Johnson committed Apr 21, 2010
1 parent 1584174 commit a8cae99
Show file tree
Hide file tree
Showing 24 changed files with 70 additions and 1,373 deletions.
4 changes: 0 additions & 4 deletions src/active_record.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ if(typeof exports != "undefined"){
//= require <active_record/base>
//= require <active_record/calculations>
//= require <active_record/adapters>
//= require <active_record/adapters/support/sql>
//= require <active_record/adapters/support/sqlite>
//= require <active_record/adapters/in_memory>
//= require <active_record/adapters/rest>
//= require <active_record/adapters/auto>
//= require <active_record/where_parser>
//= require <active_record/finders>
//= require <active_record/indicies>
Expand All @@ -25,7 +22,6 @@ if(typeof exports != "undefined"){
//= require <active_record/relationships/has_one>
//= require <active_record/relationships/has_many>
//= require <active_record/relationships/belongs_to>
//= require <active_record/migrations>
//= require <active_record/validations>
//= require <active_record/synchronization>

Expand Down
84 changes: 48 additions & 36 deletions src/active_record/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,15 @@ ActiveRecord.connection = null;
* ActiveRecord.connect();
*/
ActiveRecord.connect = function connect(adapter)
{
if(!adapter)
{
var connection = Adapters.Auto.connect.apply(Adapters.Auto, ActiveSupport.arrayFrom(arguments).slice(1));
if(connection)
{
ActiveRecord.connection = connection;
}
ActiveRecord.adapters.push(ActiveRecord.connection.constructor);
}
else
{
var connection = adapter.connect.apply(adapter, ActiveSupport.arrayFrom(arguments).slice(1));
if(connection)
{
var connection = adapter.connect.apply(adapter, ActiveSupport.arrayFrom(arguments).slice(1));

if(connection)
{
ActiveRecord.connection = connection;
}
ActiveRecord.adapters.push(adapter);
ActiveRecord.connection = connection;
}
ActiveRecord.adapters.push(adapter);
ActiveEvent.extend(ActiveRecord.connection);
if(!ActiveRecord.connection.preventConnectedNotification)
{
ActiveRecord.notify('connected');
}
ActiveRecord.notify('connected');
};

/**
Expand Down Expand Up @@ -153,6 +137,46 @@ Adapters.defaultResultSetIterator = function defaultResultSetIterator(iterator)
}
};

Adapters.objectIsFieldDefinition = function objectIsFieldDefinition(object)
{
return typeof(object) === 'object' && ActiveSupport.keys(object).length === 2 && ('type' in object) && ('value' in object);
};

Adapters.fieldTypesWithDefaultValues = {
'tinyint': 0,
'smallint': 0,
'mediumint': 0,
'int': 0,
'integer': 0,
'bigint': 0,
'float': 0,
'double': 0,
'double precision': 0,
'real': 0,
'decimal': 0,
'numeric': 0,

'date': '',
'datetime': '',
'timestamp': '',
'time': '',
'year': '',

'char': '',
'varchar': '',
'tinyblob': '',
'tinytext': '',
'blob': '',
'text': '',
'mediumtext': '',
'mediumblob': '',
'longblob': '',
'longtext': '',

'enum': '',
'set': ''
};


Adapters.InstanceMethods = {
setValueFromFieldIfValueIsNull: function setValueFromFieldIfValueIsNull(field,value)
Expand All @@ -161,7 +185,7 @@ Adapters.InstanceMethods = {
if (value === null || typeof(value) === 'undefined')
{
//default value was in field specification
if(Migrations.objectIsFieldDefinition(field))
if(Adapters.objectIsFieldDefinition(field))
{
var default_value = this.getDefaultValueFromFieldDefinition(field);
if(typeof(default_value) === 'undefined')
Expand Down Expand Up @@ -200,23 +224,11 @@ Adapters.InstanceMethods = {
},
getDefaultValueFromFieldDefinition: function getDefaultValueFromFieldDefinition(field)
{
return field.value ? field.value : Migrations.fieldTypesWithDefaultValues[field.type ? field.type.replace(/\(.*/g,'').toLowerCase() : ''];
return field.value ? field.value : Adapters.fieldTypesWithDefaultValues[field.type ? field.type.replace(/\(.*/g,'').toLowerCase() : ''];
},
quoteIdentifier: function quoteIdentifier(name)
{
return '"' + name + '"';
},
log: function log()
{
if(!ActiveRecord.logging)
{
return;
}
if(arguments[0])
{
arguments[0] = 'ActiveRecord: ' + arguments[0];
}
return ActiveSupport.log.apply(ActiveSupport,arguments || {});
}
};

Expand Down
98 changes: 0 additions & 98 deletions src/active_record/adapters/air.js

This file was deleted.

33 changes: 0 additions & 33 deletions src/active_record/adapters/auto.js

This file was deleted.

Loading

3 comments on commit a8cae99

@bkeepers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these be coming back?

@rickmzp
Copy link

@rickmzp rickmzp commented on a8cae99 Oct 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these be coming back at all?

@eastridge
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone steps up to maintain them, yes.

Please sign in to comment.