sqlite

Can execSQL supports multiple sql statements

蹲街弑〆低调 提交于 2021-01-29 11:20:25
问题 Can execSQL supports multiple statements or shall i execute separate commands. My use case is in context of transactions. fun update(id: Long, roles: List<Role>): Int? { val values = (roles.map { role -> "($id, ${role.id})" }).joinToString(",") val sql = "BEGIN TRANSACTION; DELETE FROM user_role WHERE user_id = $id;" + (if (values.count() > 0) "INSERT INTO user_role(user_id, role_id) VALUES$values; " else "") + "COMMIT;" connection.writableDatabase.execSQL(sql) return connection

Combobox doesn't display the populated values

被刻印的时光 ゝ 提交于 2021-01-29 11:11:10
问题 I created a combobox to show a list of values out of a sqlite database. If I sent the values to the combobox, the list will shown. The problem is, that the field will not filled with the first value and stay empty until I select on item of out of the drop menu. Could I set a value to be displayed directly? Here my code snippet: self.e_business = ttk.Combobox(address_frame, width = 40) self.e_business.grid(row=3, column=1, columnspan=2, padx=(5,20), pady=(15,5), sticky='WE') The function which

Saving and reading Picker values from SQLite - Xamarin.Forms

谁说我不能喝 提交于 2021-01-29 11:09:20
问题 I would like you to help me solve a problem that I can not deal with. In my Xamarin.Forms application, the user can add to the SQLite database: public class Car { [PrimaryKey, AutoIncrement] public int ID { get; set; } public string Text { get; set; } public int PickerValue { get; set; } } PickerValue is of type INT because I think that the selected value of the picker gives the index INT value. Am I wrong? The user adds item using: <Editor Placeholder="Enter name" Text="{Binding Text}" />

NPM install sqlite3 error: node-gyp rebuild “No such file or directory”

做~自己de王妃 提交于 2021-01-29 10:41:08
问题 I can't seem to install sqlite3 via npm in OSX Snow Leopard and I haven't been able to determine why: bravo-de-esmolfo:project knight4$ npm install sqlite3 npm WARN package.json application-name@0.0.1 No repository field. npm WARN package.json application-name@0.0.1 No readme data. npm http GET https://registry.npmjs.org/sqlite3 npm http 304 https://registry.npmjs.org/sqlite3 npm http GET https://registry.npmjs.org/tar.gz npm http 304 https://registry.npmjs.org/tar.gz npm WARN engine tar.gz@0

Two functions don't work properly in tkinter python with sqlite3

≯℡__Kan透↙ 提交于 2021-01-29 10:24:13
问题 I've got a problem w with my program "phonebook" with sqlite3. There are 2 functions doesn't work properly with treeview in tkinter. When I try to update one selected row it updated all rows/records in sqlite but in treeview is correctly one updated record, and when I try delete one selected row it deletes all datas from sqlite whereas in treeview is deleted one selected row. I suppose there is no connection between treeview and sqlite3. I don't know what the problem is. from tkinter import*

Creating a sqlite database connection for a flask app

百般思念 提交于 2021-01-29 10:20:08
问题 I am working on a web back-end which reads from a database file, processes the data and returns a json object. I am not really informed about flask and the way the variables life in a flask app. As you can see below, i am calling the flaskApp from a wsgi file. I created the "get_db()" function according to the flask documentation, but there is no improvement by using this function. Is there a way to connect to the database only once and not every time the URL is called? #file flaskApp.py #!

Could not load Spatialite extension in qSqlite ( QT 5.9)

三世轮回 提交于 2021-01-29 10:05:49
问题 I am trying to load Spatialite as extension in qSqlite ( Qt 5.9), I have done that before with Qt4.8, but I failed with the QT5.9. I changed the sqlite.pri by removing "SQLITE_OMIT_LOAD_EXTENSION", and I did some change on the sqlite.c by removing the " #define SQLITE_OMIT_LOAD_EXTENSION 1 ", and adding " #define SQLITE_ENABLE_LOAD_EXTENSION 1 ". I also add the following lines to openDatabase(....) #if defined(SQLITE_ENABLE_LOAD_EXTENSION) | SQLITE_LoadExtension|SQLITE_LoadExtFunc #endif Now

python3.9 sqlite2.connect() always give Segmentation fault

风格不统一 提交于 2021-01-29 09:03:24
问题 My machine: Linux pcname 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64 GNU/Linux Have two python3 in the system: root@pcname: # update-alternatives --list python3 /usr/bin/python3.5 /usr/local/bin/python3.9 When I use python3.9 import sys import sqlite3 import faulthandler print('python3', sys.version_info) print('sqlite3', sqlite3.sqlite_version) print() faulthandler.enable() conn = sqlite3.connect("testdb") $ python3 test.py python3 sys.version_info(major=3, minor=9,

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. for SQlite3

流过昼夜 提交于 2021-01-29 08:49:25
问题 I keep getting the below error in rails on windows when I try to make a new rails app? It fails when it gets to installing sqlite3. current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0/ext/sqlite3 C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20190220-14164-174xy0j.rb extconf.rb checking for sqlite3.h... yes checking for pthread_create() in -lpthread... yes checking for -ldl... no checking for dlopen()... no missing function dlopen *** extconf.rb failed *** Could not create

What changed between System.Data.SQLite version 1.0.74 and the most recent 1.0.113?

让人想犯罪 __ 提交于 2021-01-29 08:33:48
问题 I am currently trying to update the SQLite version in our software from version 1.0.74 to the most recent 1.0.113 (As on 7th December). I tried some of our most used scenarios in a console application with both the versions. public class SQLitePerformance { public static void Main(string[] args) { try { var dataSource = @"C:\views\SpikeSqlite.db"; var conString = $"Data Source = {dataSource};Journal Mode = wal;Pooling = true;Max Pool Size = 100;foreign keys = true"; // Loading SQLite once for