[sqlite] how to check the file is a sqlite database file?

2005-09-05 Thread YOGESH
Hello All,

Is there any way to know whether a certain file is sqlite database file or not?

I am using sqlite 2.8.16.

My requirement is , I give user an option to select a file as a sqlite database 
file, so if user makes a mistake in selecting a proper sqlite database file,I 
want to prevent the further processing and prompt the user to select correct 
file.

(I don't want to give any extension to the database file.)

Is there any sqlite api /code snippet which tells me whether the file is of 
sqlite database type or not?

Thanking you in advance..

Regards,
Yogesh Joshi

[sqlite] checking the database status

2005-08-26 Thread YOGESH
hello,
i am working on sqlite 2.8.16 and my requirement is when i use the sqlite_open 
function i want to display error message if the database is not present.I don't 
want a new database with the wrong name to be created each time i use the 
sqlite_open function.
I checked for the error parameter in the sqlite_open function but each time it 
returns null.

so what is the solution for the above requirement.?

Thanks in advance

Regards
Yogesh

[sqlite] unable to install sqlite2.8.16 on mac os x 10.3

2005-08-24 Thread YOGESH
Hello all,
I tried to install sqlite 2.8.16 on mac os x 10.3 .
when i tried to install from .dmg file,a separate drive was crated and three 
files namely sqlite,sqlite.a and sqlite.h were created when i tried to execute 
the sqlite file  i got the error saying that linncurses5.4.dylib is not there 
in the lib folder.
so i tried to build sqlite from source code.but again there i got the erro gcc 
not installed.

how to proceed further.

[sqlite] sqlite multithreading

2005-02-07 Thread Yogesh Marwaha
Hi!

Problem: 1
-
I need some help using sqlite3 with multithreading.
Here is an overview of present situation: -

I am using sqlite 3.0.8

I have two threads (A  B) working at the same time.
Thread A is used to query database while thread B is
being used for writing to the database. Everything
works right if only thread B is running. But when
thread A runs while thread B is still running an error
occurs. The error is: #8220;library routine called
out of sequence#8221;. But this error is not emitted
always, 1 out of 3 times this operation completes
successfully. No action is can be preformed on the
database when the error occurs. It even not closes the
database.

Both threads are using same sqlite connection.

I am using sources from sqlite-source-3_0_8.zip
compiled (with #8211;DTHREADSAFE=1) as a sub-project
inside my own project using kdevelop.


(In the mean time I have come across the following in
sqlite mailing list archive: -
it could be the case that the same database connection
is being used simultaneously by two or more threads.

But I have seen some applications do this successfully
with a single connection.
)


Problem: 2
-
I need some tips on how can I use sqlite inside my
project using kdevelop (i.e. without using
sqlite-source-3_0_8.zip).


Thanks in advance


Yogesh M



Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony


[sqlite] Problem creating TRIGGER

2005-01-14 Thread Yogesh Marwaha
Hi!


I am very new to sqlite. I am having problem creating a trigger. Here is the 
statement: -

sqlite CREATE TRIGGER dat.on_master_insert INSERT ON dat.master_table FOR EACH 
ROW BEGIN INSERT INTO dat.url_stats(new.file_name, '0', '0', '1'); END;
SQL error: near .: syntax error

The problem is near new.file_name, as when I access the database through a C++ 
program while using master_table instead of dat.master_table, same error is 
emitted.

What the statement intends to do is to insrt a record in url_stats table 
whenever a new row is added to master_table.


I am using sqlite 3.0.8.


Thanks in advance

Yogesh M
Chandigarh, India
http://mylinuxapps.tripod.com

[sqlite] Problem creating TRIGGER

2005-01-14 Thread Yogesh Marwaha
Hi!


I am very new to sqlite. I am having problem creating a trigger. Here is the 
statement: -

sqlite CREATE TRIGGER dat.on_master_insert INSERT ON dat.master_table FOR EACH 
ROW BEGIN INSERT INTO dat.url_stats(new.file_name, '0', '0', '1'); END;
SQL error: near .: syntax error

The problem is near new.file_name, as when I access the database through a C++ 
program while using master_table instead of dat.master_table, same error is 
emitted.

What the statement intends to do is to insert a record in url_stats table 
whenever a new row is added to master_table.


I am using sqlite 3.0.8.


Thanks in advance

Yogesh M
Chandigarh, India
http://mylinuxapps.tripod.com

[sqlite] A problem with the select statement

2004-09-25 Thread Yogesh Marwaha
Hi!

I am using sqlite 3.05 beta. I have created a table containing a field named 'title'. 
When I run the SQL Command : -

select count(*) from master_table where title = title 

output is 885, i.e. count of all the rows in the table, whereas it should have 
returned the number of rows in which value of the field title is title (which is 
actually 10). Perhaps sqlite is comparing value of column named title with the column 
itself.

Can somebody please help, 

Yogesh M
Chandigarh, India
http://mylinuxapps.tripod.com

[sqlite] Let us make SQLite more powerful

2003-12-12 Thread Yogesh Vachhani
Hello everyone,

This is espcially for Dr. Hipp.

First I will try to highlite the reasons as to why I am raising this
topic just to establish proper grounds for what I am going to Say and
Suggest.

I am a software developer using VB as my main development tool and an
trying to learn Delphi but the process is very slow for me as
learning Delphi does'nt come in my priority. I don't know C or C++
(in fact I left C/C++ behind when I saw VB version 2.0) and am not
well versed with SQL scripting either.

I also work as a freelance consultant for a few firms here in my
region (Rajkot, Gujarat, INDIA). My areas of consultancy are
computerising business operatins, helping my clients to convert their
manual process to computer, help clients in purchasing the best
computer harware/software appropriate to their business requirement,
managing software development of clients and helping them develop
their own software inhouse by their own inhouse comuter talents,
suggest them which back end database to use for their requirements,
etc.. etc...

I have been following SQLite's progress for quite some time now. I
have got a few IDEAS regarding enhancements to SQLite to make it even
more powerfull and faster than what it is today.

Before I go any further. Let me confess that I have never used SQLite
in any commercial projects because I feel it requires more work to
use SQLite in VB. And for people like me working in VB the question
of SIZE is immaterial, what we people prefer the mose it ease of use.


The features that I am suggesting here will not affect the current
functionality of SQLite in any but it will just enhance it in multi
folds. So here are my IDEAS:

---


Storing Collections Of Values In A Single Column
-
Traditional relational databases restrict one to storing one value in
each column. Let us add such a facility to SQLite to store
collections of values in a single column. With collections, one would
no longer need to create multiple columns (or separate tables) for
multiple street addresses, phone numbers, status codes, and so on.
Instead, one just define a column as a collection, and can store as
many or as few values in that column as one wants. There should be no
limit on the number of values a collection column can hold.

I think Collection columns are well suited for situations where one
has an unknown number of data items of the same type. Consider the
case of the Phone column. Instead of allowing only one telephone
number or perhaps a small, fixed number (Phone1, Phone2, and so on),
one can define the Phone column as a collection. If some rows have a
dozen phone numbers while most others have only one or two, a
collection works well (I feel so). When multiple values are added to
the collection, SQLite would (probably) delimits multiple values with
a separator character.

I think that in many cases, one can use collections to replace
foreign tables and, thereby, eliminate joins that would have to be
executed to retrive data. This can dramatically improve query
performance. 

To query collections, SQLite can inmplement an ANY clause in the
SELECT statement as an extension to ANSI SQL to conveniently access
the collection values either individually or as a group.


Storing User-Defined Structures In A Single Column
--
SQLite can provide facility to allow the user to create and define
structures, or groups of columns separately (kind of separate logical
table), and store those structures in a single column in the main
table. This grouping can make it easier to define tables that happen
to contain the same kind of information. Structures should be allowed
to include other structures, but should not be allowed to be defined
recursively. As per previous suggestion just like normal columns,
structures can be collections. In effect, this lets one nest an
entire table in a single column. Moreover, because one can nest
collections and structures to any depth, one can store even highly
complex objects in a single column.

At the SQL from just add an extensions that lets one access the
entire structure as a single entity, or directly access specific
components within the structure.

For example, one might define an Address structure that contains
Street, City, State, and ZipCode columns. Let us assume that this
Address structure appears both in the Customers table and in the
Employees table. Say when one's company goes multi-national and one
need to redefine the Address structure to allow for international
address formats generally one whould have to make changes in all such
Tables which contain such informations so loking at the example one
would have to make changes in teh Customer Table as well as in
emplouees Table. Imagine how easy it can get as one will only have to
make change in the schema in one place: the definition