Problem with MySQL

04/30/2012 05:13 U2_Caparzo#1
Hi.

I started to try to change the NewestCOServer database to MySQL. i'm using the MySQLhandler.dll that come with the 5355 Hellmoth Source, i think it is the same that used Elite Co-Emu. but i have a problem when using the INSERT method to create a character, it doesn't insert nothing :c, but i can insert data in other tables, that confused me.

i have this in program.cs

to begin the connection
Code:
                MySqlHandler.MySqlArgument arg = new MySqlHandler.MySqlArgument();
                arg.User = "root";
                arg.Password = "";
                arg.Host = "localhost";
                arg.Database = "armagedon";
                MySqlHandler.Connections.Open(arg);
                MySqlHandler.MySqlCommandHandler.TurnOn();
if i add this to that code to it

Code:
MySqlHandler.MySqlCommand cmd = new MySqlHandler.MySqlCommand(MySqlHandler.MySqlCommandType.INSERT);
                cmd.Insert("test").
                Insert("Nombre", "Testing").Execute();
it works fine, but with this

Code:
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
            cmd.Insert("players")
            .Insert("EntityID", entityID)
            .Insert("Account", Account)
            .Insert("Character", Name)
            .Insert("Avatar", avatar)
            .Insert("Body", Body)
            .Insert("Hair", Hair)
            .Insert("Map", 1010)
            .Insert("X", 61)
            .Insert("Y", 109)
            .Insert("Job", Job)
            .Insert("Str", Str)
            .Insert("Agi", Agi)
            .Insert("Vit", Vit)
            .Insert("Spi", Spi)
            .Insert("CurHP", HP)
            .Insert("CurMP", CurMP)
            .Insert("Silvers", 100)
            .Insert("WHPassword", WHPassword)
            .Insert("Spouse", none)
            .Execute();
it don't works, none and WHPassword are strings defined already, same with integers values, so i dk what is wrong.

i hope that someone with more experience can help me with this...

Thanks
04/30/2012 05:31 pro4never#2
The fields in your insert code bust exactly follow the table structure.

EG: Look at the database and make sure your insert query here fills in EVERY value that does not have a default database value (map/x/y and others do iirc, they would be auto filled in)

That being said... If you're going to go through the effort of converting a source or setting up your own database system... Use nhibrinate or some other system. The sqlhandler is kinda crap. We were working on converting stuff in albetros but never bothered finishing it up.
04/30/2012 05:50 U2_Caparzo#3
Quote:
Originally Posted by pro4never View Post
The fields in your insert code bust exactly follow the table structure.

EG: Look at the database and make sure your insert query here fills in EVERY value that does not have a default database value (map/x/y and others do iirc, they would be auto filled in)

That being said... If you're going to go through the effort of converting a source or setting up your own database system... Use nhibrinate or some other system. The sqlhandler is kinda crap. We were working on converting stuff in albetros but never bothered finishing it up.
i see, but, is NHibernate more complex to use? i have to say that this would be my first time trying with MySQL so i have a lot to learn yet, and NHibernate i just heard of it when u posted Albetros and now :s... going to download it to see.
Thanks
04/30/2012 06:58 pro4never#4
NHibrinate is more work to set up but easier to use.

You essentially map your database in the source side and can then access, modify and safe them almost like you would any normal collection of data inside the source itself.

Basically you have a database object representing each record in that database. You can pull these records by any method you like.

Take a look at albetros and how it handles the DB objects, will give you a small idea.

Definitely more work in the setup though.