sqlite

Datatype mismatch (code 20) while inserting

旧巷老猫 提交于 2020-01-23 03:15:05
问题 In my project im using sqlite database to save pictures and their locations. i get this error while trying to insert the data into my database: E/SQLiteLog: (20) statement aborts at 5: [INSERT INTO PHOTO VALUES(NULL,?,?,?,?)] datatype mismatch D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.tomer.finalproject, PID: 18550 android.database.sqlite.SQLiteDatatypeMismatchException: datatype mismatch (code 20) at android.database.sqlite

DbContext Slow Loading

自作多情 提交于 2020-01-23 03:07:10
问题 I have WPF applicaton, and in every usercontrol.xaml.cs file I have a field private readonly DBContextManager dbManager = new DBContextManager(); Class DBContextManager: public class DBContextManager : DbContext { public DBContextManager() : base("App_DbContext") { Database.SetInitializer<DBContextManager>(null); } public DbSet<Person> Persons { get; set; } } So, first time when I open usercontrol state which uses DbContext, it takes 2-4s to load before that usercontrol interface will show up

Prevent insertion if the records already exist in sqlite

百般思念 提交于 2020-01-23 03:03:58
问题 I am programming for iPhone and i am using SQLITE DB for my app.I have a situation where i want to insert records into the table,only if the records doesn't exist previously.Otherwise the records should not get inserted. How can i do this?Please any body suggest me a suitable query for this. Thank you one and all, 回答1: Looking at SQLite's INSERT page http://www.sqlite.org/lang_insert.html. You can do it using the following syntax INSERT OR IGNORE INTO tablename .... Example INSERT OR IGNORE

store exact cv::Mat image in sqlite3 database

房东的猫 提交于 2020-01-23 02:32:26
问题 is there any way to store exact cv::Mat format data in sqlite3 using Qt .. as i will be using the same cv::Mat format in future.. i tried converting image to unsigned char* and them storing it.. but this didn't worked for me.. any other technique ?? 回答1: You can serialize cv::Mat to QByteArray (see kde/libkface): QByteArray mat2ByteArray(const cv::Mat &image) { QByteArray byteArray; QDataStream stream( &byteArray, QIODevice::WriteOnly ); stream << image.type(); stream << image.rows; stream <<

SQLite常用函数及语句

北城以北 提交于 2020-01-23 02:30:16
SQLite3.0使用的是C的函数接口,常用函数如下: sqlite3_open()           //打开数据库       sqlite3_close()           //关闭数据库 sqlite3_exec()           //执行sql语句,例如创建表 sqlite3_prepare_v2()        //编译SQL语句 sqlite3_step()           //执行查询SQL语句 sqlite3_finalize()          //结束sql语句 sqlite3_bind_text()        //绑定参数 sqlite3_column_text()       //查询字段上的数据 创建数据库表 sqlite3 *sqlite = nil; NSString *filePath = [NSHomeDirectory() stringByAppendingFormat:@"/Documents/%@",@"data.sqlite"]; int result = sqlite3_open([filePath UTF8String],&sqlite); if (result != SQLITE_OK) {   NSLog(@"打开数据失败"); } //创建表的SQL语句 NSString *sql = @"CREATE

How to dispaly result list into TableLayout row in android?

寵の児 提交于 2020-01-23 02:12:08
问题 I have a little bit problem that displaying list data to TextView in Android. My scenario is I have a TableLayout with Default One TableRow . Inside table row, I has been created new LinearLayout . Then, Four TextView created inside LinearLayout . I adding some default value to this textview. My default value is 1, 2014-02-05, S02, 20 Here my code snippet for above scenari0. <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/sync

Android sqlite database setlocale is too slow while opening db. How to solve?

核能气质少年 提交于 2020-01-23 02:05:52
问题 I use the following method for reading/writing db: Database is located at /data/data/{packagename}/databases/Database.db Since the database is greater than 3Mb we found a specific solution to have it copied there and to have it populated with appropriate data. Following is the class implementing the task to get the opened database. This class is a singleton. public class DatabaseHelper extends SQLiteOpenHelper to open the database we use the following method: SQLiteDatabase db =

Python 2.7.3 _sqlite3 module is not being built after passing headers/libraries [closed]

北慕城南 提交于 2020-01-23 01:38:26
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . We have a Django project we need to start and cannot build sqlite for the persistent store. sqlite3-dev headers/libs are not installed in the system by default I have no root permissions on this box (we are expected to install all we need) I compiled/installed Python-2.7.3 in /opt/python/current2 I downloaded

SQLite FTS4 search with special characters

纵然是瞬间 提交于 2020-01-23 00:05:25
问题 I have an Android app which searches for data in an SQLite database with FTS4 virtual tables. It works fine, but when the data inside the tables contain special characters (like 'á', 'é', 'í', 'ó', 'ú' or 'ñ') the SQLite MATCH function gives no results. I'm lost at this point. Thanks. 回答1: Attention: default tokenizer is really poor. To get good results you should implement a custom tokenizer. The path isn't so simple: find the tokenizer (with stemmer?) that should fit your need, or develop

How to query nested Embeded objects using Room Persistance Library in android?

时光怂恿深爱的人放手 提交于 2020-01-22 18:21:43
问题 Consider I have 3 classes User, Address, Location class Address { public String street; public String state; public String city; @ColumnInfo(name = "post_code") public int postCode; @Embedded(prefix = "home_") public Location homeLocation; @Embedded(prefix = "office_") public Location officeLocation; } class Location{ public long lat; public long lng; } @Entity class User { @PrimaryKey public int id; public String firstName; @Embedded(prefix = "addr_") public Address address; } How should i