(feat) added content "touching" capability (for developers)

This commit is contained in:
Ludovic Marcotte committed 2016-11-21 09:57:58 -05:00
1 parent a09e6dee06
commit b34f38f7fc
4 files changed
+98 -32

No files matched your search

+53 -2
View File
@@ -1187,7 +1187,7 @@ andAttribute: (EOAttribute *)_attribute
return error;
}
- (NSException *)deleteContentWithName:(NSString *)_name {
- (NSException *) deleteContentWithName:(NSString *)_name {
EOAdaptorChannel *storeChannel, *quickChannel;
EOAdaptorContext *adaptorCtx;
NSException *error;
@@ -1195,7 +1195,6 @@ andAttribute: (EOAttribute *)_attribute
NSCalendarDate *nowDate;
/* check preconditions */
if (_name == nil) {
return [NSException exceptionWithName:@"GCSDeleteException"
reason:@"no content filename was provided"
@@ -1334,6 +1333,58 @@ andAttribute: (EOAttribute *)_attribute
return error;
}
- (NSException *) touchContentWithName: (NSString *) _name
{
NSString *touchSql, *table;
EOAdaptorContext *adaptorCtx;
EOAdaptorChannel *channel;
EOAttribute *attribute;
NSCalendarDate *nowDate;
if (_name == nil)
return [NSException exceptionWithName: @"GCSDeleteException"
reason: @"no content filename was provided"
userInfo: nil];
channel = [self acquireStoreChannel];
if ((channel = [self acquireStoreChannel]) == nil)
{
[self errorWithFormat:@"could not open storage channel!"];
return nil;
}
adaptorCtx = [channel adaptorContext];
[adaptorCtx beginTransaction];
table = [self storeTableName];
attribute = [self _attributeForColumn: @"c_name"];
nowDate = [NSCalendarDate date];
if ([GCSFolderManager singleStoreMode])
touchSql = [NSString stringWithFormat: @"UPDATE %@ SET c_lastmodified = %u WHERE c_name = %@ AND c_folder_id = %@",
table,
(unsigned int) [nowDate timeIntervalSince1970],
[self _formatRowValue: _name
withAdaptor: [adaptorCtx adaptor]
andAttribute: attribute],
folderId];
else
touchSql = [NSString stringWithFormat: @"UPDATE %@ SET c_lastmodified = %u WHERE c_name = %@",
table,
(unsigned int) [nowDate timeIntervalSince1970],
[self _formatRowValue: _name
withAdaptor: [adaptorCtx adaptor]
andAttribute: attribute]];
[channel evaluateExpressionX: touchSql];
[[channel adaptorContext] commitTransaction];
[self releaseChannel: channel];
return nil;
}
- (NSException *)deleteFolder {
EOAdaptorChannel *channel;
NSString *delsql;