SA-MP Forums Archive
Expressions Do Not Work In SA-MP SQLite - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Expressions Do Not Work In SA-MP SQLite (/showthread.php?tid=516555)



Expressions Do Not Work In SA-MP SQLite - DrakeX - 31.05.2014

After testing numerous queries, I've come to the conclusion that expressions do not work in SA-MP's SQLite. I've tried various and as mentioned numerous queries, only to find the syntax's which work outside of SA-MP's SQLite do not have an effect.


Re: Expressions Do Not Work In SA-MP SQLite - KingHual - 01.06.2014

Examples?


Re: Expressions Do Not Work In SA-MP SQLite - DrakeX - 04.06.2014

Quote:
Originally Posted by KingHual
Посмотреть сообщение
Examples?
pawn Код:
db_query(database, "SELECT `STAT` FROM `TABLE` WHERE `STAT` > 1 ORDER BY (`STAT` * 1) DESC");
This proportion has no effect on the query:

pawn Код:
WHERE `STAT` > 1
(I've tried querying various syntax's with the same result(s)). I thought the issue was my syntax usage, but after checking various articles on SQLite, that doesn't seem to be the case.

Quote:
Originally Posted by Calgon
Посмотреть сообщение
IS UNKNOWN CMMAND BRO
YEAH MEN.


Re: Expressions Do Not Work In SA-MP SQLite - Pottus - 04.06.2014

Quote:
Originally Posted by DrakeX
Посмотреть сообщение
pawn Код:
db_query(database, "SELECT `STAT` FROM `TABLE` WHERE `STAT` > 1 ORDER BY (`STAT` * 1) DESC");
This proportion has no effect on the query:

pawn Код:
WHERE `STAT` > 1
(I've tried querying various syntax's with the same result(s)). I thought the issue was my syntax usage, but after checking various articles on SQLite, that doesn't seem to be the case.



YEAH MEN.
Is `STAT` type numeric ?


Re: Expressions Do Not Work In SA-MP SQLite - DrakeX - 04.06.2014

Numeric when the table is initially created? If so, no, I haven't specified field types, however the value is numerical when saved and read. I've also tried using:

pawn Код:
WHERE (`STAT` * 1) > 1
With no luck.


Re: Expressions Do Not Work In SA-MP SQLite - Pottus - 09.06.2014

Make sure the table type is numeric I've experienced this problem before you could probably also do this but not recommended.

pawn Код:
db_query(database, "SELECT `STAT` FROM `TABLE` WHERE `STAT` > '1' ORDER BY (`STAT` * '1') DESC");
At any rate if your using SQLite then using SQLitei is for you here is my recommended read overs for using SQLite with SAMP. SQLitei has query error reporting which is very useful for debugging queries (only works on Windows) technically you don't need to use any native features of SQLitei either to take advantage of some of the features. I will recommend you open your db's with this native.

pawn Код:
DB:db_open_persistent(name[])
https://sampforum.blast.hk/showthread.php?tid=449536 - Konstantinos tutorial
https://sampforum.blast.hk/showthread.php?tid=303682 - SQLitei


Re: Expressions Do Not Work In SA-MP SQLite - DrakeX - 09.06.2014

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Make sure the table type is numeric I've experienced this problem before you could probably also do this but not recommended.

pawn Код:
db_query(database, "SELECT `STAT` FROM `TABLE` WHERE `STAT` > '1' ORDER BY (`STAT` * '1') DESC");
At any rate if your using SQLite then using SQLitei is for you here is my recommended read overs for using SQLite with SAMP. SQLitei has query error reporting which is very useful for debugging queries (only works on Windows) technically you don't need to use any native features of SQLitei either to take advantage of some of the features. I will recommend you open your db's with this native.

pawn Код:
DB:db_open_persistent(name[])
https://sampforum.blast.hk/showthread.php?tid=449536 - Konstantinos tutorial
https://sampforum.blast.hk/showthread.php?tid=303682 - SQLitei
Thanks, changing it to numeric from my SQLite data browser fixed the issue. I'm currently using another include which prints errors (from what I recall -- Emmet's), but it isn't specific. I'll take a look at and probably start using SQLitei now however.