List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:August 21 2008 9:24am
Subject:Re: A way to copy mysqlpp::StoreQueryResult into a std::map?
View as plain text  
Alex wrote:
> 
> So you can understand that I wouldn't be able to directly refer to the
> specific command the user wants help for as the vector is split up in
> numbers.

I understand no such thing.  The answer is simple either way:

	Query q = conn.query("SELECT * FROM command WHERE NAME =");
	q << quote << myCommandName;
	StoreQueryResult res = q.store();
	if (res) {
		// have help for this command
	}
	else {
		// don't have help for this command
	}

Or:

	class command {
	public:
		command(const char* name, const char* help = 0,
			const char* syntax = 0) :
		name_(name),
		help_(help ? help : ""),
		syntax_(syntax ? syntax : "")
		{
		}
		....
		bool operator==(const command& rhs)
		{
			return name_ == rhs.name_;
		}
	private:
		string name_, help_, syntax_;
	};

	vector<commands> vc;

	// populate vector of command objects somehow

	vector<commands>::iterator it = find(vc.begin(), vc.end(),
		command(myCommandName));
	if (it != vc.end()) {
		// have help for this command
	}
	else {
		// don't have help for this command
	}

So, is this a homework problem, or what?
Thread
A way to copy mysqlpp::StoreQueryResult into a std::map?Alex13 Aug
  • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young13 Aug
    • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex13 Aug
      • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young13 Aug
        • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex14 Aug
          • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex17 Aug
            • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young17 Aug
              • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex19 Aug
                • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young19 Aug
                  • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex20 Aug
                    • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young21 Aug
                      • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex21 Aug
                        • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young21 Aug
                          • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex21 Aug
                            • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex22 Aug
                              • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young22 Aug
                                • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex22 Aug
                                  • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young22 Aug
                                    • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex22 Aug
                                      • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex22 Aug
                                      • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young22 Aug
                                        • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex22 Aug
                                          • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young22 Aug
                                            • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex25 Aug
                                              • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Joel Fielder26 Aug
                                                • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex26 Aug
                                                  • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Joel Fielder26 Aug
                                                    • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex26 Aug
                                                  • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Warren Young26 Aug
                                                    • Re: A way to copy mysqlpp::StoreQueryResult into a std::map?Alex27 Aug