Everyone,
I have the following table:
mysql> SELECT * FROM Churches_Clubs WHERE church_club_church_id = 1;
+----------------+-----------------------+---------------------+
| church_club_id | church_club_church_id | church_club_club_id |
+----------------+-----------------------+---------------------+
| 1 | 1 | 1 |
| 6 | 1 | 4 |
| 7 | 1 | 5 |
+----------------+-----------------------+---------------------+
I want to add a row with:
church_club_church_id = 1
church_club_club_id = 2
In the file /rpc/Churches_Clubs.sjs, I have:
newRecord: function(example) { return Schema.newRecord('Churches_Clubs', example); },
putOne: function(example) {
console.log('Churches_Clubs.sjs : putOne : example =');
console.dir(example);
var church_club = {};
church_club.extend({
church_club_id: 0,
church_club_church_id: example.church_club_church_id,
church_club_club_id: example.church_club_club_id
});
church_club = Churches_Clubs.newRecord(church_club);
console.log('Churches_Clubs.sjs : putOne : church_club =');
console.dir(church_club);
return church_club;
}
The output of the above is:
Churches_Clubs.sjs : putOne : example =
/var/www/acs/rpc/Churches_Clubs.sjs line 89 (exports.putOne):
(object) :
[church_club_church_id] : (number) 1
[church_club_club_id] : (number) 2
Churches_Clubs.sjs : putOne : church_club =
/var/www/acs/rpc/Churches_Clubs.sjs line 102 (exports.putOne):
(object) :
[church_club_id] : (number) 0
[church_club_church_id] : (number) 1
[church_club_club_id] : (number) 2
It is pretty obvious from the info above, but for completeness, here is the schema definition:
Schema.define({
name: 'Churches_Clubs',
fields: [
{ name: 'church_club_id', type: 'int', autoIncrement: true, defaultValue: 1 },
{ name: 'church_club_church_id', type: 'int' },
{ name: 'church_club_club_id', type: 'int' }
],
indexes: ['church_club_church_id', 'church_club_club_id'],
primaryKey: 'church_club_id'
});
So, WHY after executing 'putOne' and therefore specifically, this line from above;
church_club = Schema.newRecord('Churches_Clubs', church_club);
do I still have the same records in the table as shown below?
mysql> SELECT * FROM Churches_Clubs WHERE church_club_church_id = 1;
+----------------+-----------------------+---------------------+
| church_club_id | church_club_church_id | church_club_club_id |
+----------------+-----------------------+---------------------+
| 1 | 1 | 1 |
| 6 | 1 | 4 |
| 7 | 1 | 5 |
+----------------+-----------------------+---------------------+
I fear I am doing (or not doing) something really 'stupid', and can't see it. I am hoping extra eye on this will find it, because I need to stop pulling out the little hair that I have left. So - please - just point it out and don't worry about making me look like a fool. :)
Thanks,
Eric