Page 1 of 1

10.1 | mymap

PostPosted: 23 May 2013, 18:15
by Ultima
Tried to make a map.

Code: Select all
-------------------------
----5/23/2013 10:14:05 AM ----
Type: SQLiteException
Source: System.Data.SQLite
Message: SQLite error
no such column: Map
Target: Prepare
Trace:    at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
   at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at MCDzienny.SQLite.fillData(String queryString, Dictionary`2 parameters, Boolean skipError)
   at MCDzienny.DBInterface.fillData(String query, Dictionary`2 parameters)
   at MCDzienny.Level.Load(String directoryPath, String mapName, String owner, MapType type, Boolean isAutoUnloading)

-------------------------



Code: Select all
SELECT * FROM `Zones` WHERE Map = @Id


"Unable to load map <map name>"

Re: 10.1 | mymap

PostPosted: 23 May 2013, 18:23
by Ultima
Other bug:

My username is _Ultima_, is this correct?

C:\Users\***\Desktop\MCDFreebuild\maps\mymaps\_\_U\_Ul\_Ultima_ ?

Re: 10.1 | mymap

PostPosted: 23 May 2013, 18:25
by Ultima
Other bug:

When trying to use /mymap maps it doesn't stop asking for a map name if you enter a other command.
If you use /a to stop it you get a message "An error has occured." winhout the error.

Re: 10.1 | mymap

PostPosted: 23 May 2013, 19:18
by dzienny
It seems that you have to delete 5 sql tables named: Blocks, Portals, Messages, Zones and Ratings. Don't worry you won't lose any data as they are only used with mymaps. After the deletion you have to restart the server so that the tables will get recreated

Ultima wrote:My username is _Ultima_, is this correct?

C:\Users\***\Desktop\MCDFreebuild\maps\mymaps\_\_U\_Ul\_Ultima_ ?

Yes, it's correct. Folders are nested to minimize the amount of folders within one folder. It's a nod toward the Linux users.

Re: 10.1 | mymap

PostPosted: 24 May 2013, 00:45
by dzienny
To delete the tables you should use /sql command i.e. /sql DROP TABLE TableName;

Mind that this command allows full access to a database. It shouldn't be accessible to anyone but console.
Code: Select all
//
// Coded by dzienny - 2013
//

using System;
using System.Data;
using System.Linq;

namespace MCDzienny
{
    public class CmdSql : Command
    {
        public override string name { get { return "sql"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "other"; } }
        public override bool museumUsable { get { return true; } }
        public override LevelPermission defaultRank { get { return LevelPermission.Nobody; } }

        public override void Use(Player p, string message)
        {
            DataTable queryResults = DBInterface.fillData(message, false);
            if (queryResults.Columns.Count == 0)
            {
                Player.SendMessage(p, "Query executed.");
                return;
            }
            if (queryResults.Rows.Count == 0)
            {
                Player.SendMessage(p, "No results found.");
                return;
            }

            // Display column names.
            string columnNames = String.Join(" | ", queryResults.Columns.Cast<DataColumn>().Select(c => c.ToString()).ToArray());
            Player.SendMessage(p, columnNames);

            // Display rows data.
            foreach (DataRow row in queryResults.Rows)
            {
                string rowItems = String.Join(" | ", row.ItemArray.Select(i => i.ToString()).ToArray());
                Player.SendMessage(p, rowItems);
            }

            queryResults.Dispose();
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "/sql [query] - executes [query] on the server database.");
        }
    }
}