Re: [sqlite] confused getting started

2017-03-07 Thread Cezary H. Noweta

Hello,

On 2017-03-05 01:10, John Albertini wrote:

I can't seem to grasp what I need to download / install to use SQLite?



Can someone guide me through the process?  Looking to use it with
RootsMagic.


If you want to use a tool like dBaseIII+ to examine/modify a database 
created by a 3rd party, then you will have to download a shell binary: 
http://sqlite.org/download.html => ``Precompiled Binaries for ...''.



Been using PCs since the mid 1980s and have used dBase III+ and Approach
previously.


From http://sqlite.org/about.html: ``SQLite is an in-process library 
that implements a self-contained, serverless, zero-configuration, 
transactional SQL database engine.'' Primarily, SQLite is a library. 
Let's consider the following dBase program:


==
SET TALK OFF
CLEAR
CLEAR ALL
STORE 0 TO TOTAL_EMPLOYEES
STORE 0 TO TOTAL_SALARY
USE EMPLOYEE
DO WHILE .NOT. EOF()
  TOTAL_EMPLOYEES = TOTAL_EMPLOYEES + 1
  TOTAL_SALARY = TOTAL_SALARY + SALARY
  SKIP
ENDDO
@1,1 SAY "Average salary: $"
IF 0 < TOTAL_EMPLOYEES
  @1,18 SAY TOTAL_SALARY / TOTAL_EMPLOYEES PICTURE ".99"
ELSE
  @1,18 SAY "0.00"
ENDIF
SET TALK ON
==

If dBase had been SQLite, then you would have created the 
following--like ``salary.c'' file:


==
#include "dbase3.h"

int main()
{
  dbase3 *db;
  int result;

  result = dbase3_context_init();

  if ( DBASE3_OK == result ) {
dbase3_exec(db,
  "SET TALK OFF\n"
  "CLEAR\n" /* ... Rest of the program omitted */ );
dbase3_context_done(db);
  }

  return 0;
}
==

and compiled it: ``cl salary.c dbase3.c'', and run a resulting 
salary.exe file.


Certainly, SQLite does not implement xBase/Vulcan language, in exchange 
it uses SQL (similar to SQL subsystem of DOS' FoxPro 2.5 or 2.6 AFAIR). 
There are no separate files per table/index, There is one 
self--containing file per database (which contains all tables and indices).


If you are interested in the preceding scenario, then you will have to 
download an amalgamation (all SQLite in one file): 
http://sqlite.org/download.html => ``Source Code'' => 
``sqlite-amalgamation-*.zip''. It goes a working example:


1. Unzip it, and compile the shell: ``cl shell.c sqlite3.c''.

2. Run ``shell.exe'' and execute the following commands:
   .open company.db
   CREATE TABLE employees (salary);
   INSERT INTO employees VALUES (1000), (1120), (920), (840), (1220);
   .quit

Now, you have created ``company.db'' SQLite database file.

3. Create ``salary.c'' with the following content:
==
#include 
#include "sqlite3.h"

int moneyDisp(void *unused, int cc, char *values[], char *names[])
{
  (void)unused;
  (void)cc;
  (void)values;
  (void)names;

  if ( 0 < cc ) {
if ( NULL != names[0] && 0 != names[0][0] ) {
  printf("%s: ", names[0]);
}
printf("$%s\n", NULL == values[0] || 0 == values[0][0] ? "0" : 
values[0]);

  }

  return 0;
}

int main()
{
  int result;
  sqlite3 *db;
  char *errMsg;

  result = sqlite3_open("company.db", );

  if ( SQLITE_OK != result ) {
/* open error handling */
  } else {

result = sqlite3_exec(db,
  "SELECT AVG(salary) AS 'Average salary' FROM employees;",
  moneyDisp,
  NULL,
  );

if ( SQLITE_OK != result ) {
  /* select error handling */
}

sqlite3_free(errMsg);

result = sqlite3_close(db);

if ( SQLITE_OK != result ) {
  /* close error handling */
}
  }

  return 0;
}
==

4. Compile and run:
   cl salary.c sqlite3.c
   salary.exe

You should receive something like:

Average salary: $1020.0

-- best regards

Cezary H. Noweta
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-06 Thread J Decker
On Mon, Mar 6, 2017 at 8:40 PM, Jens Alfke  wrote:

>
> > On Mar 6, 2017, at 7:57 PM, J Decker  wrote:
> >
> > Pretty silly since it is sqlite, and a mmap'ed database is pretty much
> > sync
>
> Not really. The data still has to be paged in off the disk, which can take
> arbitrarily long (seconds, if the system is under heavy load), and complex
> queries can end up doing a lot of CPU-intensive extra work that takes time
> to run. Although yes, if you’re not super concerned about performance, it’s
> overkill.
>
> (I spent a year or two once working on Chrome, which has a rule that no
> synchronous I/O may take place on the UI thread, because it can impair
> responsiveness. That applies to database queries too.)
>

yup; caveat developor.
and if you are concerned than there's other things at play than a job doing
what it needs to do; and doing nothing otherwise.  Some systems will even
spin-lock for you :)
give me enough rope and I can play cats  cradle with it.
not all things that happen synchronously are because a user did it; and
things that aren't shouldn't have to pretend they were.

>
> —Jens
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-06 Thread Jens Alfke

> On Mar 6, 2017, at 7:57 PM, J Decker  wrote:
> 
> Pretty silly since it is sqlite, and a mmap'ed database is pretty much
> sync

Not really. The data still has to be paged in off the disk, which can take 
arbitrarily long (seconds, if the system is under heavy load), and complex 
queries can end up doing a lot of CPU-intensive extra work that takes time to 
run. Although yes, if you’re not super concerned about performance, it’s 
overkill.

(I spent a year or two once working on Chrome, which has a rule that no 
synchronous I/O may take place on the UI thread, because it can impair 
responsiveness. That applies to database queries too.)

—Jens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-06 Thread J Decker
If Python is appealing then 

Node.js + sqlite adapter makes sqlite very easy.
I have my own https://www.npmjs.com/package/sack.vfs
Needs better docs on the Sqlite output I guess

A more proper package that's all promises and async stuff...
https://www.npmjs.com/package/sqlite

Pretty silly since it is sqlite, and a mmap'ed database is pretty much
sync
and array of arbitrarily shaped objects;

But javascript in the browser maybe?  Well there's electron which is chrome
with node.js support also; which gives you all the support of command line
node.js.

For a general editor there's things like VIsual Studio Code and Atom (
atom.io) (and electron is electron.atom.io ) .  Although Notepad++ is still
pretty good :).
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-06 Thread R Smith


On 2017/03/05 1:03 PM, NTrewartha T-Online wrote:

I too am new to DB's and Sqllite.


Welcome!

There is a GUI tool - which I think is better for learners which ought 
to be mentioned.

http://sqlitebrowser.org/ The "DBBrowser for sqllite".


DBBrowser for SQlite is great, and cross-platform. If you are 
Windows-specific then there are also SQLite Expert 
(www.sqliteexpert.com) and SQLitespeed (www.sqlc.rifin.co.za) for some 
variety and more "Windowsy" interfaces, including some concept-teaching 
sqlite scripts.




Any examples of a C,C++,C# or Python usage for sqllite.?


This question is hard to answer. The simple answer is "Yes, there are 
examples."  You probably would like to know where to find them though, 
and the answer sadly is that Google is much better at that than anyone 
on this forum. All we can accurately say is that SQLite is the most 
widely used of all DB engines, so you should by implication find more 
examples posted for it than for any other DB (and they all have plenty).




I would like sqllite on my raspberry pi 3 after I have gained 
experience under Windows 10.


Sounds like fun!



Judging what the replies to questions, the very new beginners are left 
a bit out in the cold.

Perhaps the documentation ought to cover the need of pure beginners.


Sorry you feel that way, we are in no way averse to beginners and indeed 
welcome them with enthusiasm, we always love seeing new people get into 
the wonderland that is Databasing and SQLite in particular.
That said, this forum essentially answers questions about SQLite, 
whether about the C API, the SQL syntax used, the command-line tool etc. 
Ironically, most questions we answer are about actual SQL and SQL 
queries (whether specific to SQLite or SQL in general). Questions we ask 
(and answers we give) usually deal with a specific subject and item. If 
you say that you are new and want some general ideas on "How to use 
SQLite..." - then that's a really wide question and some people study 
courses lasting a long time to learn that kind of thing - It's not 
something we can just answer in a few sentences.


You could read a book (http://www.sqlite.org/books.html), or follow 
simple web instructions (such as: http://www.sqlite.org/quickstart.html) 
on how to begin with SQLite, if you then try all that and perhaps get 
stuck on a specific item or have a specific question, we'd be happy to 
answer - but we can't really type up an SQL / SQLite manual for you. 
(Though some of my answers feel sufficiently long). :)


We could also point you to some great learning resources on the web, but 
they are already everywhere. This listing specifically includes Python 
references:

http://charlesleifer.com/blog/my-list-of-python-and-sqlite-resources/

TLDR: The people here love beginners, but they offer problem-assistance 
more than actual syllabus tutoring.



Hope this helps!
Ryan

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-06 Thread Chris Locke
NT- I write a lot of vb.net programs that use sqlite databases, so will be
happy to run though a beginners guide.
It would be painless to convert from vb.net to c#

Thanks,
Chris
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-06 Thread Bob Friesenhahn

On Sun, 5 Mar 2017, Jens Alfke wrote:

No offense intended, but SQLite isn’t an especially 
beginner-friendly tool. It’s a powerful relational database with a 
ton of configurable options, and a somewhat tricky C API, not to 
mention a sophisticated query language that you also need to master 
to make effective use of it. (However, using it from Python should 
be somewhat easier, since the API is a bit higher level and you 
don’t have to worry about things like memory management.)


Previously, I developed a complex database based on SQLite, with a 
Python script (based on the excellent Python APSW extension, which 
incorporates SQLite in its build) to update it.  While the development 
work was done under Linux, the deployment environment was Microsoft 
Windows.


After installing Python and APSW for Windows, not one line of the 
script needed to be changed in order to work perfectly under Windows.


Based on my experience, Python with the APSW extension is an excellent 
way to create "write once" code as long as you are able to use Python.


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-05 Thread Barry Smith
A less LMGTFY-like response:
First off, using SQLite does require that you become familiar with SQL, and a 
bunch of database ideas: normalization for good schema design, unit of work for 
good use of transactions, how to use indexes, others I'm sure I don't know 
about. But those ideas are not specific to SQLite, and are good to think about 
anyway. And any part of SQL or db design you learn will be far easier than 
trying to deal with the same problems in a file format you've written yourself.

If you want to use SQLite in a c/c++ app, your easiest option is to simply 
download the amalgamation and include it in your project. That's two files - 
SQLite.c and SQLite.h. The basic procedure is:
Open the file: sqlite3_open(...);
prepare your statement: sqlite3_prepare_v2(...);
Bind your parameters: sqlite3_bind(...);
In a loop {
 execute the statement: sqlite3_step(...);
 Retrieve data if it's a select: sqlite3_column(...);
}
Finalize or reset the statement (depending if you want to use it again): 
sqlite3_finalise / sqlite3_reset
Close the file: sqlite3_close(...)

If you're using dotNet, you can use NuGet to install system.data.sqlite.core, 
then #using system.data.sqlite you'll find a ado.net database interface which 
you should more or less use like any other ado.net db interface (with the 
advantage that if you ever migrate to another dbms will be easier).

I can't comment on Python, I haven't used that.

I never thought SQLite difficult to start using. In fact, possibly what I 
didn't want to accept at first was exactly how easy it was and thought there 
were things I was missing*.

For all but the simplest use cases I think SQLite is far easier than direct 
file access for the fact that it keeps track of the contents of the file for 
you, you have an extensible self documenting file format (in the form of your 
db schema), and it takes care of most of your robustness concerns by making 
everything ACID.

* there were things I was missing - like getting all the config right, and 
making sure to reset or finalize statements, and making sure to always do any 
file operations on the log file(s) too. But even with these mistakes it still 
worked leagues better than anything I could have written myself, with a 
fraction of the work.

> On 5 Mar 2017, at 9:20 PM, Jens Alfke  wrote:
> 
> 
>> On Mar 5, 2017, at 3:03 AM, NTrewartha T-Online  
>> wrote:
>> 
>> Any examples of a C,C++,C# or Python usage for sqllite.?
> 
> Have you tried searching? I entered “sqlite c example” and “sqlite python 
> example” into Google and got some useful-looking links in the top few hits.
> Also, there are quite a few books about SQLite.
> 
>> I would like sqllite on my raspberry pi 3 after I have gained experience 
>> under Windows 10.
> 
> If it’s not installed already in the Raspbian OS, you should just need to run 
> “sudo apt-get sqlite”. (Possibly “sudo apt-get sqlite_dev” since IIRC the 
> development resources like header files are in separate packages under 
> Debian-based distros.)
> 
>> Judging what the replies to questions, the very new beginners are left a bit 
>> out in the cold.
> 
> No offense intended, but SQLite isn’t an especially beginner-friendly tool. 
> It’s a powerful relational database with a ton of configurable options, and a 
> somewhat tricky C API, not to mention a sophisticated query language that you 
> also need to master to make effective use of it. (However, using it from 
> Python should be somewhat easier, since the API is a bit higher level and you 
> don’t have to worry about things like memory management.)
> 
> If your data storage needs aren’t too complex, there are simpler ways to 
> implement it. For example, in the past I’ve just used a simple data 
> serialization library to read and write the entire data set to disk. It works 
> great when the data is small enough that it fits easily in memory and doesn’t 
> take too long to read or write (say, under 100MB.) This is the equivalent of 
> using a regular battery-powered drill to make some holes, instead of learning 
> how to use a router or end mill :)
> 
> (Also, in general if you’re moving from Windows to literally any other 
> platform, you’ll have to re-learn some of your development processes. Windows 
> does things differently from Unix, which is what everything else is based on.)
> 
> —Jens
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-05 Thread Jens Alfke

> On Mar 5, 2017, at 3:03 AM, NTrewartha T-Online  
> wrote:
> 
> Any examples of a C,C++,C# or Python usage for sqllite.?

Have you tried searching? I entered “sqlite c example” and “sqlite python 
example” into Google and got some useful-looking links in the top few hits.
Also, there are quite a few books about SQLite.

> I would like sqllite on my raspberry pi 3 after I have gained experience 
> under Windows 10.

If it’s not installed already in the Raspbian OS, you should just need to run 
“sudo apt-get sqlite”. (Possibly “sudo apt-get sqlite_dev” since IIRC the 
development resources like header files are in separate packages under 
Debian-based distros.)

> Judging what the replies to questions, the very new beginners are left a bit 
> out in the cold.

No offense intended, but SQLite isn’t an especially beginner-friendly tool. 
It’s a powerful relational database with a ton of configurable options, and a 
somewhat tricky C API, not to mention a sophisticated query language that you 
also need to master to make effective use of it. (However, using it from Python 
should be somewhat easier, since the API is a bit higher level and you don’t 
have to worry about things like memory management.)

If your data storage needs aren’t too complex, there are simpler ways to 
implement it. For example, in the past I’ve just used a simple data 
serialization library to read and write the entire data set to disk. It works 
great when the data is small enough that it fits easily in memory and doesn’t 
take too long to read or write (say, under 100MB.) This is the equivalent of 
using a regular battery-powered drill to make some holes, instead of learning 
how to use a router or end mill :)

(Also, in general if you’re moving from Windows to literally any other 
platform, you’ll have to re-learn some of your development processes. Windows 
does things differently from Unix, which is what everything else is based on.)

—Jens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-05 Thread dmp
> I'm not a computer novice, but also not a nerd/geek.
> Been using PCs since the mid 1980s and have used dBase III+ and Approach
> previously.
>
> I can't seem to grasp what I need to download / install to use SQLite?
>
> Can someone guide me through the process?  Looking to use it with
> RootsMagic.
>
> Thank you.
> John

Hello John,

If you just wish to quickly get access to a SQLite database file
then perhaps Ajqvue may help. I have had no problem with accessing
non-password protected files, such as places.sqlite that Firefox
uses. An encrypted database file though may not work with Aqjvue.

See the Quick Tutorial and use the default example database,
Site | LocalHost_SQLite | test/sqlite_db/factbook.db, to get
started.

http://ajqvue.com/
http://ajqvue.com/docs/Videos/Ajqvue_Quick.mp4

The command line tool as Simon indicated is much more powerful
and can then be explored to futher your goals.

danap.

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-05 Thread NTrewartha T-Online

I too am new to DB's and Sqllite.
I have downloaded the binaries for win 10 and there is a dll and def file.
I clicked on the def file hoping this would integrate the dll into VS 
2015 community, but all what
happened was that the def file get listed. and I cannot seem to find an 
import def  tool.

Have to google that but *I would be grateful for any pointers*.

There is a GUI tool - which I think is better for learners which ought 
to be mentioned.

http://sqlitebrowser.org/ The "DBBrowser for sqllite".

Any examples of a C,C++,C# or Python usage for sqllite.?

I would like sqllite on my raspberry pi 3 after I have gained experience 
under Windows 10.


Judging what the replies to questions, the very new beginners are left a 
bit out in the cold.

Perhaps the documentation ought to cover the need of pure beginners.

Regard to you all,

NT


On 05.03.2017 10:54, a...@zator.com wrote:

Besides the need to include RDBMS engine inside your application, and manage it 
from the code. You have a standalone application (sqlite3.exe) who let manage 
your databese from the CLI (command line interpreter) of your system, and play 
whit the majority options who SQLite offer.

HTH.

--
Adolfo


 Mensaje original 
De: John Albertini <john.albert...@gmail.com>
Para:  sqlite-users@mailinglists.sqlite.org
Fecha:  Sat, 4 Mar 2017 19:10:26 -0500
Asunto:  [sqlite] confused getting started

I'm not a computer novice, but also not a nerd/geek.

Been using PCs since the mid 1980s and have used dBase III+ and Approach
previously.

I can't seem to grasp what I need to download / install to use SQLite?

Can someone guide me through the process?  Looking to use it with
RootsMagic.

Thank you.
John
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



--

Nigel Trewartha
Sonnenweg 3
33397 Rietberg
Germany
Tel: 05244/3631 Fax: 05244/9063266
ntrewar...@t-online.de

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-05 Thread ajm
Besides the need to include RDBMS engine inside your application, and manage it 
from the code. You have a standalone application (sqlite3.exe) who let manage 
your databese from the CLI (command line interpreter) of your system, and play 
whit the majority options who SQLite offer.

HTH.

--
Adolfo

>
>  Mensaje original 
> De: John Albertini <john.albert...@gmail.com>
> Para:  sqlite-users@mailinglists.sqlite.org
> Fecha:  Sat, 4 Mar 2017 19:10:26 -0500
> Asunto:  [sqlite] confused getting started
>
> I'm not a computer novice, but also not a nerd/geek.

Been using PCs since the mid 1980s and have used dBase III+ and Approach
previously.

I can't seem to grasp what I need to download / install to use SQLite?

Can someone guide me through the process?  Looking to use it with
RootsMagic.

Thank you.
John
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] confused getting started

2017-03-04 Thread Simon Slavin

On 5 Mar 2017, at 12:10am, John Albertini  wrote:

> I'm not a computer novice, but also not a nerd/geek.
> 
> Been using PCs since the mid 1980s and have used dBase III+ and Approach
> previously.
> 
> I can't seem to grasp what I need to download / install to use SQLite?
> 
> Can someone guide me through the process?  Looking to use it with
> RootsMagic.

SQLite does not have a server or an independent installation.  If a programmer 
wants her program to use SQLite they build everything they need into the 
program.  So you should not have to do anything except install the program.  
This is why you can’t find any instructions: there’s nothing to do.

If you want to access the stored data from that program for your own purposes, 
that’s a different matter.  If that program stores its data unencrypted, then 
you may be able to do that.  A good place to start would be to download the 
'Precompiled Binaries' for your platform from the following page



and then read



Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] confused getting started

2017-03-04 Thread John Albertini
I'm not a computer novice, but also not a nerd/geek.

Been using PCs since the mid 1980s and have used dBase III+ and Approach
previously.

I can't seem to grasp what I need to download / install to use SQLite?

Can someone guide me through the process?  Looking to use it with
RootsMagic.

Thank you.
John
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users