sqlite

sqlite incremental vacuum removing only one free page

这一生的挚爱 提交于 2021-01-28 01:58:56
问题 I have changed value of auto_vacuum PRAGMA of my sqlite database to INCREMENTAL. When I run PRAGMA incremental_vacuum; through 'DB Browser for SQlite' application it frees all the pages in the free_list . But when I am running same statement using any SQLite library in C# (e.g. Microsoft.Data.SQLite ), it frees only one page from the free_list I verified this by getting the number in current free_list by running PRAGMA freelist_count before and after running PRAGMA incremental_vacuum

Documents folder is empty in simulator. Where is my db.sqlite?

梦想的初衷 提交于 2021-01-28 00:58:00
问题 I read that I should find my sqlite db in this path: ~/Library/Application Support/iPhone Simulator/YOUR-IOS-VERSION/Applications/UNIQUE-KEY-FOR-YOUR-APP/Documents But the folder is empty. When I run my app in the simulator I am able to query the db. The db is originally located in the resources folder of my app. I am working with xcode 3.2.6 and OS X 10.6.8 IS there somewhere else where I could look for it? Many thanks. Lapo -(void)insertError:(Frage *) f answer2:(NSString *) answer2 answer3

How to fix tzdb.dat not found error in java?

☆樱花仙子☆ 提交于 2021-01-28 00:40:06
问题 When I try to connect my gradle project with sqlite database, I have an error: Exception in thread "main" java.lang.Error: java.io.FileNotFoundException: null\lib\tzdb.dat (The system cannot find the path specified) at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:261) at java.security.AccessController.doPrivileged(Native Method) at sun.util.calendar.ZoneInfoFile.<clinit>(ZoneInfoFile.java:251) at sun.util.calendar.ZoneInfo.getTimeZone(ZoneInfo.java:589) at java.util.TimeZone

unable to push to Heroku after importing thousands of records

瘦欲@ 提交于 2021-01-27 22:02:18
问题 I have a problem where I believe my sqlite3 database is too big. I imported around 100,000 records into a database and I was able to "git push" and "git push heroku." Now I probably made a mistake and imported too many records...500,000. I was able to push to git(and now it states around 336MB in bitbucket) and that seems to work but when i push to heroku this is what i get: /workspace/new_foodback$ git push heroku Counting objects: 26, done. Delta compression using up to 8 threads.

SQLite: Retrieve child element from object in list

ぐ巨炮叔叔 提交于 2021-01-27 21:03:03
问题 There is a Basket , which stores a List<Fruit> . Each Fruit has one Pip . If I store this relationship and retrieve it later, the ForeignKey PipId has a value, but the object Pip is null , despite I use CascadeRead . If I try to use CascadeOperation.All on FruitList I get Constraint at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery (System.Object[] source) [0x00116] in /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:2507 at SQLite.SQLiteConnection.Insert (System.Object obj, System

Insert data into sqlite3 database with API

瘦欲@ 提交于 2021-01-27 19:27:24
问题 I'm trying to insert data from a web API into my database (I am using sqlite3 on python 3.7.2) and I can't find any tutorials on how do to so. So far all my code is: import requests, sqlite3 database = sqlite3.connect("ProjectDatabase.db") cur = database.cursor() d = requests.get("http://ergast.com/api/f1/2019/drivers") I'm aiming to get the names and driver numbers of each driver and insert them all into a table called Drivers. (I'm also using more APIs with more tables, but if I figure out

SQL error: ROW_NUMBER() OVER (PARTITION

心已入冬 提交于 2021-01-27 19:21:45
问题 What is wrong with my SQL code? I tried to eliminate duplicate rows following this answer But I keep getting the following error: near "(": syntax error: SELECT rn = ROW_NUMBER() OVER ( Here is the SQL code: SELECT rn = ROW_NUMBER() OVER (PARTITION BY s.stop_id, s.stop_name ORDER BY s.stop_id, s.stop_name) FROM stops s I read somewhere that it has to do with SQL versions or the usage of sqlite3 ?? Here some additional information to the problem: I have the beginning table: table_beginning =

Creating database file one directory above current

丶灬走出姿态 提交于 2021-01-27 13:01:06
问题 In PHP, To refer to a higher directory I would use '../../test'; How would I do it in Python? In this case, I'm using SQLite to create a database file. import sqlite3 conn = sqlite3.connect('../data/test.db') However; it says 'unable to open database file' which I'm considering as a directory access error. How do I refer to higher directory in Python? 回答1: You might try this: conn = sqlite3.connect(os.path.realpath('../data/test.db')) 回答2: You need to find absolute path to your database file,

Python SQLite SELECT LIKE IN [list]

眉间皱痕 提交于 2021-01-27 12:37:06
问题 How to write SQL query in Python to select elements LIKE IN Python list? For example, I have Python list of strings Names=['name_1','name_2',..., 'name_n'] and SQLite_table. My task is to find shortest way to SELECT elements FROM SQLite_table WHERE element_name LIKE '%name_1%' SELECT elements FROM SQLite_table WHERE element_name LIKE '%name_2%' ... SELECT elements FROM SQLite_table WHERE element_name LIKE '%name_n%' 回答1: You would need a regular expression of the form name_1|name_2|name_3|… ,

Preventing SQL injection without prepared statements/SQLite/C++

倖福魔咒の 提交于 2021-01-27 07:40:28
问题 I'd appreciate some feedback on how secure this scheme is against SQL injection attacks. At the front end, the user enters personal information: name, address, phone numbers, email, and some freeform text. The back-end is coded from scratch in C++, with no framework support, and integrates SQLite. The C++ code does not use SQLite prepared statements (for historical reasons, and it's too late to do anything about it). Instead, all SQL statements are constructed as printf-style format strings,