SA-MP Forums Archive
SQLite: Error 19 - constraint failed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SQLite: Error 19 - constraint failed (/showthread.php?tid=267716)



SQLite: Error 19 - constraint failed - Cyanide - 09.07.2011

Hey SA:MP Forum,
I've researched this problem on multiple search engines and cannot find a solution that works. I'm attempting to run a simple query. Which is below:

PHP код:
INSERT INTO `accounts` (`username`, `password`, `ipaddress`) VALUES('a''b''c'); 
In return I receive a error
Quote:

[Err] 19 - constraint failed

Below is the SQL structure.

Quote:
Originally Posted by Structure Name; Structure Type; Structure Length
SQLID INTEGER 0
username TEXT 24
password TEXT 130
ipaddress TEXT 16



Re: SQLite: Error 19 - constraint failed - Simon - 16.07.2011

What is the exact query you used to create the table? You are not using foreign keys or check constraints, correct?

I have a feeling those numeric values you have for "structure length" may be tripping you up. It may be an error with primary key also, but without more information I'm just guessing.


Re: SQLite: Error 19 - constraint failed - cessil - 16.07.2011

you don't use ; in SQL, and you need a WHERE x='y'


Re: SQLite: Error 19 - constraint failed - Cyanide - 16.07.2011

Quote:
Originally Posted by cessil
Посмотреть сообщение
you don't use ; in SQL, and you need a WHERE x='y'
Yes you can. Research SQL statements.


Re: SQLite: Error 19 - constraint failed - cessil - 16.07.2011

oh ok then in that case you're missing the SQLID


Re: SQLite: Error 19 - constraint failed - Cyanide - 16.07.2011

Quote:
Originally Posted by cessil
Посмотреть сообщение
oh ok then in that case you're missing the SQLID
SQLID is already in the structure as you can see from the post. Also, you don't need to insert a SQLID in a query when the structure is a auto-increment.


Re: SQLite: Error 19 - constraint failed - cessil - 16.07.2011

ok then start debugging it try different things like
pawn Код:
INSERT INTO `accounts` (`username`, `password`) VALUES('a', 'b');