1
0
Fork 0

Missing access-modifiers-implicit.js ex added

website
Mike Gerwitz 2015-05-15 01:14:40 -04:00
parent 724d11da6c
commit bdadd2addd
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
1 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,38 @@
var DatabaseRecord = Class( 'DatabaseRecord',
{
/* implicitly private */
_connection: null,
__construct: function( host, user, pass )
{
this._connection = this._connect( host, user, pass );
},
/* implicitly private */
_connect: function( host, user, pass )
{
// (do connection stuff)
return { host: host };
},
'protected query': function( query )
{
// perform query on this._connection, rather than exposing
// this._connection to subtypes
},
'protected escapeString': function( field )
{
return field.replace( "'", "\\'" );
},
/* public by default */
getName: function( id )
{
return this._query(
"SELECT name FROM users WHERE id = '" +
this._escapeString( id ) + "' LIMIT 1"
);
},
} );