Greetings,

Recently, I've been in the process of converting things from files to
MySQL. While I'm sure I'm far from the advanced programmer, I don't
consider myself a newbie programmer by any means, yet there's a couple
of things that stump me right now, and I thought I'd toss it out to the
list to see how those that have dealt with this in the past have done
so.

Firstly, fread_flag. Unfortunately, this function looks for a file to
read from, and the idea behind moving everything to SQL is to get things
AWAY from the file structure and into the db structure itself.
Fwrite_flag tends to work for getting the flag TO the structure, but
fread_flag won't read it back. For the most part, it's not hard to use
flag_convert, as that's not depending on a file, but if there's more
than one flag, then you're pretty much screwed. How can this be handled
differently? Is there a way to strcpy the row, then split it up into
individual letters, tossing THEM into flag convert?

Secondly, the issue with escape sequences. For the MOST part, the
following will work in order to insert mobs/rooms/objects into the
database itself:

name=string_replace(social_table[social].name, "\'",  "\\'");

That's an example of how I've dealt with the socials for example (yeah,
socials shouldn't have a tick in the name, but never can be too
careful). The problem is that there's a FEW mobs/rooms/objects out there
that have more than one tick in their description, and that trick will
only work for the first one, so the rest don't even make it to the
database.

Sure, I've tried: mysql_escape_string(cleaned, argument,
strlen(argument)); , but either that doesn't work, or I'm missing
something in how to do it. In the above case, the example would be as
follows:

Name=str_dup(social_table[social].name);
Mysql_escape_string(cleaned, name, strlen(name));
If I'm not mistaken, that's how it SHOULD be set up right? At that, it's
still missing most of the mobs/areas.

I apologize if the thread seems a bit off topic, or even if I seem to be
too much of a newbie in these matters. Fact of the matter is that I'm
learning as I go (the best way to get experience from what I've found).
I'm a quick student, but sometimes I run across things that kind of
confuse me:).


+----------------------------------------------------+
+   TJW: Head Tech, designer: Dreamless Realms Mud   +
+   Mud : http://drealms.kyndig.com                          +
+   Telnet: drealms.kyndig.com port 9275                     +
+   OLC Docs: http://olc.kyndig.com                        +
+----------------------------------------------------+





Reply via email to