Re: [sqlite] SQLite and SumTotal ToolBook

2006-12-05 Thread Kiel W

On 12/5/06, Felix Hoffmann <[EMAIL PROTECTED]> wrote:


Questions: (1) Is it correct procedure to use sqlite_open() as the first
step, or do I need to perform some sort of memory allocation first?



sqlite_open() is the first step, so that is correct. Documentation is found
here: http://www.sqlite.org/capi3ref.html#sqlite3_open, notice the database
is marked as an out meaning the library will handle necessary allocation.

(2) Is there anyone out there who has used SQLite with TB or another

scripting language without a wrapper/binding? I could use some sample
code here.



Can't help on that, sorry.


Re: [sqlite] Database protected

2006-12-05 Thread Kiel W

On 12/5/06, made hendra <[EMAIL PROTECTED]> wrote:


  Are there a way to protected sqlite database? with password
  maybe.




I believe Dr. H has a commercial version that provides low level
encryption.  If you are using .Net (Windows) then modified version of SQLite
that has password protection here: http://sqlite.phxsoftware.com/


Re: [sqlite] "bad" SQL runs on CREATE

2006-02-16 Thread Kiel W
On 2/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> SQLite, by design, accepts any data type.  Even those you
> might not have heard of before.  This is a feature, not a
> bug.

It seems odd that a data type could be multiple words, but hey, that's just me.
hmm, ok. Well no complaints if that's the way it was designed :-)


[sqlite] "bad" SQL runs on CREATE

2006-02-16 Thread Kiel W
In version: 3.3.1

The following SQL runs fine without any errors:

 CREATE TABLE lnk_assoc_person (
 assoc TEXT,
 person TEXT,
 active BOOL
 joined DATE,
 left DATE
 );

 Notice the lack of a comma behind 'active BOOl'. Is this considered a
bug or expected behavior?  It is not caught until you try to insert
and then it believes it only has 4 columns.


[sqlite] empty file name / checkin 1085

2005-09-07 Thread Kiel W.

SQLite Version: 3.2.5
Platform: Windows XP

I happen to have a bug in my wrapper that allowed an empty filename to 
be passed on to sqlite3.  I noticed from check-in 1085 that it opens a 
temporary database, and seems to be acceptable behavior to go on with 
life.  I'm guessing this is an in memory database, but can it be 
referenced in anyway, or is this just a /dev/null ?  Equivalent to 
:memory: maybe?  Figured it might be useful in someway...


I've pasted some C code to demonstrated what I ran into for the curious. 
It runs fine, and no assert()'s are triggered.


   int errorCode = SQLITE_OK;
   sqlite3* db;
   sqlite3_stmt* stmt;
  
   errorCode = sqlite3_open("", &db);

   assert(errorCode == SQLITE_OK);

   errorCode = sqlite3_prepare(db, "CREATE TABLE foo( aNumber INTEGER 
);", -1, &stmt, NULL);

   assert(errorCode == SQLITE_OK);

   errorCode = sqlite3_step( stmt );
   assert(errorCode == SQLITE_DONE);

   errorCode = sqlite3_finalize( stmt );
   assert(errorCode == SQLITE_OK);

   sqlite3_close(db);


Re: [sqlite] Problems with threadsafe opt correction #2623

2005-09-06 Thread Kiel W.

Ian Monroe wrote:


I see your just ignorant of how open source software gets released.
 


Ian,
You are right, I hope you will forgive my ignorance.  Beyond that, it 
wasn't my place to criticize those projects even if I had fully 
understood the situation.


--kiel


Re: [sqlite] Problems with threadsafe opt correction #2623

2005-09-05 Thread Kiel W.

Ian Monroe wrote:


I do not see how such a major change can be justified in a minor point
release. For instance, currently amaroK does not work when using a
sqlite database on Debian Sid since they package it with sqlite 3.2.5.
 

Just my two cents, but if this change is breaking things in amaroK, 
XMMS2 and others then more testing should've been done on _those_ 
products before they were released to the wild.  Regression/ unit tests 
should be run on most any change but definately when you upgrade a major 
sub-component of your system.


--K


Re: [sqlite] Linking to SQLite with Cygwin / CMake [SOLVED]

2005-08-26 Thread Kiel W.

Reid,

Thanks for the help! 


1) I didn't realize the catch that the .lib directory was a hidden folder
2) I wasn't using the --enable-debug and --disable-tcl flags
3) CMake is not generating a valid Makefile that links correctly =(


Re: [sqlite] Linking to SQLite with Cygwin / CMake

2005-08-25 Thread Kiel W.
Ok, I'm definately thinking this is just a problem with my understanding 
of the build process in *nix's and the quirks of Cygwin.


I am getting the following warning with the default Makefile that is 
generated.
"libtool: link: warning: undefined symbols not allowed in i686-pc-cygwin 
shared libraries"


I found that this is because Windows(r) dlls can't have undefined 
symbols in them and the warning can be removed with the following flag: 
'-no-undefined'.  This also generates some other information that is not 
helpful to me (probably someone else).  However, this didn't seem to 
produce a static library (either .a or .lib).


I ran across the 'make sqlite3.dll' target in the make file and tried 
that. It succeeded without any problems and generated a .dll.  I tried 
the companion 'make sqlite3.lib' and this fails because it can't find 
impdef/implib/lib.


If anyone as other suggestions, or steps to build a static lib under 
Cygwin I'd appreciate it, otherwise I may just bite the bullet and see 
about going the shared libary route.


-- Kiel




Re: [sqlite] C/C++ interpreter Ch bindings to sqlite

2005-08-18 Thread Kiel W.
> I wonder if it is possible
> that sqlite will bundle the ch bindings source code together
> for distribution. 

Peter,

I don't speak for Dr. H or any of the developers/commiters, but asking
Sqlite to package your software with your's seems a little backward. 
Their focus is on Sqlite, not your product.  There are _a lot_ of
third party extensions, add-ins, etc for Sqlite. In my mind, it
wouldn't be practical for the Sqlite devs to support all the wrappers,
etc out there.

-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] sqlite3_step() question

2005-08-18 Thread Kiel W.
> There's the possibility of make a function called
> sqlite3_step_at_position()?!


Is it not feasable to do this in your wrapper function?  For instance,
in the wrappers I've written an use, I return a set of "rows" and the
user can manipulate them however they wish.  In your application, this
seems to me it would be a solution..

Make the general selection (or a set of 1000 queries) and "step"
through those in memory.  When you need more, get the next set..

Will that work for you?


-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] INTEGER data type

2005-07-08 Thread Kiel W.
> That's correct for version 2.8.  Version 3.0 expands the INTEGER PRIMARY
> KEY out to 64 bits so you have a range of -18446744073709551616 to
> +18446744073709551615.  Seems unlikely to overflow...
> --
> D. Richard Hipp <[EMAIL PROTECTED]>

Thanks for the correction.  Definately plenty of space now.

-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] My first post, a few wishes..

2005-07-07 Thread Kiel W.
On 7/7/05, Edwin Knoppert <[EMAIL PROTECTED]> wrote:
> 
> 1) I wish for a better way to recreate a table's definition.
> The FAQ example is no good if you are unknown to it's fields.
> For example, imy dbms obtains the create table query for the user, he might
> want to reset table name as add or remove fields.
> After that the copy as suggested in the FAQ does not know what fields to
> use.

SELECT name FROM sqlite_master
WHERE type='table'
ORDER BY name;

Is this what you are after?  This is (9) of the FAQ.

> See also #2
> 
> 2) Empty table does not return fields.
> After i create a table + fields, there seems to be no way to enumerate the
> fieldnames if there isn't any data inserted.
> Both cols and rows return 0.
> I'm using sqlite3_get_table()
> I heard before to make use of prepare but i can't figure out how.
> 
> 3) May i suggest a better (easier) forum for sqlite?
> I can setup a forum independant of my own sites.
> No commercials etc..
> 
> 
> 



-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] INTEGER data type

2005-07-06 Thread Kiel W.
On 7/4/05, Ajay <[EMAIL PROTECTED]> wrote: 
> 
> Hello All,
> 
> What is the maximum number that can be stored using INTEGER data type? My
> table uses INTEGER to store primary key, I store lot of records in table. 
> I
> suspect that primary key will run out of limit. How can I use long instead
> of INTEGER?

   As found at: http://www.sqlite.org/datatypes.html

"INTEGER PRIMARY KEY columns must contain a 32-bit signed integer."
 and from: http://www.piclist.com/techref/microchip/math/32bmath-ph.htm

"signed 32-bit numbers have a range of -2147483648 to +2147483647

-- kiel


Re: [sqlite] Syntax Help

2005-07-06 Thread Kiel W.
>set tran_string "BEGIN TRANSACTION\n"
>foreach ...
>append tran_string "\n"
>append tran_string "END TRANSACTION\nCOMMIT TRANSACTION"
>DB eval "$tran_string"
 Ray,
 Someone may pipe in to correct me, but this is my understanding..
 BEGIN TRANSATION, END TRANSACTION and COMMIT TRANSACTION could be 
considered three seperate sql statements. Meaning, you /could/ send them as 
three seperate execute( ) 's. However, it would be /much/ better to send 
larger chunks of sql code to an execute, seperating them by semi-colens ( ; 
).
 I'm not familiar with Tcl/Tk but I /think/ your code would be fine as long 
as you end each statement (including what I mentioned above). I could be 
entirely off base, but its something to try until someone else gives some 
input.

-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] Problem with "installing"

2005-06-08 Thread Kiel W.
Hey Danny,

I think with the advice you've gotten you should be able to run with it. 
However it you get stuck take a look at:
http://www.guitipsandtricks.com/Under the 30 most recent you will see
one entitled "Embedded Database for
Easy Storage". If you don't mind signing up, it walks you through using 
SQLite on VS .Net.

FYI, the site is run by one of my classes in college so you don't need to 
worry about spam or other junk to the email. Its mainly tips that people in 
the class have made, but there are a few posted by people in "industry".

On 6/8/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 
> Hello,
> 
> I'd like to use the SQLite Library now for the first time, for my programs
> which should run under Linux and Windows.
> 
> But I've got problems with the lib (I'm not very familar with .dll files). 
> I
> downloaded the Precompared Binary for Windows. In my progam I included the
> sqlite3.h and I copied the sqlite3.dll into my project directory. But when 
> I
> compile it, I got error message about unresolved links, e.g. 
> sqlite3_open()
> 
> I'm working normally with lib files, which I include with #pragma
> comment(lib, "file.lib"); into my C++ program.
> 
> Can anyone help me?
> 
> Thanks in advance :)
> 
> 


-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] Basic Text Bind Question

2005-06-07 Thread Kiel W.
Thanks Dan!

Works like a charm now.

On 6/7/05, Kiel W. <[EMAIL PROTECTED]> wrote:
> 
> Ok, thanks for the responses.
> 
> --Ulrik
> >I think it stops right here, because you've got fname twice. That
> >induces an error.
> 
> You are correct, I'm not sure when I introduced that error, but thanks for 
> pointing it out. Its not in my running code so it was either C/P error or 
> something else dumb.
> 
> -- Dr. H & Ted
> Ok, I see what you guys are saying. I split my code up so I create and 
> populate the database with another set of sqlite3_exec() statements. I 
> confirmed the database is populated with the following results:
> 
> $ ./sqlite3 test.db
> SQLite version 3.2.1
> Enter ".help" for instructions
> sqlite> select * from People;
> fname|lname 
> John|Fullman
> Mike|Fullman
> Mike|Smith
> 
> My select code is as follows:
> 
> sqlite3_open( "test.db", &database );
> 
> size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" );
> 
> iPrep = sqlite3_prepare( database, buf, size, &statement, 0 );
> 
> sqlite3_bind_text(statement, 1, "Fullman", 7, SQLITE_STATIC );
> 
> rc = sqlite3_step(statement);
> std::cout << rc << " " << SQLITE_DONE;
> 
> I would expect rc to be SQLITE_ROW, but it is SQLITE_DONE. I undertand 
> with getting multiple row back I will need to loop the sqlite3_step function 
> later.
> 
> 
> -- 
> Kiel W.
> [EMAIL PROTECTED]
> --
> >> time is swift << 
> 



-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] Basic Text Bind Question

2005-06-07 Thread Kiel W.
Ok, thanks for the responses.

--Ulrik
>I think it stops right here, because you've got fname twice. That
>induces an error.

You are correct, I'm not sure when I introduced that error, but thanks for 
pointing it out. Its not in my running code so it was either C/P error or 
something else dumb.

-- Dr. H & Ted
Ok, I see what you guys are saying. I split my code up so I create and 
populate the database with another set of sqlite3_exec() statements. I 
confirmed the database is populated with the following results:

$ ./sqlite3 test.db
SQLite version 3.2.1
Enter ".help" for instructions
sqlite> select * from People;
fname|lname 
John|Fullman
Mike|Fullman
Mike|Smith

My select code is as follows:

sqlite3_open( "test.db", &database );

size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" );

iPrep = sqlite3_prepare( database, buf, size, &statement, 0 );

sqlite3_bind_text(statement, 1, "Fullman", 7, SQLITE_STATIC );

rc = sqlite3_step(statement);
std::cout << rc << " " << SQLITE_DONE;

I would expect rc to be SQLITE_ROW, but it is SQLITE_DONE. I undertand with 
getting multiple row back I will need to loop the sqlite3_step function 
later.


-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


[sqlite] Re: Basic Text Bind Question

2005-06-07 Thread Kiel W.
Added note...

 rc = sqlite3_prepare( database, buf, -1, &statement, 0 );
> 

I also tried this with

rc = sqlite3_prepare( database, buf, strlen(buf), &statement, 0);

-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


[sqlite] Basic Text Bind Question

2005-06-07 Thread Kiel W.
Could someone point out what I missing or not understanding on this? I'm 
trying to do a simple text bind to search for people with the last name 
"Fullman". However my return code (rc) from sqlite3_step() is the same as 
SQLITE_DONE. I'm assuming this means it doesn't find anything.

Also, how do I pull the character string of the sqlite statement to be 
executed from 'sqlite3_stmt' ?

Thanks for the hand.

-- code snipet --

sqlite3_open( "test.db", &database );

size = sprintf( buf, "CREATE TABLE People( fname varchar(25), fname 
varchar(25) );" );
size = sprintf( buf, "INSERT INTO People VALUES( 'John', 'Fullman' );" );
size = sprintf( buf, "INSERT INTO People VALUES( 'Sally', 'Fullman' );" );
size = sprintf( buf, "INSERT INTO People VALUES( 'Mike', 'Smith' );" );

size = sprintf( buf, "SELECT * FROM People WHERE lname = '?'" );
rc = sqlite3_prepare( database, buf, -1, &statement, 0 );

sqlite3_bind_text(statement, 1, "Fullman", 7, SQLITE_STATIC );

rc = sqlite3_step(statement);

std::cout << rc << " " << SQLITE_DONE; // rc == SQLITE_DONE at this point

--- end code ---

-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] Re: 'int n' parameter in sqlite3_bind_*() functions

2005-06-04 Thread Kiel W.
Thanks Kurt. After reading the archive you posted I remembered reading it a 
few days ago when it came across! So much for my memory :-)

On 6/4/05, Kurt Welgehausen <[EMAIL PROTECTED]> wrote:
> 
> http://www.mail-archive.com/sqlite-users@sqlite.org/msg08319.html>
> >
> 



-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


[sqlite] Re: 'int n' parameter in sqlite3_bind_*() functions

2005-06-04 Thread Kiel W.
Sorry... hit a wrong key...


What is the 'int n' parameter used for in the sqlite3_bind_*() functions. 
The one I am speciffically looking at is:

 int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));


And it would be the forth parameter. I didn't see any reference to it in the 
documentation at: http://www.sqlite.org/capi3ref.html#sqlite3_prepare


-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


[sqlite] 'int n' parameter in sqlite3_bind_*() functions

2005-06-04 Thread Kiel W.
What is the 'int n' parameter used for in the sqlite3_bind_*() functions. 
The one I am speciffically looking at is:

-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


[sqlite] Create Table Programatically

2005-04-16 Thread Kiel W.
I've been trying to create a table programatically though C++ without
luck.  Here is what I have:

/*
*  The function that acts as a wrapper around sqlite3_exec
*/
inline int SqliteGatekeeper::ExecuteSql( const string sql,
sqlite3_callback CallBack = 0, void*
callbackParam = 0)
{
int rc = sqlite3_exec( database, sql.c_str(), CallBack,
callbackParam, &zErrMsg );

return rc;
}

/*
* The line that is calling this function
*/
std::cout << gatekeeper->ExecuteSql( "CREATE TABLE t1( a INTEGER
PRIMARY KEY,  b INTEGER);" ) << "\n";

zErrMsg is a private class variable in the same class as this
function.  My return value is "21" which significes I'm using the
library wrong.  I'd appreciate it if someone can point me to what I'm
doing wrong or a resource that explains creating table this way.

-- Kiel


Re: [sqlite] Do source updates effect DB file compatiblity?

2005-03-22 Thread Kiel W.
>If your application works fine with the version that you've embedded, why
change?

Ng, the application is not written yet, I'm still in the research
stage.  I'm looking towards the future and any problems I may possibly
encounter.

>The policy so far has been that file formats within a major
>version (i.e 3) are forwards compatible - files created by older versions
>can be read/written by newer versions.

Dan, 

thanks for letting me know how things have been done in the past.


[sqlite] Do source updates effect DB file compatiblity?

2005-03-18 Thread Kiel W.
List,

I'm new to the concept of embedded databases, but it seems to be the
ideal solution for a project I'm developing for school/ my church. 
Along with any resources you might recommend one question has been on
my mind for awhile.

As SQLite progresses and I update my source with new releases,
recompile and deploy is this going to cause the existing database
files to become "outdated" or no longer work?  My guess is no for a
particular branch (ie 3.x) but I want to be certain.  Is there
expected compatibility breaks later in development? To what extent?

If such breaks happen, with the existing framework of SQLite, how hard
might it be to transfer over to a newer release?  Examples from 2.x to
3.x might be helpful.

Thanks for any input.