[SOLVED] mysql_use_result returns NULL but no error set?
Posted by: Daniel Chiaramello
Date: October 16, 2012 01:08AM

Hello.

I apologize, I was fooled by a C++ embedding around my requests...

  template <MYSQL_RES* (*MySQLCall)(MYSQL*)>
  class ScopedCall
  {
    public:
      ScopedCall(MYSQL* mysql, MYSQL_RES*& res) : res_(res)
      {
        res = MySQLCall(mysql);
      }

      ~ScopedCall() { release(); }

      void release() throw() { mysql_free_result(res_); res_ = 0; }

    private:
      ScopedCall(const ScopedCall&);
      ScopedCall& operator=(const ScopedCall&);

      MYSQL_RES*& res_;
  };

  ScopedCall<mysql_use_result>(mysql,res);
  if (res == NULL)
  {
    MM_REPORT("ERROR: '%s'\n", mysql_error(mysql));
    return;
  }

Unfortunately, the usage of ScopedCall was incorrect, it should have been written as:
ScopedCall<mysql_use_result> queryResult(mysql,res);

So, nothing to do with MySQL there...

Sorry for noise,
Daniel

Options: ReplyQuote


Subject
Views
Written By
Posted
[SOLVED] mysql_use_result returns NULL but no error set?
1330
October 16, 2012 01:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.