sqlite

How can i convert datetime to date format in sqlite selected vaues

狂风中的少年 提交于 2020-03-06 02:27:21
问题 I just try to convert datetime to date, but without success. Help me to do it: select date('startTime') from usertable ; select datetime(substr(startTime, 7, 4 )) from usertable; 回答1: Just try this.. it will convert datetime to date. SELECT strftime('%d-%m-%Y', fieldname) SELECT strftime('%d-%m-%Y', 'now') gives output 5-06-2015 来源: https://stackoverflow.com/questions/30661177/how-can-i-convert-datetime-to-date-format-in-sqlite-selected-vaues

how to use substring function sqlite android

老子叫甜甜 提交于 2020-03-05 21:10:46
问题 suppose I have a table name : TEST , that it has 2 columns ID and CONTENT , like this : TEST TABLE : ID ======= CONTENT 0 ======= hello world now, how can I split CONTENT column from 0 index to 5 index to retrieve just hello word? (at here, ID => 0) (I just want to use sql, not other functions in others languages ); 回答1: select substr(content, 0, 5) from test 回答2: The substr(X,Y,Z) function returns a substring of input string X that begins with the Y-th character and which is Z characters

how to use substring function sqlite android

南笙酒味 提交于 2020-03-05 21:09:10
问题 suppose I have a table name : TEST , that it has 2 columns ID and CONTENT , like this : TEST TABLE : ID ======= CONTENT 0 ======= hello world now, how can I split CONTENT column from 0 index to 5 index to retrieve just hello word? (at here, ID => 0) (I just want to use sql, not other functions in others languages ); 回答1: select substr(content, 0, 5) from test 回答2: The substr(X,Y,Z) function returns a substring of input string X that begins with the Y-th character and which is Z characters

【原创】如何在 libgda 和 SQLite 之间作出选择

ⅰ亾dé卋堺 提交于 2020-03-05 15:00:10
How to choose between Libgda and SQLite 如何在 libgda 和 SQLite 之间作出选择 (本文为 官方文档 翻译,以中英对照形式呈现) Libgda has been added as a new external dependency for GNOME 2.26, with now two database libraries: Libgda and SQLite. libgda 已作为一个新外部依赖项被添加到 GNOME 2.26 中了,如此就出现了 libgda 和 SQLite 并存的局面。 This page offers some hints about how to make the choice between the two when writing an application which needs to store/access some data in a database. 本篇文章针对编写需要进行存储/访问数据库的应用程序时,如何在上述两者之间作出选择给出了一些建议。 Comparison hints 差异方面 Of course if you want to either be able to access different databases types or you think you may

在 Synology 中使用 SQLite 归档文件信息

谁说我不能喝 提交于 2020-03-05 14:23:25
写在前面 前面借助 exiv2 和 exiftool 做照片视频做了归档,是时候把需要的信息存起来了。 考虑到数据的安全性、读写的便利性,决定用 SQLite ( Synology 内置)。 注: Synology 还内置了 Redis 、 PostGreSQL 。 建库 文件系统,只有文件全路径是唯一,其它信息均读出来方便日后查: CREATE TABLE if not exists FileInfo ( FullPath NVARCHAR(100) PRIMARY KEY NOT NULL, FileMd5 NCHAR(33) NOT NULL, FileType CHARACTER(9), FileSize INT NOT NULL, CreateTime DATETIME, UpdateTime DATETIME ); CREATE INDEX if not exists FullPath ON FileInfo (FullPath); CREATE INDEX if not exists CreateTime ON FileInfo (CreateTime); CREATE INDEX if not exists FileType ON FileInfo (FileType); CREATE INDEX if not exists FileMd5 ON FileInfo

access .sqlite database in the assets folder

≡放荡痞女 提交于 2020-03-05 11:44:23
问题 I know it's been asked many times on stackoverflow. Those posts have answers too, but none of them works for me. I have a database file mydb.sqlite placed it in assets folder. But it fails on the .openDatabase line. What am I doing wrong? In other posts I see that the dbpath pointing to /data/data , but I'm having hard time finding that path in my project. This is my very first android app. I have been an iphone developer for few years now. Error: android.database.sqlite

access .sqlite database in the assets folder

孤街醉人 提交于 2020-03-05 11:41:34
问题 I know it's been asked many times on stackoverflow. Those posts have answers too, but none of them works for me. I have a database file mydb.sqlite placed it in assets folder. But it fails on the .openDatabase line. What am I doing wrong? In other posts I see that the dbpath pointing to /data/data , but I'm having hard time finding that path in my project. This is my very first android app. I have been an iphone developer for few years now. Error: android.database.sqlite

delphi xe5 安卓 配置sqlite

半世苍凉 提交于 2020-03-05 10:01:42
本篇我们介绍一下在android手机上怎样使用sqlite数据库,这里用Navigator实现 增删改查。 1、新建firemonkey mobile application 2、选择blank application 3、这里选择分辨率,仍旧选择我女儿称呼的平板手机p3100的7寸分辨率 O(∩_∩)O~ ,界面上摆放一个open按钮,一个grid 同时拖拽一个 FDConnection 和 FDPhysSQLiteDriverLink1 FDQuery1 另外根据运行结果提示 还需要一个 FDGUIxWaitCursor ,运行的时候会有提示 4、连接sqlite 数据库,这里我就不再赘述怎样建立sqlite数据库和表,我这里建了个test.s3db 并建立一张table_test表。 右键点击 FDConnection,database选项选择建好的sqlite数据库 ,如有用户名和密码则分别输入 在fdquery中选择sql输入select * from table_test 5、绑定数据 选择view->LiveBindings Designer 然后点击绑定 向导 依次选择 在open按钮的事件中写上fdquery1.close;fdquery1.open 5、重要的发布: 菜单 project ->deployment->然后点击增加按钮,选择中sqlite数据

sqlite3遇到问题总结 1

懵懂的女人 提交于 2020-03-05 08:17:41
把工作中遇到的sqlite3问题,总结一下. www.cnblogs.com/scorpiozj rowid和 Integer主键及自增属性 大多数情况下,sqlite3的表都有一个rowid(也叫oid,_rowid_),这是一个64位的整数,并作为sqlite存储结构B树的主键.因此使用rowid查询会比以其他设定的主键查询,速度会非常快. 在做插入操作的时候,对于rowid的值通常情况下不要去指定,让系统自己去决定该去何值。因为sqlite会通过SQLITE_SEQUENCE来追踪表的rowid取值情况.而且sqlite定义了rowid的取值算法:在未超出rowid的范围内,待插入记录的rowid总是表中存在过的的rowid最大值+1。比如依次插入5条记录,此时最后一条记录的rowid是5,如果把这条记录删除再插入新记录,此时新纪录的rowid是6.而当rowid达到所能表达的最大值时,这时如果有新纪录要插入,系统就会随机从之前的没有使用过的正整数中随机取一个作为rowid(就是之前删除过的).若没有未使用的正整数并且你没有在插入的时候制定rowid为某一个负数的话,系统就会抛出SQLITE_FULL的错误. 如果在创建表的时候设置了主键,并且设置主键的那列是integer(不是int,short integer等等),并且主键没有设定降序时,这时的主键是rowid的别名

Get column value if it matches another column value in the same table

半腔热情 提交于 2020-03-05 06:05:16
问题 I have a SQLite table with comments like: Id | replyId | commentID_parentID | usernameChannelId | channelId 1 | NULL | NULL | a | g 2 | NULL | NULL | b | k NULL | 1.k | 1 | a | p NULL | 1.p | 1 | c | i 3 | NULL | NULL | d | h NULL | 2.k | 2 | g | g and a table with channels like: I want to know which user (userChannelId) replied to which user. So I take a row with a comment and check if: Id == NULL? Then it's a reply -> get userChannelId where commentID_parentID == Id Id != NULL? Then it's a