我有一个向量,我需要使用for来读取和执行sql查询这是我的代码:
for (int i=0; i < total; i++) {
NSString *consultaRelacionEnvios;
consultaRelacionEnvios = [[NSString alloc] initWithFormat:@"SELECT * FROM RELACIONENVIOS WHERE ID=%@",almacenIDAviso];
SQLClient* client = [SQLClient sharedInstance];
client.delegate = self;
[client connect:URLConsulta username:@"usernameDB" password:@"passwordDB" database:nameDB completion:^(BOOL success) {
if (success)
{
[client execute:consultaRelacionEnvios completion:^(NSArray* results) {
[self process0:results];
[client disconnect];
}];
}
}];
}
- (void)process0:(NSArray*)data {
for (NSArray* table in data)
for (NSDictionary* row in table)
for (NSString* column in row)
[almacenRelacionEnvios addObject:row[column]];
NSLog(@"%@",almacenRelacionEnvios);
}