> I know that MySQL and Rom integration has been discussed on this list for a
> while now and I have been trying to implement a few changes on my little
> project mud. I have been able to move helps over to a MySQL table and query
> the table as needed to look up helps. I have even, mostly anyway, gotten
> the Mud to maintain a open connection to the database while it is running
> so as not to continually open and close the request. However I was
> wondering how would I go to move over things that are not so static as the
> help files and that need to be loaded into memory? Does anyone have any
> small example , really looking for something short that tells how to run a
> query and keep the data in memory, of what they did for things like player
> files , areas, or items and mobs?

Really you'll end up querying, then copying all of the results from the query 
into other variables, then freeing the query results.
like....
  if (mysql_ping(&mysql))
  {
    mysql_query(&mysql,
      "select level,title from players where name='whoever'");
    if ((res = mysql_store_result(&mysql)))
    {
      if(row = mysql_fetch_row(res))
      {
        ch->level = atoi(row[0]);
        ch->title = str_dup(row[1]);
      }
      mysql_free_result(res);
    }
  }

--Palrich.


Reply via email to