SQLite not creating sql_sequence properly
#7

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
I noticed that Query is being executed correctly but it does not create a new row each time I complete a register.

I have been brainstorming looking at topics till now but couldn't find a solution.

Here is my code
pawn Код:
if(dialogid == Register)
    {
        if(response)
        {
            if(!IsValidPassword(inputtext))
            {
                SendClientMessage(playerid, -1, "[ERROR]Invalid password, valid characters are A-Z, a-z, 0-9.");
                ShowPlayerDialog(playerid, Register, DIALOG_STYLE_PASSWORD, "Register", "Welcome new comer! Please choose a password and type it in to register.", "Register", "Quit");
                return 1;
            }
            if(strlen(inputtext) < 3 || strlen(inputtext) > 24)
            {
                SendClientMessage(playerid, -1, "[ERROR]You can only write a password that contains 3 to 24 characters.");
                ShowPlayerDialog(playerid, Register, DIALOG_STYLE_PASSWORD, "Register", "Welcome new comer! Please choose a password and type it in to register.", "Register", "Quit");
                return 1;
            }
            new Query[800];
            WP_Hash(dAdmin[playerid][USER_PASSWORD], 129, inputtext);
            format(Query, sizeof(Query), "INSERT INTO users (username, password) VALUES ('%s', '%s')", DB_Escape(dAdmin[playerid][USER_NAME]), DB_Escape(dAdmin[playerid][USER_PASSWORD]));
            db_query(Database, Query);
            ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD, "Login", "Congratulations! You have successfully registered to the server to complete the proccess re enter your password.", "Login", "Quit");
        }
        else Kick(playerid);
    }
print
Код:
[23:56:22] [join] DarkLored has joined the server (0:127.0.0.1)
[23:56:24] INSERT INTO users (username, password) VALUES ('DarkLored', '947BDCAF9B8FAC501D1C9DAA37DC57714F85AA0D781B18914B29BCF379DFBA665BBEDC15817873B1D92ADE4ABFE8ECDC8EBFC07F463D268ED4C595B4E383A8DB')
[23:56:35] [part] DarkLored has left the server (0:1)
The query is good, but not good enough for SQLite though.
This query won't execute, because of NOT NULL attribute, which is assigned for each column in this table (see the CREATE TABLE.. structure).

There are (I guess only those are) 3 possible solutions:
  1. You've to remove NOT NULL attribute from table structure
  2. You have to assign values in 'INSERT INTO' query FOR EACH column in this table
  3. Recreate this table structure and assign the default values for each column, so that You won't worry about assigning values for each column in one single query.
Hope You'll fix this problem, for any further questions, just go ahead.

Greetings.
Reply


Messages In This Thread
SQLite not creating sql_sequence properly - by DarkLored - 25.08.2015, 17:22
Re: SQLite not creating sql_sequence properly - by LetsOWN[PL] - 25.08.2015, 17:40
Re: SQLite not creating sql_sequence properly - by DarkLored - 25.08.2015, 17:44
Re: SQLite not creating sql_sequence properly - by LetsOWN[PL] - 25.08.2015, 18:03
Re: SQLite not creating sql_sequence properly - by DarkLored - 25.08.2015, 23:29
Re: SQLite not creating sql_sequence properly - by DarkLored - 26.08.2015, 04:21
Re: SQLite not creating sql_sequence properly - by LetsOWN[PL] - 26.08.2015, 08:52
Re: SQLite not creating sql_sequence properly - by DarkLored - 26.08.2015, 16:28

Forum Jump:


Users browsing this thread: 1 Guest(s)