marcoarment / FCModel

An alternative to Core Data for people who like having direct SQL access.
MIT License
1.65k stars 173 forks source link

[FCModel numberOfInstancesWhere:arguments:] method #84

Closed ilyannn closed 9 years ago

ilyannn commented 10 years ago

Swift didn't want to play nice with varargs in -numberOfInstancesWhere: (does it work for anyone else?), so I set to create an array version of it.

A common base for both old and new methods, (NSUInteger)_numberOfInstancesWhere:(NSString *)queryAfterWHERE withArgumentsInArray:(NSArray *)array orVAList:(va_list)args, was thus produced by analogy with (id)_instancesWhere:(NSString *)query andArgs:(va_list)args orArgsArray:(NSArray *)argsArray orResultSet:(FMResultSet *)existingResultSet onlyFirst:(BOOL)onlyFirst keyed:(BOOL)keyed.

_Disclaimer: I tested both methods, but va_list is new for me, so a careful second look might be in order._

segiddins commented 10 years ago

Swift didn't want to play nice with varargs in -numberOfInstancesWhere: (does it work for anyone else?), so I set to create an array version of it.

Swift will not work with C variadic functions.

thijsnado commented 10 years ago

Seems like this is an issue for many of the variadic function methods

marcoarment commented 9 years ago

Just made this redundant by fixing the bigger issue in c2d380a6.