Скажите, я что то не правильно делаю или при INSERT INTO нельзя вообще условия ставить в SQLite3?
INSERT INTO inventory (id1,id2,quantity,type,char_name)
VALUES (
(SELECT ('inventory'.'id'+1) AS 'free_id' FROM inventory
WHERE (SELECT 1 FROM inventory AS st
WHERE st.id = ('inventory'.'id'+1))
IS NULL ORDER BY 'inventory'.'id'+1
LIMIT 1),
%2,
1,
%5,
'%1'
)
WHERE (SELECT stackable FROM item
WHERE id = %2) = true AND
(SELECT money FROM character
WHERE name = '%1') ›=
(SELECT costBay FROM item
WHERE id = %2)AND
(SELECT EXISTS(
SELECT itemId
FROM inventory
WHERE itemId = %2 AND char_name = '%1'
LIMIT 1)) = 0;