• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Calling MySQL stored procedure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Calling MySQL stored procedure
      • From: Toplica Tanasković <email@hidden>
  • Prev by Date: How to install gcc3.3 w xc25 & leopard
  • Next by Date: Re: Hundred of C++ linker warnings in Xcode 3: odd but not fatal
  • Previous by thread: Re: How to install gcc3.3 w xc25 & leopard
  • Next by thread: Re: Calling MySQL stored procedure
  • Index(es):
    • Date
    • Thread