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

2007-07-15 Thread maitong uy

The scenario would be the sqlite database is managed using CGI C, resides in
Linux environment, and accessed through the web. Then the sql server would
be replicating whatever changes would occur in the sqlite database (both
sqlite and sql server have the same tables). This will also happen vice
versa wherein any change in sql server will be replicated in the sqlite. Sql
server is managed using ASP and resides in windows server 2003.



Asif Lodhi wrote:
> 
> Hi maitong,
> 
> On 7/11/07, maitong uy <[EMAIL PROTECTED]> wrote:
>>
>>
>> I see...any idea as to how exactly? I really am out of ideas regarding
>> this... :(
>>
> 
> I think I did see some UnixODBC files on a Linux environment (Fedora Core
> 6,
> to be exact) and if you have the same kind of UnixODBC files on your
> system
> then you can use that to access the SQL Server database on the SQL Server
> machine. When it comes to SQLServer-to-Sqlite communication, it should be
> noted that Sqlite is an embedded database solution and you will have to
> write and some kind of a listener on your Linux server so that a windows
> program can communicate with it.
> 
> You can use a CORBA environment that exists on both Linux and Windows
> environment and use that to update both of your databases.
> 
> You can use Java for this task as well using its JNI interface. These are
> a
> few possibilities that have immediately popped up in my mind when I read
> your post.
> 
> --
> HTH
> 
> Asif
> 
> 

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


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



Re: [sqlite] RE: Question regarding INTEGER PRIMARY KEY (zero value in column) ?

2007-07-15 Thread Dan Kennedy
On Thu, 2007-07-12 at 23:38 -0700, RohitPatel wrote:
> Hi
> 
> I have a Question regarding INTEGER PRIMARY KEY (zero value in column) ?
> 
> Example table => create table {id INTEGER PRIMARY KEY, name TEXT};
> 
> Is it ever possible that value 0 (zero) will be inserted in a column
> declared as INTEGER PRIMARY KEY (and not as AUTOINCREMENT) ? Inserts are
> always with NULL value for that column. (i.e zero is never inserted
> implicitly in that column)

It's possible. But it's very unlikely. The fifth paragraph of
the following document describes how values are allocated for
integer primary key columns not declared as AUTOINCREMENT
columns:
 
  http://www.sqlite.org/autoinc.html

Dan.



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



Re: [sqlite] Milliseconds

2007-07-15 Thread Christian Smith

Scott Baker uttered:


Christian Smith wrote:

If you use the julianday representation, the integer component is the
number of days since "noon in Greenwich on November 24, 4714 B.C", with
the fractional part being the fraction of that day. Hence, the
resolution is determined by the fractional component of the real number.
Now, in the UK, I get the following:
sqlite> select julianday('now');
2454295.1407767

The integer component consumes probably 21 bits of the available 52 bits
mantissa of an IEEE-754 64-bit real. That leaves 31 bits for the
fractions of a day, giving a resolution of 1/24855 of a second:
2^31/(60*60*24) = 24855.134814814814814814814814815

Plenty enough for milli-second resolution.

Probably not very good for embedded applications if an FPU is not
available.


I'm a little confused by the math... help me work this out.

sqlite> SELECT julianday('now');
2454295.20404931

That gives me days since the Julian epoch. If I multiply by 86400 I
should get seconds since the Julian epoch.

sqlite> SELECT julianday('now') * 86400;
212051105903.613

That leaves me three decimal points of precision for seconds. So
that's thousandths of a second? Where do you get 24000ths of a second?



The floating point representation used by SQLite maps to the IEEE 754 
64-bit representation, which has 1 bit for sign, 11 bits for for the 
exponent, leaving 52 bits (effectively 53 bits including the implied 
leading 1 binary digit) for the precision.


Given that, the 2454295.20404931 uses 21 bits for the integral part of the 
number (before the floating point) including the implied initial 1 digit. 
That leaves 52-21 bits of precision, or 31 bits for the fraction of a day.


So, you have 1/2^31 days resolution, or 86400/2^31 seconds resolution. 
That is 1/24855.134814814814814814814814815 second resolution.


Christian


--
/"\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \

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



[sqlite] Re: Help with order-by query

2007-07-15 Thread Igor Tandetnik

Alberto Simões <[EMAIL PROTECTED]>
wrote:

I have this simple schema for news:
sqlite> .schema
CREATE TABLE news (year,month,day,title,text);
CREATE INDEX date ON news(year,month,day);

And this query results not as expected...

sqlite> SELECT * FROM news ORDER BY year DESC,month DESC,day DESC;
2007|7|7|Novo design|...
2007|6|19|10.000 palavras|...
2007|7|15|Actualização das regras de transcrição|...


My guess would be, some of the values are stored as integers and others 
as text strings. What does the following query return:


select typeof(year), typeof(month), typeof(day)
from news;

If you find from this query that not all fields are stored as integer, 
then you need to do two things. First, fix your existing data like this:


update news set
   year=CAST(year as integer),
   month=CAST(month as integer),
   day=CAST(day as integer);

Second, examine the code that inserts new records to figure out how 
strings made their way into the table in the first place.


For more details, see http://sqlite.org/datatype3.html

Igor Tandetnik 



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



[sqlite] Re: Help with order-by query

2007-07-15 Thread Alberto Simões

Ok, my fault. Integers versus string values.

Cheers
Alberto

On 7/15/07, Alberto Simões <[EMAIL PROTECTED]> wrote:

Hi

I have this simple schema for news:
sqlite> .schema
CREATE TABLE news (year,month,day,title,text);
CREATE INDEX date ON news(year,month,day);

And this query results not as expected...

sqlite> SELECT * FROM news ORDER BY year DESC,month DESC,day DESC;
2007|7|7|Novo design|...
2007|6|19|10.000 palavras|...
2007|7|15|Actualização das regras de transcrição|...

What am I doing wrong?
Thank you
Kind regards
Alberto

--
Alberto Simões




--
Alberto Simões

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



[sqlite] Help with order-by query

2007-07-15 Thread Alberto Simões

Hi

I have this simple schema for news:
sqlite> .schema
CREATE TABLE news (year,month,day,title,text);
CREATE INDEX date ON news(year,month,day);

And this query results not as expected...

sqlite> SELECT * FROM news ORDER BY year DESC,month DESC,day DESC;
2007|7|7|Novo design|...
2007|6|19|10.000 palavras|...
2007|7|15|Actualização das regras de transcrição|...

What am I doing wrong?
Thank you
Kind regards
Alberto

--
Alberto Simões

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