Re: [sqlite] Data Manipulation ?

2005-09-25 Thread Doug Hanks
Richard,

If you need any help I'm available under contract.  I'll be in L.A.
next week on business with a client, but otherwise I will be free.

I've been programming for 10+ years and what you need done is very
simple and I could charge for a minimum number of hours and you will
have a full functional solution.

Doug

On 9/25/05, Richard Nagle <[EMAIL PROTECTED]> wrote:
> Does SQLite support any direct built-in commands, that can
> manipulate data?
>
> ie.
> suppose the boss wanted a report of cars honda in CA,
> but he wants to see the California instead of CA,
> so you need to convert all the state fields into full names,
> how would this be done...
>
> Fields are as follows:
>
> recid
> qty
> make
> model
> year
> engine
> color
> state
> price
>
>
> Thanks -
> Richard
>
> --
>
> I will not be pushed, filed, stamped, indexed, briefed, debriefed, or
> numbered!
> My life is my own - No. 6
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


Re: [sqlite] Easyer way ? (RE)

2005-09-24 Thread Doug Hanks
It's just a joke - no need to get excited.  It wasn't meant as condescending.

On 9/24/05, Richard Nagle <[EMAIL PROTECTED]> wrote:
> Is this some kind of sick sql humor?
>
> Did someone give this type of information,
> to you, when you needed help?
>
> Its great when you learn, and now you know,
> but, its sad, when you know, and you don't let it go.
>
> perhaps, there needs to be a newbie-novice email group
> made for sqlite user, whom DON'T know, but want to know.
>
> This way, we DON'T have to read JUNK MAIL.
>
> Best Regards-
> Richard
>
> PS: Big Thanks, To all whom did help with this, on and off
> the list
>
>
> Doug Hanks wrote:
> > Just stick the papers in the CDROM and tye "sqlite-import"
> >
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


Re: [sqlite] Easyer way ?

2005-09-24 Thread Doug Hanks
Just stick the papers in the CDROM and tye "sqlite-import"

On 9/24/05, Richard Nagle <[EMAIL PROTECTED]> wrote:
> Sorry, to say,
> its a STACK of papers on my desk, Next to the Other several stacks,
> of papers...
>
> So, Was looking for a easier Method of getting Paper (typing) data,
> into Sqlite, with out going threw all the insert...commands.
>
> Thanks -
> Richard
>
>
> Reid Thompson wrote:
> > Richard Nagle wrote:
> >
> >> is there a easier way of typing in data to Sqlite.
> >>
> >> sqlite> insert into car (md_num, md_name, style, year)
> >>...> values (1, 'Honda', 'Coupe', 1983)
> >>...> ;
> >>
> >> Man, just 806 more listing
> >> just looking for some short cuts, or helper apps...etc.
> >> to cut down some of the typing.
> >>
> >> Thanks -
> >> Richard
> >
> > do you already have the data in another format?
> > csv?, excel?, space delimited?
> > just about any consistent format can be handled via one of many of the
> > scripting languages.
> >
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


Re: [sqlite] Including sqlite3 in a GNU project

2005-09-24 Thread Doug Hanks
Mike,

This only tries to find existing installations of sqlite3.

I said I want to include a version of sqlite3 in my GNU project, have
GNU tools auto configure and compile it - then use libtool to link
against the static object.

Doug

On 9/24/05, Mike Chirico <[EMAIL PROTECTED]> wrote:
> On Thu, Sep 22, 2005 at 07:23:57AM -0700, Doug Hanks wrote:
> > Has anyone went through (what I feel is a painful process) of adding
> > sqlite in a GNU project?
>
> The following may help, which is a small package:
>http://ftp1.sourceforge.net/souptonuts/quota_examples.tar.gz
> or
>http://ftp1.sourceforge.net/cpearls/simple_but_common_cpp.tar.gz
>
> I put the following in my configure.in or configure.am file which
> checks for version 3 of sqlite.
>
>   AC_CHECK_LIB(sqlite3,sqlite3_open,[],found=no)
>
> This is the full configure.in file
>
>
> AC_INIT(getquota.c)
> AC_PROG_CXX
>
> if test -f VERSION; then
>   VERSION=`cat VERSION`
>   echo "Version set to $VERSION"
> else
>   VERSION='0.0.0'
> fi
> AM_INIT_AUTOMAKE(quota_examples, $VERSION )
> AC_PROG_CXX
> CXXFLAGS='-Wall -W -O2 -s -pipe'
> CFLAGS='-Wall -W -O2 -s -pipe'
>
>
> AM_CONDITIONAL(HAVE_SQLITE, true)
> AC_CHECK_LIB(sqlite3,sqlite3_open,[],found=no)
>  if test "$found" = "no"; then
>AC_CHECK_FILE(/usr/local/lib/libsqlite3.a, found=yes)
>if test "$found" = "yes"; then
>  SQLLIBS="-lsqlite3 "
>  INCLUDES="$INCLUDES -I/usr/local/include"
>  EXTRALIB='-L/usr/local/lib'
> else
>  AM_CONDITIONAL(HAVE_SQLITE, false)
>  echo ""
>  echo " 
> ---"
>  echo "| Are you SURE sqlite3 is installed?   
>  |"
>  echo "|  You need to try this:   
>  |"
>  echo "|export LDFLAGS='-L/usr/ located>'   |"
>  echo "| ./configure  
>  |"
>  echo " 
> ---"
>  echo "|  Will not compile the sqlite programs. But, why not install 
> SQLite?   |"
>  echo "|   $ wget http://www.sqlite.org/sqlite-3.2.2.tar.gz   
>  |"
>  echo " 
> ---"
>  echo ""
>fi
>  else
>SQLLIBS="$LIBS"
>LIBS=""
>  fi
> SQLIBOBJS='-Wl,-R/usr/local/lib'
> AC_SUBST(SQLIBOBJS)
> AC_SUBST(SQLLIBS)
> AC_SUBST(INCLUDES)
> AC_SUBST(EXTRALIB)
> AC_OUTPUT(Makefile)
>
>
> Below is an example of the Makefile.am that goes with the
> configure.in above.
>
> if HAVE_SQLITE
> bin_PROGRAMS = getquota setquotas quotadb
> else
> bin_PROGRAMS = getquota setquotas
> endif
>
> getquota_SOURCES = getquota.c quota.h
>
>
> setquotas_SOURCES = setquotas.c quota.h
>
>
> quotadb_SOURCES = quotadb.c quota.h
> quotadb_LDADD =  @INCLUDES@ @SQLIBOBJS@ @EXTRALIB@ @SQLLIBS@
>
>
> Hope with helps.
>
> Regards,
>
> Mike Chirico
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


Re: [sqlite] Re: Re: sqlite3_busy_timeout

2005-09-23 Thread Doug Hanks
Thanks, Igor.

On 9/23/05, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> Doug Hanks wrote:
> > Let me see if I understand this correctly:
> >
> > So calling sqlite3_busy_time() allows you sleep for a max of N ms if
> > the database is busy.  Basically this function polls for you?
>
> This is one way to describe it.
>
> > When
> > the database is free, it will return with SQLITE_DONE or SQLITE_ROW?
>
> Not it, but whatever function you called to initiate the request -
> sqlite3_step, sqlite3_execute. You only call sqlite3_busy_timeout once
> to set up the timeout on the database handle, and it affects all future
> operations.
>
> > What happens if the database never gets free?  Will
> > sqlite3_busy_timeout() just return SQLITE_BUSY?
>
> Again, not sqlite3_busy_timeout, but the function that initiated the
> request. Yes, it will wait for the specified time, and if it still
> cannot proceed, it'll fail with SQLITE_BUSY.
>
> Igor Tandetnik
>
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


Re: [sqlite] Re: sqlite3_busy_timeout

2005-09-23 Thread Doug Hanks
Let me see if I understand this correctly:

So calling sqlite3_busy_time() allows you sleep for a max of N ms if
the database is busy.  Basically this function polls for you?  When
the database is free, it will return with SQLITE_DONE or SQLITE_ROW?

What happens if the database never gets free?  Will
sqlite3_busy_timeout() just return SQLITE_BUSY?

On 9/23/05, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> Doug Hanks wrote:
> > Can someone please explain to me, in laymen's terms, what
> > sqlite3_busy_timeout() is used for?
> >
> >>  This routine sets a busy handler that sleeps for a while when a
> >> table is locked. The handler will sleep multiple times until at
> >> least "ms" milliseconds of sleeping have been done. After "ms"
> >> milliseconds of sleeping, the handler returns 0 which causes
> >> sqlite3_exec() to return SQLITE_BUSY.
> >
> > Perhaps an example with an explaination is in order?
>
> Suppose you are trying to perform a select, but there's an update
> currently in progress. Without sqlite3_busy_timeout or explicit busy
> handler, your operation will fail immediately with SQLITE_BUSY. But if
> you set up sqlite3_busy_timeout, SQLite will automatically retry your
> operation several times before erroring out. Hopefully the writing
> transaction completes before the timeout has expired, and your select is
> allowed to proceed.
>
> Igor Tandetnik
>
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


[sqlite] sqlite3_busy_timeout

2005-09-23 Thread Doug Hanks
Can someone please explain to me, in laymen's terms, what
sqlite3_busy_timeout() is used for?

>  This routine sets a busy handler that sleeps for a while when a table is 
> locked. The handler
> will sleep multiple times until at least "ms" milliseconds of sleeping have 
> been done. After
> "ms" milliseconds of sleeping, the handler returns 0 which causes 
> sqlite3_exec() to return
> SQLITE_BUSY.

Perhaps an example with an explaination is in order?

--
- Doug Hanks = dhanks(at)gmail(dot)com


Re: [sqlite] Including sqlite3 in a GNU project

2005-09-22 Thread Doug Hanks
I have found the following link that inspired Gnome-DB to use SQLite.

http://aaronbock.net/articles/sqlite/

But this method only uses the sqlite-source.zip which are just the pure C files.

I want to use the sqlite3.tar.gz distribution that uses GNU tools.

On 9/22/05, Mark Drago <[EMAIL PROTECTED]> wrote:
> On Thu, 2005-09-22 at 07:23 -0700, Doug Hanks wrote:
> > Has anyone went through (what I feel is a painful process) of adding
> > sqlite in a GNU project?
> >
> > I'm not referring to sqlite specifically, but just with the GNU tools
> > in general.
> >
> > I would like to copy the sqlite distribution into my project directory
> > and just extract it.  Then modify my configure.in and Makefile.am to
> > auto-magically configure sqlite, then go ahead and compile my project
> > and link my project against the static archives of sqlite, for
> > example:
> >
> > gcc obj1.o obj2.o obj3.o ../sqlite3-X.X.X/libsqlite3.a -o binary_name
> >
> > Any ideas?
> >
> > --
> > - Doug Hanks = dhanks(at)gmail(dot)com
>
> The Gnome-DB package does just this.  The libgda package that is
> provided by them is a DB abstraction layer.  One of the databases it
> supports is sqlite and it embeds sqlite into its library.  libgda is
> licensed under the LGPL.  However, it may be important that you make it
> possible for your package to use an external sqlite library still.  In
> my case the inclusion of sqlite in libgda was a downside because now I
> would need to have two separate sqlite instances on my system that would
> both need to be updated when a new sqlite is released.  In fact, libgda
> will be adding support for this shortly:
>
> http://mail.gnome.org/archives/gnome-db-list/2005-August/msg00048.html
>
> Mark Drago.
>
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.2.6 (GNU/Linux)
>
> iD8DBQBDMsP62ovBrIOxiiARAhFhAJ4qUnSK5+4E26RkMRDoyNdpxyz/JgCdF/UI
> yGxbl1kf9ELKqsBgjLEaH6U=
> =MQdv
> -END PGP SIGNATURE-
>
>
>


--
- Doug Hanks = dhanks(at)gmail(dot)com


[sqlite] Including sqlite3 in a GNU project

2005-09-22 Thread Doug Hanks
Has anyone went through (what I feel is a painful process) of adding
sqlite in a GNU project?

I'm not referring to sqlite specifically, but just with the GNU tools
in general.

I would like to copy the sqlite distribution into my project directory
and just extract it.  Then modify my configure.in and Makefile.am to
auto-magically configure sqlite, then go ahead and compile my project
and link my project against the static archives of sqlite, for
example:

gcc obj1.o obj2.o obj3.o ../sqlite3-X.X.X/libsqlite3.a -o binary_name

Any ideas?

--
- Doug Hanks = dhanks(at)gmail(dot)com


[sqlite] How to bind DATE and TIME values

2005-09-21 Thread Doug Hanks
Hello,

I would like to use the sqlite3_bind_* functions to bind data to a
TIMESTAMP column.

With regular SQL I can use the following command:

INSERT INTO TABLE (completed) VALUES(date('now'));

The data('now') function returns the current date.

What is the correct method in the C API to have the same functionality?

If there is a better way to handle timestamps perhaps with another
column type, please let me know.  I am flexible.

--
- Doug Hanks = dhanks(at)gmail(dot)com