[sqlite] query Benchmark

2016-02-15 Thread Swithun Crowe
Hello MP> Anyway it's tricky because I have to tell sqlite which index to use in MP> LIKE to fast search but I do not have to tell the index if start with MP> % or _ because otherwise the query is not executed.. I'll handle it... I'm not sure if other people have suggested it already, but you can

[sqlite] The Simplest SQLite Common Table Expression Tutorial

2015-09-28 Thread Swithun Crowe
Hello DB> Hey all, just wanted to share this in case anybody is also looking for DB> a very simple tutorial for CTE's in sqlite: DB> http://blog.expensify.com/2015/09/25/the-simplest-sqlite-common-table-expression-tutorial/ Yes, that was a great introduction to recursive SQL. Last week I wrote

[sqlite] Unexpected ordering when index exists

2015-09-10 Thread Swithun Crowe
Hello OK> The result consists of 4 rows, in the following order: OK> "1""AB" OK> "4""AB" OK> "2""CD" OK> "5""CD" OK> Especially you can see that the result is sorted by column 'y'. OK> This is reproducible and I can't understand that. OK> When you remove the index ix_t1_y, the res

Re: [sqlite] PHP: squelch warning and error messages

2015-01-06 Thread Swithun Crowe
Hello L> I know what this error/warning is. I *DO* error handling in my code. I L> just don't want the message printed on the webpage. You can configure PHP to log error messages, rather than display them. Swithun. ___ sqlite-users mailing list sqlite-

Re: [sqlite] Performance gain in SQLite

2014-10-06 Thread Swithun Crowe
Hello PP> Will I get any performance benefits if I directly generate the Vdbe PP> program instead of generating the sql string ? I think any (tiny) performance gains will be offset by the extra work required to create the VDBE program and to keep your code up to date with SQLite. SQL (the languag

Re: [sqlite] Importing CSV File Into Table

2012-11-13 Thread Swithun Crowe
Hello TJM> I am trying to import some data from a csv file to an existing table TJM> called MasterChargeList. But this is failing with the error that the TJM> table does not exist. This is on SQLite 3.6.4 (required to use this TJM> version). See below for details: TJM> sqlite> .import /csv/

Re: [sqlite] Where is my posting?

2011-10-19 Thread Swithun Crowe
Hello AO> How can I know if my email actually is being considered by other AO> members of the list or if it was never posted? Somehow this one made it through. Swithun. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-b

Re: [sqlite] max id mystery

2011-10-13 Thread Swithun Crowe
Hello EN> I have an sqlite3 db that stores user-accounts (each user has an id); You say you have a sqlite3 database, but it looks like you are using PHP's sqlite 2 interface. Unless you have special requirements or limilations, I would consider using the PDO interface for sqlite3. Why not let

Re: [sqlite] Conversion of SQLite Database to MySql format

2011-10-05 Thread Swithun Crowe
Hello SS> > I have a very large (600 mb) SQLite database file SS> > I'm trying to convert it to MySql (.sql) file format on a windows platform. SS> > Does anyone know of a free conversion utility? SS> Use any MySQL utility to dump the database as SQL commands into a text SS> file. On a Mac I u

Re: [sqlite] Confused about Multiple Indexes

2010-11-26 Thread Swithun Crowe
Hello MS> The second index should be: MS> CREATE INDEX IDX2 on tx(type, name ASC); MS> What I had meant to ask was whether there is any benefit in having two MS> indexes when one of the indexes is exactly within the other. MS> IDX1 is index on 'name ASC' while IDX2 is an index on 'type, name AS

Re: [sqlite] Confused about Multiple Indexes

2010-11-26 Thread Swithun Crowe
Hello MS> CREATE TABLE tx (name TEXT, type INTEGER, seq INTEGER, seq_record TEXT, MS> ...); MS> CREATE INDEX IDX1 on tx(name ASC); MS> CREATE INDEX IDX2 on tx(type, search_name ASC); The two indexes cover different columns, so they do different things. The indexes you need depend on the querie

Re: [sqlite] union all with limit

2010-11-24 Thread Swithun Crowe
Hello BS> Thanks, I tried that and it gives no error, but only gives the first BS> lot, not the bit after the union all. Ah. I hadn't tried with data. I don't know why the LIMIT affects the UNION ALL, when it is buried in a subquery. It doesn't affect a UNION (no ALL). In your real data and qu

Re: [sqlite] union all with limit

2010-11-24 Thread Swithun Crowe
Hello BS> select BS> patient_id BS> from BS> table1 BS> where BS> age = 50 BS> limit 6 BS> union all BS> select BS> patient_id BS> from BS> table1 BS> where BS> age = 60 BS> limit 4 You might want to wrap the two selects with limits inside subqueries: select patientID from ( select patientID

Re: [sqlite] using sqlitejdbc-v056 with ant build file

2010-07-26 Thread Swithun Crowe
Hello > When I run a script, using sqlitejdbc-v056, with DROP, CREATE, and > INSERT statements I get this error message "java.sql.SQLException: no > ResultSet available". The statement actually is successful as the data > does appear in the database. It will be something to do with these stat

Re: [sqlite] order of select result

2010-07-13 Thread Swithun Crowe
Hello L> Thanks Swithun. I dont have any supportive column in table to issue L> "order by". Can it be achieved by issuing an "ordr by" query on L> "row_id" (used by sqlite internaly)? You could, I think. But it might be better style to create an INTEGER PRIMARY KEY AUTOINCREMENT column to do t

Re: [sqlite] order of select result

2010-07-12 Thread Swithun Crowe
Hello L> Lets assume that we have a very simple without any indexing or L>constraints. Now we have inserted some data to the table. When we do a L>simple "select" query, is it guranteed that the rows will be retrieved L>in the same order as they are inserted? No. It may look like they are bein

Re: [sqlite] sqlite documents in pdf format

2010-06-25 Thread Swithun Crowe
Hello AR> You can also bookmark html pages. AR> > I'm using pdf because I can comment and bookmark it to facilitate my AR> > reading process. I'm open to any other options. But it seems that AR> > there is no way to comment on chm (Let me know if I'm wrong). Then AR> > probably the solution is to

Re: [sqlite] Accessing SQLite from PHP5?

2010-05-18 Thread Swithun Crowe
Hello GG> Could it be that the Www directory is off-limit to PHP scripts in GG> write mode? FWIW, PDO can succesfully find and open db.sqlite: The directory itself should be writeable by the lighttpd user, as sqlite will want to create temporary journal files in the same directory. So being ab

Re: [sqlite] Accessing SQLite from PHP5?

2010-05-18 Thread Swithun Crowe
Hello GG> I'd like to use SQLite from some PHP5 scripts, either on Linux or GG> Linux. A wise choice either way! GG> What is the right way to set things up so that I can use a recent GG> release of SQLite (apparently, the SQLite that comes with PHP by GG> default is a 2.x release)? If you use

Re: [sqlite] recursive select in sqlite

2010-05-17 Thread Swithun Crowe
Hello z> i wonder is there RECURSIVE select function in sqlite? the background z> for the question are: create table objects (id INTEGER PRIMARY KEY z> AUTOINCREMENT, name text unique) create table tree(id int, child_id z> int, PRIMARY KEY(id, child_id)) i want to draw the whole tree, is there

Re: [sqlite] Encryption of sqlite DB

2010-05-04 Thread Swithun Crowe
Hello KR> What’s the simplest way to encrypt only certain rows in an sqlite DB? KR> If there is no way to do this (for storing passwords etc), I would KR> like to know the best way to encrypt the whole sqlite DB. (Prefer only KR> encrypting some rows, but if this introduces complexity, I’m will

Re: [sqlite] Passing a $dbHandle to a new page

2009-12-15 Thread Swithun Crowe
Hello F Aha! now I am starting to understand the utility of that data.sqlite file! F Thanks again, Simon, and I will look for a PHP forum. Do you know a good F one? I've find that the PHP manual: http://www.php.net/manual/en/ answers almost all my questions. Swithun. __

Re: [sqlite] sqlite, php, and Mac OS X 10.6.1

2009-12-11 Thread Swithun Crowe
Hello PR try { PR $dbHandle = new PDO('/Users/mymachine/sqlite:'."$user_db"); PR } How about: $dbHandle = new PDO('sqlite:/Users/mymachine/'."$user_db"); The sqlite: should be at the beginning of the DSN (Data Source Name), so that PDO can recognise the name of the driver to use. Swithun. _

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Swithun Crowe
Hello PI > change your query a bit when you use bitwise operations, in your case when you PI > have 'AND col_c&32' you may add 'AND col_c>=32'. now index will be used PI col_c = 64 does pass second condition and doesn't pass first one. ;-) PI Bitwise operators cannot be changed so easily to in

Re: [sqlite] SQL language question

2009-09-22 Thread Swithun Crowe
Hello DRH The question is this: Should the no-op UPDATE statement (x=x) cause DRH the ON UPDATE SET NULL foreign key constraint to set t2.y to NULL or DRH not? I think MySQL knows if a row gets actually updated. If the values in a row don't change, then it says that no rows were updated. I w

Re: [sqlite] Slow SELECT query

2009-09-04 Thread Swithun Crowe
Hello w I don't want the log to grow indefinitely, so I periodically call a method w which makes the following query: w SELECT id FROM log ORDER BY timestamp DESC LIMIT 1,999 w A DELETE query is executed on every result. How about something like: DELETE FROM log WHERE id IN (SELEC

Re: [sqlite] mod_python & sqlite: Doesnt the INSERT istance

2009-09-02 Thread Swithun Crowe
Hello L the error is L OperationalError: unable to open database file L L can anyone fix it? L note: the db file has the 777 rights and my user has the file owner You might need to have write access to the directory containing the database file, as a journal file may be created temporarily in t

Re: [sqlite] Problem invoking php functions from a trigger

2009-08-28 Thread Swithun Crowe
Hello AR if I run this php script AR AR *$dbh = new PDO('sqlite:/var/www/test.sqlite'); AR $sql="INSERT INTO Test ( Nombre , IP , MAC , Descripcion_Modulo ) VALUES ( AR '2221' , '2121' , '1212' , '1212' ) "; AR $modulo=$dbh->query($sql); AR print_r($dbh->errorInfo()); * AR AR from outside SQLite

Re: [sqlite] Subtotal SQL

2009-07-29 Thread Swithun Crowe
Hello AE I have many different ways of ordering these objects. Usually using AE several sort parameters. I need a running sum of size that works AE regardless of what order the objects are in. I tried creating a UDF, but it seems that ordering is done after the unordered results have been coll

Re: [sqlite] Generate scripts from SQLite database

2009-07-27 Thread Swithun Crowe
Hello JD Is there some tool to generate scripts from SQLite database? I need to JD create scripts (create database, create table, triggers etc.) from JD existing database. >From the command line tool, the command .schema will output the commands used to create the database and all tables and t

Re: [sqlite] Heirarchical queries question

2009-07-17 Thread Swithun Crowe
Hello D I'm trying to get my head around doing hierarchies in SQL. I've been D Googling and it appears Oracle and MS SQL have some extensions to help, but D I'm trying to figure out what can be done with 'plain' SQL. With tree structures in table, I like to use a pair of coordinates (x and y), w

Re: [sqlite] Nested Inner Join Help

2009-07-03 Thread Swithun Crowe
Hello EH Do the "a2-style" (for want of a better way of defining them) names EH exist outside the SQL statement which defines them? Tables and columns have fixed names, which you define when you write your database schema, e.g. CREATE TABLE myTable (id INT, value TEXT); But you can give these

Re: [sqlite] search in archive

2009-06-19 Thread Swithun Crowe
Hello KN On Fri, 19 Jun 2009 13:56:52 -0400, "Rizzuto, Raymond" KN wrote: KN KN > Is it possible to have a search feature for the KN > archive? KN KN Which archive? I think Raymond means the sqlite-users archive. You could download all the txt.gz files, cat them together and then grep for w

Re: [sqlite] Question about searches

2009-06-16 Thread Swithun Crowe
Hello CL I can't know this beforehand. These are just examples, i need a generic CL solution if possivble. CL All i can see so far is to build a table of all special characters ever CL used in the 24000 names of cities which make problems and remap them CL accordingly. How about having an ext

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Swithun Crowe
Hello SC My goal is that on an insert only the insertedby value is provide. The SC trigger will set that to the updatedby, insertedon and updatedon SC fields. I searched the web and the only examples I could find was of SC an AFTER INSERT, am I better off with that approach? I would think SC

Re: [sqlite] import / insert 120k records

2009-05-07 Thread Swithun Crowe
Hello BM Whats the best way to import a large number of records ? BM 120K+ currently stored as an XML file. If your XML data is data-centric, then it should fit into one or more tables quite easily. If it can fit into one table, then you could use XSLT to convert the XML to CSV and .import tha

Re: [sqlite] accessing php produced db from shell

2009-03-18 Thread Swithun Crowe
Hello p i couldn't do php -i (bash: php: command not found), may be i have to p install the cli php? Yes, the cli php is optional. p $base = new PDO("sqlite:$dbname", 0666, $err) I don't think you need the other arguments for PDO. Something like: if ($base = new PDO("sqlite:$dbname)) { if (

Re: [sqlite] accessing php produced db from shell

2009-03-18 Thread Swithun Crowe
Hello p i'm using sqlite3, but with php5 i had to install php5-sqlite. is the p sqlite i'm using with php5 on debian version 2? could this be the p problem? or is it something else? PHP uses SQLite2 in its normal extension. But the PDO extension uses SQLite3, so you can use that extension inste