Calling MySQL stored procedure
Calling MySQL stored procedure
- Subject: Calling MySQL stored procedure
- From: email@hidden
- Date: Tue, 04 Dec 2007 21:14:09 +0800
I am using MCPKit. It's a wrapper of MySQL C API for Cocoa.
http://www.prioninteractive.com/article/mysqL-in-cocoa-using-mcpkit/
Calling a stored procedure which is a "select *" from an existing tables.
However, MySQL returns "can't return a result set in the given context".
After I did a 30mins search on google.
I found that I need to set the connection option to allow CLIENT_MULTI_RESULTS
I have also tried to set this option but the error is still here...
Anyone have similar experience can share please?
Thanks in advance.
Here is the code sniplet:
// MySQL
MCPConnection *theConnection = [[MCPConnection alloc] init];
[theConnection setConnectionOption:CLIENT_MULTI_RESULTS
toValue:YES];
[theConnection setConnectionOption:CLIENT_MULTI_QUERIES
toValue:YES];
[theConnection setConnectionOption:CLIENT_MULTI_STATEMENTS
toValue:YES];
[theConnection initToHost:@"127.0.0.1"
withLogin:@"root"
password:@""
usingPort:3306];
if ([theConnection isConnected]) {
NSLog(@"Connected.");
} else {
NSLog(@"Not Connected.");
}
if ([theConnection selectDB:@DATABASE_NAME]) {
NSLog(@"Database [%s] selected.", DATABASE_NAME);
} else {
NSLog(@"Database [%s] not selected.", DATABASE_NAME);
}
MCPResult *theResult;
//theResult = [theConnection queryString:@"select * from
imaging_operation"];
theResult = [theConnection queryString:@"CALL getAllOperation()"];
if ([theResult numOfRows] > 0) {
NSLog(@"Number of rows: %d", [theResult numOfRows]);
} else {
NSLog(@"No rows.");
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden