Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4681385yYou need a column called "timestamp" which would be bad in itself, you want to make a "created_date" field or similar and populate it on insert that contains the current timestamp or date/time depending on your concerns of the year 2038.
Also, DONT USE SELECT * !!!!!!!!!!!!!!!!!
I'll kill you myself if I see prod code that does that. -
The timestamp is actually saved for each row (either via a trigger or on the insert query) in a column named Timestamp, right?
-
C0D4681385y
-
And please. Please.
Prevent using registered names.
Never ... Ever ... Use eg. data types as names.
This can lead to nasty shit.
https://sqlite.org/lang_keywords.ht...
SQLite has no timestamp type.
You'd need an UNSIGNED BIG for that (2038+ compatiblity).
Please. Always. Really Always. Make sure that you only store UTC values inside a database. It takes away a lot of migraine later.
And finally: The error generated is very clear. :) -
@C0D4 i do. My Sqlite query for table is correct. I will share you once i goto home.
-
@Waytopranav shouldn't be a problem.
Post the DDL of the table or the table info...
Eg by querying sqlite_master:
@highlight
select * from sqlite_master where type = 'table'; -
C0D4681385y@c3r38r170 that's fair, but given the error it seems pretty self explan... hold on, ah I see your point.
-
C0D4681385y@Waytopranav
Initial issue I see is table name is Notess not Notes as per original post
I believe "Timestamp" may be being treated as a reserved word so you should enclose these with ' or " depending on if it's a field or a string.
Something like:
SELECT field, field2 FROM notes ORDER BY "timestamp" DESC
Outside of that, without rebuilding and testing I can't see much more that's obvious wrong here.
On second thought, timestamp isn't in the list for SQLite.
https://sqlite.org/lang_keywords.ht...
Related Rants
AS logcat
Sqlite.sqliteexception:no such column:Timestamp (code1):,while compiling : SELECT * FROM NOTEs ORDER BY Timestamp
I am trying to get the date and time on each entry of note..
question
android
sqlite
kotlin