sqlite

Proper checking of nil sqlite text column

偶尔善良 提交于 2020-01-24 17:55:19
问题 I have an sqlite string column that is assigned to a string. I need to make sure it isn't nil before assigning. I'm doing this: char *isNil = sqlite3_column_text(selectstmt, 2); if(isNil != nil){ myName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 2)];} which gives the warning: warning: initialization discards qualifiers from pointer target type What is the proper way to do it? 回答1: You're getting the warning as you're ignoring the const. The API is defined: const

Android Database Error - getWriteableDatabase

我的未来我决定 提交于 2020-01-24 15:39:06
问题 So I have an application on the market place. It's been running fine for several months. I've updated it twice with small bug fixes and made no change to the database what so ever. Some of my users are getting the following error: android.util.Log$TerribleFailure: Can t downgrade read-only database from version 2 to 1: /data/data/myapp/databases/MyAppDB at android.util.Log.wtf(Log.java:275) at android.util.Log.wtf(Log.java:254) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase

Sum over values by month in milliseconds

亡梦爱人 提交于 2020-01-24 14:32:33
问题 I have table with Values and Date. Values in Integer and date is Integer in milliseconds from 1970's... I need to get sum(value) for each month and i haven't any idea how to do it with date in milliseconds. Is it possible? Thanks. My table "entry" amount | date ---------------------------- 300 | 1390075200000 150 | 1390132500000 20 | 1391075200000 ... | ............. What i want to get: 01.2014 | 450 02.2014 | 20 .... 回答1: You have to convert the dates into a format supported by SQLite so

SQL get number of columns in a particular row having a particular value

♀尐吖头ヾ 提交于 2020-01-24 14:27:41
问题 I know that I can get the number of rows having a particular value in a particular column by making use of the COUNT(*) function, but I want to find the number of COLUMNS in a particular row that have a particular value. Any suggestions on how to do this? I would have posted an example of what I've tried up till now, but I'm completely lost on this one... Edit 1 - Here's some sample data and the expected result: Table - trackbill | u1 | u1paid | u2 | u2paid | u3 | u3paid | u4 | u4paid | u5 |

Sqlite: Execute Spatialite Functions in Intellij

白昼怎懂夜的黑 提交于 2020-01-24 14:18:05
问题 Does anyone know whether it is possible to execute spatialite functions on sqlite-databases in intellij? Reference of spatialite functions: http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html In particular, I would be interested in using functions on type Point. Thanks! Edit: Functions do work within the official spatialite-gui, however I don't think there is a way to use the spatialite-gui programmatically, is there? Here is what I tried so far: In intellij I connected the Java JDBC

Deployed SQLite database is empty after deployment of Universal App

穿精又带淫゛_ 提交于 2020-01-24 14:16:20
问题 I use in SQLite database in UWP. It has a few tables and is located in Assets folder and has build action marked as "Content". Under development machine it works fine. But after deployment to MS Windows 10 tablet it has the error SQLite error 1 no such table Companies It corresponds to the code using (MobileContext db = new MobileContext()) { companiesList.ItemsSource = db.Companies.ToList(); ... } var createdResult = Database.EnsureCreated(); // It gives false so I assume based on https:/

Delphi - How to save bitmap to BLOB field in SQLite database

亡梦爱人 提交于 2020-01-24 13:24:10
问题 I am trying to add an array of TBitmap images to different records of a ClientDataSet (in a ftBlob field) and then save those records to a SQLite database. The BLOB field (DocImage) is a required field in the database. However, my code does not seem to save the bitmaps to the blob field in the ClientDataSet at all... So when I call BdmMain.cdsTrxDoc.ApplyUpdates(0) , I get the error: "Field 'DocImage' must have a value." I have checked the size of my BlobStream (BlobStream.Size) before and

Sqlite db in assets folder

北城以北 提交于 2020-01-24 13:03:09
问题 There is problem in understanding the concept. I am creating a SQLite sample app in android. currently i am using the path /data/data/packname/databases to store the database. and there is nothing in my assets folder, i want to know how can i copy the database from my internal path in to assets folder. Reason :- I want to see database files onupgrade() . I found lots of question related that but not satisfied with the answers . Any Suggestions 回答1: You can't copy anything into your assets

Where to save the local DB created for iphone app?

谁说我不能喝 提交于 2020-01-24 12:55:05
问题 I have developed a app that loads fully static content . I am storing data more than 4 mb of size. With out this content the app will not work. In my case where should i save the local database(documents folder or library folder). My app got rejected since it was backed up for iCloud storage. 1) Where should i save the database? In Library folder or inside Documents folder? 2) Since apple rejected my app i believe that I should not backup the database for iCloud. Please correct me if i was

query with LIKE but case sensitive

旧巷老猫 提交于 2020-01-24 10:03:47
问题 Why isn't my query case sensitive? Select * from MyTable where name like '%Ann%' shows record 1 correctly: Record1= John, Ann, Jack but shows also record 2: Record2: Jack, Susanne, Jim 回答1: You could execute PRAGMA case_sensitive_like = on, but this would affect all LIKEs used in your program, and disable any index optimizations for prefix searches. A better idea would be to replace LIKE with GLOB: SELECT * FROM MyTable WHERE Name GLOB '*Ann*' 回答2: [Copied from rbedger's answer:] You can use