sqlite

Codeigniter : unable to connect to database, server error

不问归期 提交于 2020-01-16 01:20:11
问题 I have a codeigniter web application which is working in lamp but not working in wamp. When I try to access the site it gives the following error Unable to connect to your database server using the provided settings. Filename: E:\wamp\www\CI\system\database\DB_driver.php Line Number: 114 I have used mysql and sqlite in my application. Database.php $active_group = 'default'; $active_record = TRUE; $db['login']['hostname'] = 'localhost'; $db['login']['username'] = 'root'; $db['login']['password

SQLite and Android Insert/Updates on SQLiteDatabase -CompiledStatements-

我只是一个虾纸丫 提交于 2020-01-16 00:55:51
问题 Pretend I have a table with 2 columns. _id and name. _id is the primary key and I do not want to set this value manually. I want to perform an insert of name="john," and let the program create my own _id. I am unclear what "index" to use when inserting and how many question marks to use. Does this code do the job? Should the index for john be 1 or 2? String TABLENAME = "table"; SQLiteStatement statement = db.compileStatement("INSERT INTO "+TABLENAME+" VALUES(?);"); statement.bindString(1,

How do you create foreign keys in attached sqlite databases?

我的梦境 提交于 2020-01-16 00:55:21
问题 I am trying to create a sqlite3 database as a test environment that mimics the production environment. Due to the way production is setup the tables are in multiple schemas. I have setup the classes in DBIx::Class, using $schema->storage->dbh_do to attach the database with the schema, and using $schema-deploy() to create the database. However when it comes to creating the foreign key on the second table I get the following error: DBIx::Class::Schema::deploy(): DBIx::Class::Schema::deploy():

how do i use database for my program in android

元气小坏坏 提交于 2020-01-16 00:52:37
问题 i am new to android. i tried a few codes n also read about SQLite a bit. i couldn't understand much. am still having difficulty in using my database created using SQLite Browser in my program. My project is that my app should display the content in my database one after the other. Database consisting of 2 columns. id and description. package com.example.singlepop; import java.util.Calendar; import android.os.Bundle; import android.app.Activity; import android.view.Gravity; import android.view

Cant generate folders contains Offline Database after Android APK installation

社会主义新天地 提交于 2020-01-16 00:50:35
问题 I use SQLite as my offline database. After the APK installation, I couldn't find the folders that I made. I want to put the database in device Storage : /storage/emulated/0 (Samsung device where I tested my program). I already put this in my manifest : <manifest android:installLocation="preferExternal" /> To install APK, i copied it directly from bin to my phone external storage. Did I miss something? **notes: I need for users to be able to access files (.TXT and .XML) from device storage, so

SQLiteException when creating database - SQLiteException near “android”

耗尽温柔 提交于 2020-01-15 12:24:51
问题 I have a service (listed below) which is trying to create database tables. The am getting an exception I don't understand when the sql within onCreate() in PlayerTable is executed. All the code is listed below. Basically, the service starts up, gets an SQLiteDatabase object, which in turn is calling onCreate() on ClueBuddyOpenHelper which then calls onCreate() in PlayerTable. The exception occurs when the sql executes. Any help would be appreciated. 06-03 00:47:43.043: E/AndroidRuntime(4347):

acos function in Sqlite

青春壹個敷衍的年華 提交于 2020-01-15 12:15:42
问题 I have a question about SQLite queries. I need to execute a sqlite query like this: SELECT id, ( 6371 * acos ( cos ( radians(78.3232) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(65.3234) ) + sin ( radians(78.3232) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 30 ORDER BY distance LIMIT 0 , 20; But I obtain an error because Sqlite not support functions like acos . Is there a way to execute my query in Sqlite? I need to use this on iOS. Any practical

Functional test: sqlite does not include soundex()

亡梦爱人 提交于 2020-01-15 11:58:08
问题 Attempts to build a functional test where soundex() is required fail due to the fact that the function by default is not compiled in pdo_sqlite. Functional tests are being built using LiipFunctionalTestBundle. The error reported is: PDOException: SQLSTATE[HY000]: General error: 1 no such function: Soundex and the SQLite documentation says: The soundex(X) function ... is omitted from SQLite by default I've tried (from php docs) $db->sqliteCreateFunction('soundex', 'sqlite_soundex', 1); where

Copy Column Value from One table into Another Matching IDs - SQLite

荒凉一梦 提交于 2020-01-15 11:46:07
问题 I want to do exactly what it was described in this question: (Copy Column Value from One table into Another Matching IDs), but in SQLite instead of MySQL. The solution provided: update t1, t2 set t1.value = t2.p_value where t1.id=t2.parent_id returns an error near ","... If I say update t1 set t1.value = t2.p_value where t1.id=t2.parent_id returns an error near "." I was not expecting the syntax of MySQL being so different from SQLite. 回答1: You could try UPDATE t1 SET t1.value = ( SELECT t2.p

Sqlite advanced search

巧了我就是萌 提交于 2020-01-15 11:25:48
问题 I'm developing an android application for a store, which provides many functions. One of these is a function that allows the customer to search a product with some criteria (price,size,type... like in the picture ). I guess I should work with SqliteDatabase , but I have no idea how I can make this multi-criteria search interface , so the user can query the database. 回答1: It's simple. after setup your database, you can use SQL queries and JOIN types with WHERE critaria and finally achive