Re: [sqlite] An interesting (strange) issue with selects

2012-06-29 Thread Joel Lucsy
There is a "bug" that I've read about on a Windows machines sporting the
NTFS filesystem that when a file is deleted and recreated within a certain
period of time, the original file is retrieved rather than a new one.

On Fri, Jun 29, 2012 at 10:54 AM, Dennis Volodomanov wrote:

> On 30/06/2012 12:19 AM, Black, Michael (IS) wrote:
>
>>
>> It persists across a reboot?
>>
>> You can create a database, delete it, reboot, and your app will still see
>> the original table?
>>
>> All I can say is wow...your system is really hosed.
>>
>> Even anti-virus shouldn't cause that.  This would infer some sort of
>> caching that is semi-permanent.
>>
>> Have you got a 2nd computer you can test this on?
>>
>> Would you be willing to share your app so others can check this?  As
>> "House" used to say..."interesting".
>>
>>
>>
> Not only my app, the sqlite shell will see it too. Regarding my second
> message - I was talking about this same screwed-up folder, so yes, I can
> create a new db in a new folder and it's fine. It's only when I try
> anything in this folder that things go amok (at least it's localized to
> this folder so far).
>
> I'll do testing on another machine and I'll do a full chkdsk here as well
> tomorrow.
>
> Most likely - it is my box that's causing this. Unless SQLite does any
> sort of real low-level disk access, bypassing standard OS, then it's
> unlikely that it somehow caused this to happen, but it would be good to
> rule this out somehow.
>
> I can share the app (not the source of course), sure, but I don't know if
> that'll help in any way?
>
>
>   Dennis
>
> __**_
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reading Blob to file in C#

2009-06-18 Thread Joel Lucsy
On Thu, Jun 18, 2009 at 9:39 PM, Seysan<afsh...@gmail.com> wrote:
> How can I read a blob column in C#?

I just checked my code and this is what I use minus various infrastructure bits:

public T GetValue( String query )
{
using (IDbCommand cmd = connection.CreateCommand())
{
cmd.CommandText = query;
return (T)cmd.ExecuteScalar();
}
}
public void foo()
{
byte[] img = GetValue<byte[]>( "select imageblob from imagetable" );
}

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite Exception System.InvalidCastException: Specified cast is not valid.

2009-06-17 Thread Joel Lucsy
On Wed, Jun 17, 2009 at 2:18 AM, Seysan<afsh...@gmail.com> wrote:
> I get the Exception there!  sqlite Exception
> System.InvalidCastException: Specified cast is not valid.
>
> The GetFieldType Shows: Systes.Byte[]

Couldn't find my code where I've done it at. Tho I did find that I
used a ExecuteScalar() that returns byte[].
Could it be that the field is null?
Also, what version of System.Data.Sqlite.dll are you running? I use
1.0.60 but haven't tested 1.0.61 yet.
-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reading Blob/Writing to File in C# 2008

2009-06-16 Thread Joel Lucsy
Hmmm, I know I've done this before. I'll have to dig deeper and find an example.

--
Joel LucsySeysan wrote:

When I used your code I get:  No current row

If I use: rdr.Read();
before your code, I get the same exception as before.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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


Re: [sqlite] Reading Blob/Writing to File in C# 2008

2009-06-16 Thread Joel Lucsy
On Tue, Jun 16, 2009 at 6:44 PM, Seysan<afsh...@gmail.com> wrote:
> String cmd = String.Format("SELECT filename,content FROM documents
> WHERE did={0}",did);
>           contentCommand = sqlconn.CreateCommand();
>           contentCommand.CommandText = cmd;
>           rdr = contentCommand.ExecuteReader();

If rdr is a IDataReader, then it should work like:

int len = rdr.GetBytes( 0, 0, null, 0, 0 );
byte[] buf = new byte[ len ];
rdr.GetBytes( 0, 0, buf, 0, len );

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reading Blob/Writing to File in C# 2008

2009-06-16 Thread Joel Lucsy
On Tue, Jun 16, 2009 at 6:44 PM, Seysan<afsh...@gmail.com> wrote:
> String cmd = String.Format("SELECT filename,content FROM documents
> WHERE did={0}",did);
>           rdr = contentCommand.ExecuteReader();

What type is rdr? I believe it should be byte[]

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_open16 fails on Windows Vista 64b

2008-11-26 Thread Joel Lucsy
On Wed, Nov 26, 2008 at 11:23 AM, Ti Ny <[EMAIL PROTECTED]> wrote:
> Dependency walker fails to load that DLL. Also it reports mess between 
> dependencies (x86 vs. x64), don't understand why when it
> has been compiled as target x64.

If it fails to load, where is this "mess" at?
-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Resources for newbies.

2008-08-02 Thread Joel Lucsy
On Sat, Aug 2, 2008 at 5:00 PM, David Nelson <[EMAIL PROTECTED]> wrote:
>   sqlite3_exec( m_pdbData, "select * from Event" , , this,

Is it as simple as a missing ; after Event in the query?

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite and nested transactions

2007-04-11 Thread Joel Lucsy

It seems to me that the biggest worry about nested transactions is backwards
compatibility. So, first, let me reiterate some points:

1). Actual changes to the database occur thru only one user at a time and
modify the database directly.
2). The journal is created by this one user and is a record of how to put
modified database back to its original state.
3). If the process/computer dies, upon reading the database, if a journal is
found, the database is restored.

So, now, it seems to me that to handle nested transactions while maintaining
backward compatibility you'd:

1). Leave the name of the current journal alone, it will represent the
lowest or first transaction.
2). Upon first read of the database, if this journal exists, do what it
currently does, restore the database using only this journal. This maintains
backwards compatibility.
3). Upon start of a new transaction, create a new journal, perhaps journal1
then journal2 and so on. It will record changes to the database just like
the current journal does.
4). If this transaction commits, nuke the journal, its no longer needed.
5). If the transaction is aborted, apply it just like applying the journal
of the base transaction.

Internally, you'd need to keep track of the transactions in a list/stack
with their associated journal name.
Now, with all that said, I can't say how much work it would take to apply
this kind of change, but conceptually it doesn't seem all that hard. Any
takers want to debate this?

--
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program." --
Larry Niven


Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Joel Lucsy

9,223,372,036,854,775,807 / (1,000,000 * 60seconds * 60minutes * 24hours *
365days) = 292471 years

On 8/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


The maximum rowid is 9223372036854775807.  You're going to take
a long time to reach that value if you start with 1.

Do the math:  If you do 1 million inserts per second, 24 hours
per day, 365 days per year, how many centuries does it take you
to run out of rowids?



--
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program." --
Larry Niven


Re: [sqlite] Possible bug in sqlite3_prepare

2006-05-26 Thread Joel Lucsy

On 5/26/06, Michael B. Hansen <[EMAIL PROTECTED]> wrote:


This all works very well for some time - then suddenly after 250 - 1
calls to my function sqlite3_prepare returns "Object reference not set
to an instance of an object" - which is a .NET exception I interpretate
as a Null-pointer-exception / malloc failure.



I can't speak to your specific issue, but I've written a .NET wrapper for a
C++ project and that error is more than likely the result of the garbage
collector collecting a reference that the .NET assembly assumes is
still there. I can't tell you how many times this has happened to me.
Particularly, delegates can be tricky. If you don't put all your delegates
into some container like and ArrayList, eventually the GC comes along
and deletes your delegates. Then, poof, your application blows up
because the delegate you were using as a callback is gone. I heavily
suspect that the Finisar.SQLite wrapper is the issue, not your code.

--
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program." --
Larry Niven


Re: [sqlite] implementing editable result sets

2005-12-20 Thread Joel Lucsy
Can you share what you changed?

On 12/20/05, Robert Simpson <[EMAIL PROTECTED]> wrote:
>
> My approach in the ADO.NET 2.0 provider was to modify the core engine
> slightly.  I added a database pragma, which when enabled, directs the
> internal generateColumnNames() function in select.c to emit the underlying
> database, table name and column name for a given column.  So for example:




--
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program." --
Larry Niven


Re: [sqlite] Network-based DB performance for Mozilla

2005-09-13 Thread Joel Lucsy
How about reading it all into :memory: and attaching the network database 
with a trigger so that when an update is made to the :memory: database the 
change is reflected to the network copy.

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program." -- 
Larry Niven


Re: [sqlite] Running in memory only

2005-08-31 Thread Joel Lucsy
On 8/31/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I would like to know if it is possible to have an instance of sqlite
> running in RAM only? My aim is to build a small but fast memory SQL
> storage.

How about using the database called ":memory:". Unless this has been
removed when I wasn't looking, this would probably be the "easiest"
way.

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven


Re: [sqlite] ticket 1147

2005-04-26 Thread Joel Lucsy
On 2/28/05, Dennis Cote <[EMAIL PROTECTED]> wrote:
> Yes, it sure would be better to use an API.
> 
> The second would naturally become sqlite3_column_table(), and the fourth
> sqlite3_column_database().
> 
> Unfortunately, the natural name for the third item,
> sqlite3_column_name(), is already used. However, rather than the column
> name, it returns the usual column heading. This is sometime the column
> name alone, and sometimes the table name and the column name separated
> by a period, depending upon the type of query, joined or not, and the
> column name pragma settings. It's too bad this wasn't called
> sqlite3_column_heading().
> 
> Anyway, to maintain backwards compatibility the new API should probably
> be sqlite3_column_short_name() to match the intent of the
> short_column_names pragma. It would always return the short name of the
> column.
> Dennis Cote

Has anyone looked into providing this or has a ticket been entered?
I've been looking forward to something like this since it seemed like
the obvious thing to do, but haven't heard a peep about it since.
Wrapper writiers are sure to love this.

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven


Re: [sqlite] Access Violations in sqlite3_step when in DLL

2005-04-05 Thread Joel Lucsy
On Apr 5, 2005 6:54 AM, Chris Schirlinger <[EMAIL PROTECTED]> wrote:
> Recently we tried to tie in with a third party program that calls one
> of our DLL's (which access the SQLite3 DB and returns a data set)
> [Note: We eventually started a fresh project for this DLL, so there
> was less of a chance legacy code was the issue]
> 
> We don't control the EXE that calls our DLL, basically we export a
> couple of functions determined by the third party. The EXE that calls
> our DLL is written in C++
> 
> Now the issue is, randomly, but ALWAYS within a few dozen calls, the
> function sqlite3_step access violates.The first 10 calls
> (sqlite3_prepare -> sqlite3_step -> sqlite3_finalise basically) work
> fine, then maybe the 11th sqlite3_step AV's

Sounds like the calling type is different. Do you know if the EXE is
calling your stuff using stdcall or cdecl, and does it match your
functions? If you don't specify, your functions are cdecl. I've seen
this kind of thing when they don't match. It may work a couple of
times, but eventually something blows up.

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven


Re: [sqlite] Sometimes it really is a hardware problem....

2005-03-11 Thread Joel Lucsy
On Fri, 11 Mar 2005 13:48:07 -0500, D. Richard Hipp <[EMAIL PROTECTED]> wrote:
> some errors popped up.  On a 512MB SIMM, less than 10 memory cells
> where showing a problem, and then only if a specific bit pattern
> was written into adjacent cells.  The error was always in the
> 0x08 bit.  I removed the offending SIMM, rebooted and all tests
> passed.

Was the magic number of cells 8? I'm wondering if you had a bad "chip"
that somehow passed QA, but wasn't in a critical section of memory to
corrupt the system.

-- 
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space
program." -- Larry Niven