sqlite

How to drop all empty tables in SQLite?

▼魔方 西西 提交于 2020-01-14 09:35:09
问题 I want to drop all tables that does not have rows. How to drop all empty tables in SQLite? EDIT I need to do this on a mobile phone (no shell there). On a Windows Mobile phone. 回答1: Tables can be dropped, whether or not they have data in them when the command is executed. Dunno of any database that operates otherwise. So that means: 1) Getting a list of tables - SELECT name FROM sqlite_master WHERE type = 'table' 2) Iterate over that list, using COUNT(*) to determine if any rows exist within

Sqlalchemy get row in timeslot

守給你的承諾、 提交于 2020-01-14 08:15:20
问题 I have a model called Appointment which has the columns datetime which is a DateTime field and duration which is an Integer field and represents duration in minutes. Now I want to check if func.now() is between the datetime of the appointment and the sum of the datetime and duration I am currently to try to do it this way, but I need a solution that will work for both PostgreSQL and SQLite. current_appointment = Appointment.query.filter( Appointment.datetime.between( func.now(), func

sqlite3_column_text returned data gets corrupted during finalize/close

≯℡__Kan透↙ 提交于 2020-01-14 08:04:38
问题 I'm not sure what's happening here but I'm finding that the returned data from sqlite3_column_text is being altered during the finalize/close sqlite stage. // rc not handled in this abbreviated code sqlite3 *db; sqlite3_stmt *stmt; char * sql; const char * tail; int rc; char * dbName = "C:\\db\\myblobs.db"; int myIndex = 0; char * myLocation1; string myLocation2; rc = sqlite3_open(dbName, &db); sql = "SELECT location FROM blobs WHERE key = ?"; rc = sqlite3_prepare(db, sql, strlen(sql), &stmt,

Exporting the sqlite3 table into file using “C” execute API

南楼画角 提交于 2020-01-14 08:02:39
问题 I am using sqlite3 version 3.6.23.1 in fedora 14.I am able to export table into the file using command prompt like this, sqlite3 data.db sqlite> .output sample.txt; sqlite> select *from sample; I want handle this case at the application level. I am using sqlite3 open source "C" API to execute this command in application level. execute("delete from sample:);// working fine execute(".output sample.txt"); //Not working its throwing error called "SQL error in sqlite3_exec: near ".": syntax error"

sqlite database not created

梦想与她 提交于 2020-01-14 07:32:14
问题 I am using standard approach which I learned from popular notepad example for building my first app. But I got stuck into a strange problem. The SQLite database file (.db) is not being created in /data/data/package/databases. I have cross checked manifest file and OpenHelper file from HeadFirst android dev. Book ( I am using it as a reference ) but I found myself unable to figure out why the database file is not created.. Are there any special permissions or something we need to switch on to

sqlalchemy postgresql where int = string

試著忘記壹切 提交于 2020-01-14 07:12:12
问题 I have 0 experience with postgresql and am deploying an app written in python using sqlalchemy to a server with postgres. For development, I used an sqlite server. Things are going pretty smoothly, but I hit a bump I don't know how to resolve. I have three tables that look like that class Car(db.Model): id= db.Column(db.Integer, primary_key=True) ... class Truck(db.Model): id= db.Column(db.String(32), primary_key=True) ... class Vehicles(db.Model): id= db.Column(db.Integer, primary_key=True)

SQLITE3 increase Max Columns

痞子三分冷 提交于 2020-01-14 06:05:08
问题 I am thinking about using SQLlite3 so I started some performance tests. Because I've got an table with many Columns I want to increase the MAX Column Limit from SQLite3. As I read on the SQLite website the limit was set to 2000 columns and now I want to increase it. I wanted to use sqlite3_limit() but, because I use SQLAPI, I cannot use this function. I've read on some website I need to change something "inside" SQLite and then have to recompile it but I haven't really understood this part

what is best method for core data or sqlite for iphone app with using story board? [closed]

半城伤御伤魂 提交于 2020-01-14 05:58:31
问题 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 6 years ago . I want to make a small application that is based on database in back end as storage. I want to do my first CRUD operation as-well. kindly suggest your Best for small,intermediate or large application. 回答1: you should start with CORE DATA. Here is a link for one video tutorial, you can find them on your as-well.

Pre-Created SQLite database integrate into android app

戏子无情 提交于 2020-01-14 05:49:08
问题 I am trying to develop a dictionary app via Android Studio and SQLite. Watched huge amount of video tutorials, but in videos i can't find what i want. I have a database with words and their meanings, i want to integrate it in app. May be someone can advice books or their known tutorials.Thx Tried to copy code in videos and looked for books, they all was little bit unclear and not covered parts that i wanted. 回答1: 1) Design and Create the database using you favourite SQLite Management tool (e

Android OnItemClickListener long id parameter is not giving field id

≡放荡痞女 提交于 2020-01-14 05:33:06
问题 I have generated a list of customers. On click this should open edit view to edit the customer. Here the parameter should pass the _id of the row according to stored in the database. But everytime passing it's position in the list. So the edit view is opening wrong data. Please help. lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> l, View v, int position, long id) { Uri customerEditUri = Uri.parse(CustomerBean.CONTENT_URI + "/" + id); customerEdit