SQL error

18 replies [Last post]
Posts: 1030

Been getting this error http://min.us/mveUN0M whenever I try to kick/ban anyone. Where can I fix this? Couldn't find it :/

Posts: 263

Hit retry, look for the cmd variable, check the SQL query Tongue

Posts: 1030

This is the problem query:

SELECT account_id AS a FROM `account_character` AS a INNER JOIN `view_user_character` c ON c.character_id=account_character.id WHERE name AS c = @name

Can't fix it since I have no idea where it is built.

Posts: 1691

Hah, my bad. Easy fix. Will have to finish something else I'm working on first though.

Posts: 1030

'kay, let me know when it's fixed Wink

Posts: 1691

Should be fixed.

Posts: 1030

Getting this error after applying the changes:


Posts: 1691

Thanks, should be fixed now.

Posts: 1030

On a related note, what is the correct input for the amount of time you want to ban someone?

I've seen that TimeSpan uses (0,0,0,0 ) for day, hour, minute, second or (0,0,0 ) for hour, minute second but how do you correctly specify the duration in the chatbox?

Posts: 1691

See the class DurationParser.

    /// <summary>
    /// Provides some ways to parse a duration of time from a string. Duration strings are formatted as
    /// a positive numeric value followed by a unit. The possible types of units, and their possible
    /// unit names, are:
    ///     second  - s, sec, secs, second, seconds
    ///     minute  - m, min, mins, minute, minutes
    ///     hour    - h, hr, hrs, hour, hours
    ///     day     - d, day, days
    ///     week    - w, wk, week, weeks
    ///     month   - mon, month, months
    ///     year    - y, yr, year, years
    /// </summary>
    /// <example>
    /// 5m10s       - 5 minutes and 10 seconds
    /// 3s          - 3 seconds
    /// 10s5y3m     - 5 years, 3 months, and 10 seconds
    /// </example>
    public static class DurationParser
    {
        ...
    }

Posts: 1030

Funny how the example is wrong.

10s5y3m - 5 years, 3 months, and 10 seconds

minute - m, min, mins, minute, minutes
month - mon, month, months

Posts: 1691

Pfff. Tongue

Posts: 1030

So what's m then? Months or minutes? Tongue

Posts: 1691

Minutes. The documentation was right, the example was wrong.

Posts: 1030

Anything I should change in the database (looking at the db.sql but didn't see anything major)? (Talking about r4466 btw)

Guess I have to since the server throws:

Cannot add or update a child row: a foreign key constraint fails (`web78_db13`.`account_ban`, CONSTRAINT `account_ban_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `account_temp` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

Posts: 1691

Like the change log said, only thing that changed in the latest database dump was the definer for the ban triggers.

When do you get that error?

Posts: 1030

When ever I try to ban someone.

Posts: 1691

Then the problem seems to be with this "account_temp" table you have.

Posts: 1030

Probably some thing Darkfrost added for phpbb3 support. I'll ask him Smile