[sqlite] Replicating table data from sqlite to ms sql server

2007-07-09 Thread maitong uy

Hello there,

I'm new to sqlite and I was wondering if there is a way to programmatically
replicate table data from a database in sqlite server to another database in
ms sql server? I'm hoping to do this without any user intervention(the
application will do it automatically). Is this possible?

Thanks
-- 
View this message in context: 
http://www.nabble.com/Replicating-table-data-from-sqlite-to-ms-sql-server-tf4053878.html#a11515014
Sent from the SQLite mailing list archive at Nabble.com.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] storing floating point values in field

2007-07-09 Thread Mohd Radzi Ibrahim
I've run SQLite3 inWindows, it's store up it surely did not truncate the 
decimal point - up to 15 significant digits...


regards,
Radzi.

- Original Message - 
From: "folabi" <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, July 10, 2007 3:20 AM
Subject: [sqlite] storing floating point values in field




Hi,

I stored a floating point number in a sqlite field with datatype REAL.

However, when i wanted to retrieve the data, sqlite returned a rounded 
value

back.
ie.
double val = 23.123567 stored as REAL
sqlite returns 23.1236

Could someone pls confirm if this is consistent behaviour in sqlite? If 
yes,

is there a way to retrieve the same floating point stored (23.123567)
without having to save the data as TEXT.

Cheers

Folabi

--
View this message in context: 
http://www.nabble.com/storing-floating-point-values-in-field-tf4051483.html#a11508159

Sent from the SQLite mailing list archive at Nabble.com.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-






-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] FTS and upgrades

2007-07-09 Thread Scott Hess

If you have not compiled in fts1, and try to drop an fts1 table,
you'll get an error.  I don't think you'll get a crash, but sqlite
will simply not know how to deal with the table.

I can think of two ways to deal with this.  When builidng a new
version, you could just leave the fts1 code in place.  Otherwise, you
could put the fts1 table in an attached database, which you could
delete using filesystem operations when you upgrade.

I would recommend just having both fts1 and fts2 available.  If you're
super-concerned about code size, you could pretty easily strip out all
of the interesting code from fts1.c and leave only enough to
successfully drop tables.  A little more aggressive would be to leave
enough code to do read-only queries without the fulltext index (useful
for pulling all the content data across to fts2).

[Let me know if I misread your question.]

-scott


On 7/6/07, Dave Brown <[EMAIL PROTECTED]> wrote:

Right, but what I'm asking is:

If version 1.0 of my program uses Sqlite with *only* fts1, and then I
upgrade users to version 2.0 of my program which uses *only* fts3, can my
version 2.0 code (which is using sqlite that only has fts3) safely delete
the original fts1 table created by version 1.0 without crashing the program?

Thanks again!



On 7/5/07, Dan Kennedy <[EMAIL PROTECTED]> wrote:
>
> On Thu, 2007-07-05 at 21:08 -0700, Dave Brown wrote:
> > I am considering using FTS for a new feature. My question is:
> >
> > - If I use fts1 (or fts2) now, and then a new version of fts comes out
> which
> > is not backwards compatible, will I at least be able to upgrade users by
> > simply deleting the old FTS table and re-building it using the new FTS
> > system?
> >
> > In other words, my users will have a database file built with fts1, then
> my
> > new upgraded code (which contains sqlite with fts3, for example) will
> try to
> > upgrade them by deleting the fts1 table, and creating a new table.
> >
> > Will the delete of the old table at least be guaranteed to work?
>
> fts1 and fts2 are separate extensions that happen to do similar things.
> You can load them both at the same time and have a single database
> connection access both fts1 and fts2 tables. The same should be
> true with fts3.
>
> Dan.
>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -
>
>



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite3_bind_text

2007-07-09 Thread Israel Figueroa

yes.. i get it... the thing is that my str is more like

str[][] = {"1,2","2,5,6","2,3,6,7,8","1,2,9"};

so i think i'm staying with

for (i=0;i:

You could also do this

 Query = sqlite3_mprintf("select name from foo where id = ?");
 rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL);
 char str[20][5] = {"32","2","66","3","88"} ;

 for (i=1;str[i]; i ++)  {
 sqlite3_reset(&Statement) ;
 sqlite3_bind_text(Statement,1,str[i],-1,NULL);

do {
 rc = sqlite3_step(Statement);
 if(rc == SQLITE_ROW) {
 [DO YOUR WORK]
  }
} while(rc  == SQLITE_ROW) ;

  }



Israel Figueroa <[EMAIL PROTECTED]> wrote: I'm not quite sure if what i'm doing 
is correct.

i have a table with id's and names..

table foo{
id INTEGER PRIMARY KEY,
name   varchar
}


then, i have to get all the names of a group (variable length) of
elements in foo(i have the id's in ONE string) so i did this.

Query = sqlite3_mprintf("select name from foo where id in (?)");
rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL);

fine so far...
for (i=1;i
  [...]
   sqlite3_bind_text(Statement,1,str,-1,NULL);  //where str is
something like "33,2,66,3,88"; where all the id's are valid..
  [...]
  rc = sqlite3_step(Statement); //here i get an rc = 101 ==
SQLITE_DONE when i was expecting SQLITE_ROW
  [...]
 }

the thing is that when i do the query manualy.. it works perfecttly (
select name from foo where id in (33,2,66,3,88)  )
but in the code... it doesn't.

maybe the sqlite3_bind_text doesn't do what i suposed...

i'm working with sqlite 3.4.0 amalgamation, BC++ 5.0... it works
perfectly with everything else (i removed all the const's in sqlite.h
that made the compiler freak).

BTW, the doc didn't say if the string returned by const unsigned char
*sqlite3_column_text should be freed.. so i don't. it's that ok?

-
To unsubscribe, send email to [EMAIL PROTECTED]
-






--
Thanks God

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite3_bind_text

2007-07-09 Thread Ken
You could also do this
 
 Query = sqlite3_mprintf("select name from foo where id = ?");
 rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL);
 char str[20][5] = {"32","2","66","3","88"} ;
 
 for (i=1;str[i]; i ++)  {
 sqlite3_reset(&Statement) ;
 sqlite3_bind_text(Statement,1,str[i],-1,NULL); 
 
do { 
 rc = sqlite3_step(Statement); 
 if(rc == SQLITE_ROW) { 
 [DO YOUR WORK]
  }
} while(rc  == SQLITE_ROW) ;
   
  }
 


Israel Figueroa <[EMAIL PROTECTED]> wrote: I'm not quite sure if what i'm doing 
is correct.

i have a table with id's and names..

table foo{
id INTEGER PRIMARY KEY,
name   varchar
}


then, i have to get all the names of a group (variable length) of
elements in foo(i have the id's in ONE string) so i did this.

Query = sqlite3_mprintf("select name from foo where id in (?)");
rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL);

fine so far...
for (i=1;i
  [...]
   sqlite3_bind_text(Statement,1,str,-1,NULL);  //where str is
something like "33,2,66,3,88"; where all the id's are valid..
  [...]
  rc = sqlite3_step(Statement); //here i get an rc = 101 ==
SQLITE_DONE when i was expecting SQLITE_ROW
  [...]
 }

the thing is that when i do the query manualy.. it works perfecttly (
select name from foo where id in (33,2,66,3,88)  )
but in the code... it doesn't.

maybe the sqlite3_bind_text doesn't do what i suposed...

i'm working with sqlite 3.4.0 amalgamation, BC++ 5.0... it works
perfectly with everything else (i removed all the const's in sqlite.h
that made the compiler freak).

BTW, the doc didn't say if the string returned by const unsigned char
*sqlite3_column_text should be freed.. so i don't. it's that ok?

-
To unsubscribe, send email to [EMAIL PROTECTED]
-




Re: [sqlite] sqlite3_bind_text

2007-07-09 Thread Ken
You can not provide in list items using bind as you described
 
 However you can do this:
 
  Query = sqlite3_mprintf("select name from foo where id in (%s, %s, %s, %s, 
%s)", str1, str2, str3, str4, str5);
 rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL);
 
 Then step through the query results...  
 

Israel Figueroa <[EMAIL PROTECTED]> wrote: I'm not quite sure if what i'm doing 
is correct.

i have a table with id's and names..

table foo{
id INTEGER PRIMARY KEY,
name   varchar
}


then, i have to get all the names of a group (variable length) of
elements in foo(i have the id's in ONE string) so i did this.

Query = sqlite3_mprintf("select name from foo where id in (?)");
rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL);

fine so far...
for (i=1;i
  [...]
   sqlite3_bind_text(Statement,1,str,-1,NULL);  //where str is
something like "33,2,66,3,88"; where all the id's are valid..
  [...]
  rc = sqlite3_step(Statement); //here i get an rc = 101 ==
SQLITE_DONE when i was expecting SQLITE_ROW
  [...]
 }

the thing is that when i do the query manualy.. it works perfecttly (
select name from foo where id in (33,2,66,3,88)  )
but in the code... it doesn't.

maybe the sqlite3_bind_text doesn't do what i suposed...

i'm working with sqlite 3.4.0 amalgamation, BC++ 5.0... it works
perfectly with everything else (i removed all the const's in sqlite.h
that made the compiler freak).

BTW, the doc didn't say if the string returned by const unsigned char
*sqlite3_column_text should be freed.. so i don't. it's that ok?

-
To unsubscribe, send email to [EMAIL PROTECTED]
-




[sqlite] sqlite3_bind_text

2007-07-09 Thread Israel Figueroa

I'm not quite sure if what i'm doing is correct.

i have a table with id's and names..

table foo{
id INTEGER PRIMARY KEY,
name   varchar
}


then, i have to get all the names of a group (variable length) of
elements in foo(i have the id's in ONE string) so i did this.

Query = sqlite3_mprintf("select name from foo where id in (?)");
rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL);

fine so far...
for (i=1;i

[sqlite] storing floating point values in field

2007-07-09 Thread folabi

Hi,

I stored a floating point number in a sqlite field with datatype REAL.

However, when i wanted to retrieve the data, sqlite returned a rounded value
back.
ie. 
double val = 23.123567 stored as REAL
sqlite returns 23.1236

Could someone pls confirm if this is consistent behaviour in sqlite? If yes,
is there a way to retrieve the same floating point stored (23.123567)
without having to save the data as TEXT.

Cheers

Folabi 

-- 
View this message in context: 
http://www.nabble.com/storing-floating-point-values-in-field-tf4051483.html#a11508159
Sent from the SQLite mailing list archive at Nabble.com.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Using SQlite with .NET

2007-07-09 Thread Ahmed Sulaiman
Thanks for the heads up :)

-Original Message-
From: Samuel R. Neff [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 06, 2007 2:49 PM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] Using SQlite with .NET

There are a few .NET wrappers for SQLite.  I would suggest
System.Data.SQLite available here:

http://sqlite.phxsoftware.com/

And for ADO.NET 2.0 development use version 1.0.43.  For LINQ stuff use
2.0.35.

Also wrapper-specific questions will probably get quicker responses in
their
dedicated forums.

http://sqlite.phxsoftware.com/forums/default.aspx

I haven't used the feature but I'm pretty sure that provider adds
support
for viewing/editing SQLite within Visual Studio 2005.

HTH,

Sam



---
We're Hiring! Seeking a passionate developer to join our team building
products. Position is in the Washington D.C. metro area. If interested
contact [EMAIL PROTECTED]
 
-Original Message-
From: Ahmed Sulaiman [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 06, 2007 2:02 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Using SQlite with .NET

Hi,

 

I am trying to evaluate the use of SQLite with .NET in out project. I
have downloaded the ADO.NET 2 adaptor for SQLite from source forge. But
I was not sure which version do I need to download (if any) from the
download page to get myself started. Could you please give me some
direction, links would be great. Also, is there a database
viewer/updater to populate tables with some test date in SQLite?

 

Regards

Ahmed




-
To unsubscribe, send email to [EMAIL PROTECTED]

-




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Views

2007-07-09 Thread Mike Johnston
To clarify, if I have the three join SELECT statement in code or i have the 
same three join SELECT in a view, once I do the prepare it should pretty much 
be same as in my case they are simple one-to-one joins returning 0 or 1 row max.

Thanks
Mike

Joe Wilson <[EMAIL PROTECTED]> wrote: --- Mario Figueiredo  wrote:
> On 7/6/07, Joe Wilson  wrote:
> > --- Mike Johnston  wrote:
> > > I have to join three tables to retrieve bits of data from each. I'm 
> > > wondering if I use a
> view
> > > are there any performance issues vs. issuing the complete 3 table join 
> > > query in code.
> >
> > As long as your VIEW/subquery does not make use of
> > UNION/EXCEPT/INTERSECT, then it's usually the same speed.
> >
> > I would not recommend complex querying of views/subquery of unions
> > of selects with large result sets within SQLite. The select will run
> > much faster and use far less memory if you manually expand these
> > queries to not make use of the VIEW. SQLite will not perform this
> > optimization for you.
> 
> Unless performance issues are really at a premium, I would probably
> advise exactly the opposite. In other words, use views if you can,
> don't use them only when you must not.

No one is disputing views are useful.

I just wished they were faster in SQLite and used less memory on 
large datasets in compound queries, so you don't have to manually 
rewrite queries to get good performance:

  http://www.sqlite.org/cvstrac/tktview?tn=1924



  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



 
-
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.

[sqlite] Split a table

2007-07-09 Thread Ulrich Schöbel
As this list has excellent SQL wizards, I hope someone can help
me on the problem to split a table into two.

I have something like this:

create table org (
  a text,
  b text,
  c text,
  d text
);

I need to split it into rwo tables as follows:

create tbl_a (
  a_id integer not null autoincrement,
  a text,
  b text
);

create tbl_b (
  b_id integer,
  c text,
  d text
);

with b_id corresponding to a_id and a_id autogenerated.

I know how to do this within a tcl script, but I need a way
in pure SQL. Is it at all possible?

Thanks for your help

Ulrich

-
To unsubscribe, send email to [EMAIL PROTECTED]
-