Re: [sqlite] Tracking item history using SQLite

2019-08-30 Thread Random Coder
On Fri, Aug 30, 2019 at 3:35 PM Keith Medcalf  wrote:
> Seems fine, other than that event.first_seen and event.last_seen can be NULL, 
> in which case that field will never be updated.  So while you may claim that 
> you never store NULL in those fields, doing so will cause non-workage due to 
> integrity failure,

Good point.  There are no code paths that could put NULL in there now,
but as you say, I should make sure that's the case in the design, in
case the insert logic changes in the future.  Thanks for catching
this.

> and the purpose of a DBMS is to enforce integrity.

And thanks a ton for this comment, I need to get in this mentality, clearly.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Tracking item history using SQLite

2019-08-30 Thread Random Coder
First off, if this sort of "code review" style question is
inappropriate for this list, please feel free to reply to me directly
and tell me to stop, and I'll know to not do this again.

That said, I have a question on the use of SQLite.  At the risk of
falling into the XY problem, I'll give some details on what i'm doing,
and then how I'm doing it.  My basic question is if what I'm doing is
valid, and if I'm doing anything needlessly wasteful.

I have a system monitoring events (and I know I'm being vague on the
exact nature of these events, I can't provide too many details, sorry.
Please try to accept what I say as given about them).  The events have
IDs that are generated externally, they're 30-40 ascii characters
long, appear random, and known to be unique by external means for a
given event.  For the purposes of this particular problem, the only
thing I care about tracking is when I first saw an event, and the last
time I saw it.  For better or worse, this ecosystem already thinks
about timestamps as the number of minutes since a specific epoch, and
is used to treating all time values as an integer in that space, I'm
doing the same here.

So, I have a RESTful server written in Python, using APSW to create a
simple SQLite database:

CREATE TABLE IF NOT EXISTS
event(
event_id TEXT PRIMARY KEY,
first_seen INTEGER,
last_seen INTEGER
) WITHOUT ROWID;

Every time a new event comes in (they might be very out of order), I do a:

INSERT INTO event(event_id, first_seen, last_seen) VALUES(?, ?, ?)
ON CONFLICT(event_id) DO UPDATE SET
first_seen = MIN(excluded.first_seen, hashes.first_seen),
last_seen = MAX(excluded.last_seen, hashes.last_seen);

To create the record for the event if it's new, or possibly update an
existing one with new values.  To give a sense of scale, I have around
5 billion events stored right now for the past couple of years in a
250gb database, and I see around 20 million per day, some small
percentage of those are new.

The important thing I can do for users is pull up reports.  The report
is roughly a summary of how old events are (when they were first seen,
and how long they've been seen for).  Outliers are highlighted, as are
events that haven't been seen at all.  The user will provide around
ten thousand event IDs, the majority of them, approaching 99%, will
exist in my database.  When the user requests a report, I create an in
memory database:

   ATTACH ':memory:' AS mem_db;
   CREATE TABLE mem_db.valid(event_id TEXT PRIMARY KEY);

And populate that table with the events the user is interested in.
I'm doing this since I won't get the list of items in one list, it's
built up over some minutes.  If the system running dies in the middle
of a request, it's OK to start over.  Then I run:

SELECT
mem_db.valid.event_id,
event.first_seen,
event.last_seen
FROM
mem_db.valid
LEFT JOIN event ON
event.event_id = mem_db.valid.event_id;

And gather up the results and pretty them up for the user.

Does all of this seem valid?  It works, so I'm OK with it, but I'm far
from a SQLite expert, and I want to know if I'm going to be backing
myself into a corner or otherwise torturing things that should be done
differently.  Or, if the answer is: "Don't use SQLite for that",
that's fine too, I'll start looking at other options.

Thanks for any feedback.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Problems loading extensions on Windows 10

2019-03-05 Thread Random Coder
On Tue, Mar 5, 2019 at 2:30 PM Kyle  wrote:
> I have downloaded both sqlite3 and mod_spatialite.dll (the extension) and
> copied them to C:\Windows\System32.
>
> When I run
> SELECT load_extension('mod_spatialite')
> sqlite returns "Error: the specified module could not be found"

Helpfully, on Windows, the error message for unable to find a DLL, and
unable to find a dependency of that DLL are the same error.

The version of mod_spatialite.dll I'm familiar with has several
dependencies.  You'll need to make sure all of the dependent DLL files
are also copied to somewhere in your path.  You might try using
Dependency Walker ( http://www.dependencywalker.com/ ) to see which
DLLs a component is missing.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite mailing list [was: SQLite Windows GUI alternative to Excel?]

2018-10-11 Thread Random Coder
On Wed, Oct 10, 2018 at 3:45 PM Warren Young  wrote:
> Fossil currently has no restrictions on password length[1] or content.  The 
> input text is simply salted, hashed, and inserted into the user table:
> [...]
> The salt is the project code combined with the user ID, not a secret per-user 
> salt.  Both of those values are publicly visible, but it does defeat rainbow 
> table attacks, which is the main point of salting.

This does not prevent new rainbow tables from being generated, and since:

https://fossil-scm.org/fossil/file?udc=1=436-441=src%2Fsha1.c

You're using a single iteration of the (technically insecure) hash
function to generate the password, creating a rainbow table is much
less computationally hard than if a modern password hashing function
had been used.

I'd be curious if someone's taken the effort to setup hashcat with
your rule set and see how quickly it can brute force it's way to the
plaintext.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Problem compiling 3.17.0 in MSVS 12

2017-02-14 Thread Random Coder
On Tue, Feb 14, 2017 at 1:23 PM, Bart Smissaert
 wrote:
> C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\vcprojects\Win32\SQLite\s
> qlite-autoconf-317>nmake /f Makefile.msc

What?!

You're building from the installation directory?

There's no way to do this on a normal installation that doesn't
involve modifying the Visual Studio installation directory, or running
in an elevated command prompt, both of which can cause no end of
problems.

Given you're the only one that can reproduce this problem, I'd highly
recommend uninstalling Visual Studio and reinstalling it.  There's no
telling what state you've gotten things into.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite3 Pros / Cons

2017-02-04 Thread Random Coder
On Feb 4, 2017, at 12:47 PM, Drago, William @ CSG - NARDA-MITEQ 
 wrote:

>> -Original Message-
>> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On
>> Behalf Of Clyde Eisenbeis
>> Sent: Saturday, February 04, 2017 2:58 PM
>> To: SQLite mailing list 
>> Subject: [sqlite] SQLite3 Pros / Cons
>> 
>> I'm new to SQLite ... started using it a few months ago.  I was unaware of
>> SQLite3 until I joined the SQLite mailing list.
>> 
>> What are the pros / cons of SQLite3?
>> 
>> If I switched from "using System.Data.SQLite" to SQLite3, are all of the
>> functions in a .dll I could download and use?
> 
> You're probably better off sticking with System.Data.SQLite because it will 
> be easier to make your code compatible with other databases. It's also 
> simpler in my opinion than using the SQLite 

And in case it's not obvious: System.Data.Sqlite _is_ sqlite3
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Problem with compiled dll on Windows

2017-01-11 Thread Random Coder
On Wed, Jan 11, 2017 at 10:28 AM, Rael Bauer  wrote:
> 1) Should the howtocompile.html webpage not include this in the "Building A
> Windows DLL" instructions?

Tough question.  Normally, I'd say this is toolset knowledge, and
really doesn't belong in those sort of directions.  But since you're
not the first person to hit this problem, and the directions as
followed result in a DLL that can't be called since it won't export
any functions, even incorrectly, they should probably be updated.

> 2) What is the -Ox flag? I did not find what that was for.

Like most compilers, Microsoft's supports a bunch of optimization
flags.  The SQLite page calls out Os ("favor code space") and O2
("maximize speed").  I use Ox, which is documented as "maximum
optimizations", and in my experience does a decent job at balancing
speed and and code space, but your needs may differ from mine.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Problem with compiled dll on Windows

2017-01-11 Thread Random Coder
On Wed, Jan 11, 2017 at 2:11 AM, Rael Bauer  wrote:
> I am trying to compile the latest amalgamation (3160200) as a dll on Windows
> 10 x64, using VS2015 x86 Native Tools Command Prompt. The dll compiles fine,
> however trying to use this dll in various tools (Delphi) results in the
> error "sqlite3_open not found".
>
> I tried compiling with:
> cl sqlite3.c -link -dll -out:sqlite3.dll  and
> cl sqlite3.c -DSQLITE_ENABLE_FTS4 -link -dll -out:sqlite3.dll


You're not including a .def file, so no functions are being exported
in your DLL.  You can verify this using depends (
http://www.dependencywalker.com/ ).  You can include the .def file
with something like this:

cl sqlite3.c -Ox -DSQLITE_ENABLE_FTS4 -link -dll -out:sqlite3.dll
-def:sqlite3.def

Here's a DLL compiled with this that has the exported functions, along
with the other artifacts of my build:

https://new-bucket-2a9cf983.s3.amazonaws.com/sqlite3_dll.zip
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 64-bit SQLite3.exe

2016-08-13 Thread Random Coder
Sorry about that, fixed.

On Sat, Aug 13, 2016 at 11:38 AM, Rousselot, Richard A
<richard.a.rousse...@centurylink.com> wrote:
> Your link says I do not have permission to open.
>
> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
> Behalf Of Random Coder
> Sent: Saturday, August 13, 2016 12:17 PM
> To: SQLite mailing list
> Subject: Re: [sqlite] 64-bit SQLite3.exe
>
> On Sat, Aug 13, 2016 at 8:39 AM, Rousselot, Richard A 
> <richard.a.rousse...@centurylink.com> wrote:
>> Thanks, this does allow the library to load and process.  The thing is your 
>> build is by far the slowest I have received, slower even than the 32-bit 
>> version.
>
> Sorry about that, it was a debug build.
>
> https://new-bucket-2a9cf983.s3.amazonaws.com/sqlite64_release.zip
>
> Might be faster.
>
>> Could you tell me what version of SQLite you compiled, your compiler and the 
>> settings you used on each build?
>
> SQLite 3.14.0, built with MSVC 18.00.30723 for x64.  The debug version was 
> built with /Od, this version is built with /O2 /Ot /Ox.  Both versions are 
> built with the SQLITE options of SQLITE_ENABLE_FTS3
> SQLITE_ENABLE_STAT2 SQLITE_ENABLE_RTREE.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> This communication is the property of CenturyLink and may contain 
> confidential or privileged information. Unauthorized use of this 
> communication is strictly prohibited and may be unlawful. If you have 
> received this communication in error, please immediately notify the sender by 
> reply e-mail and destroy all copies of the communication and any attachments.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 64-bit SQLite3.exe

2016-08-13 Thread Random Coder
On Sat, Aug 13, 2016 at 8:39 AM, Rousselot, Richard A
 wrote:
> Thanks, this does allow the library to load and process.  The thing is your 
> build is by far the slowest I have received, slower even than the 32-bit 
> version.

Sorry about that, it was a debug build.

https://new-bucket-2a9cf983.s3.amazonaws.com/sqlite64_release.zip

Might be faster.

> Could you tell me what version of SQLite you compiled, your compiler and the 
> settings you used on each build?

SQLite 3.14.0, built with MSVC 18.00.30723 for x64.  The debug version
was built with /Od, this version is built with /O2 /Ot /Ox.  Both
versions are built with the SQLITE options of SQLITE_ENABLE_FTS3
SQLITE_ENABLE_STAT2 SQLITE_ENABLE_RTREE.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 64-bit SQLite3.exe

2016-08-12 Thread Random Coder
On Fri, Aug 12, 2016 at 10:06 AM, Rousselot, Richard A
 wrote:
> I, and others, have tried to compile this as a 64-bit library but it will not 
> load from the command line (using .load) and gives the "Error: The specified 
> module could not be found."
>
> Anyone have tips on how to resolve this?  Is this library somehow 
> incompatible with 64-bit?

Generally that means the exports haven't been properly setup.  The
easiest way to do this generally is to setup a .def file to get the
proper function exported from the DLL with the correct naming
convention.

I've done just that for a quick test version at
https://new-bucket-2a9cf983.s3.amazonaws.com/sqlite64.zip , which may
or may not work for your needs.  Other than verifying acos() was
present, I've done no testing.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] IS a SQLite db of small size as good as reliable cache?

2016-02-04 Thread Random Coder
On Wed, Feb 3, 2016 at 3:53 PM, Howard Chu  wrote:
> No. Windows will toss clean pages out even in the total absence of memory
> pressure. It is moronic, but true. You can repeat the steps I outlined for
> yourself and see.
>
> https://groups.google.com/d/msg/comp.os.ms-windows.nt.misc/449tdNYPoX0/it4cx8Gvv2AJ

I did repeat something similar.  I tried running md5sum on a source
tree containing many files.  I'm not using this source tree for
anything else right now, nor have I in many days.

The first time I ran the script, it took 2 minutes.  The second time I
ran it, 30 minutes later, the same script took 30 seconds, implying
some amount of data is still in the filesystem cache.  I've been using
this system for other things in those 30 minutes, including compiling
code in another source tree.

Indeed, if I run RAMMap (
https://technet.microsoft.com/en-us/sysinternals/ff700229.aspx ), I
can see many of the source files from my md5sum test still in the
cache.  That same tool claims the majority of my non-process memory is
being used as standby for mapped files, aka, being used by the file
system cache.

No doubt Windows isn't perfect here, but I do wonder if something else
wasn't at play with the GCC test you did.


[sqlite] How to see SQLite debugging information

2015-12-09 Thread Random Coder
On Wed, Dec 9, 2015 at 10:14 AM, Adam Devita  wrote:
> To run MS-excell from the command line, you can call it from the full
> path (check version):
>
> "C:\Program Files\Microsoft Office\Office15\Excel.exe"

You can also run "start excel" to launch the current version of Excel.
Both of these are nearly useless, though.  Because the Excel
executable is marked as a GUI application, it won't attach to the
console window.

> I agree with David.  If you want to prove your dll is working (or not
> working), you should attempt to isolate it, for direct testing. Many
> hours of many people's lives have been wasted attempting to indirectly
> test things that have more than 1 unknown or potential source of error
>  in a chain.

Agreed.


[sqlite] How to see SQLite debugging information

2015-12-08 Thread Random Coder
On Tue, Dec 8, 2015 at 4:30 PM, Bart Smissaert  
wrote:
> So, what/where is that standard output channel?
> This is on a Win7 machine. How do I bring up that console window?
> There is no development environment here. I am running this from Excel.
> So, I have a standard Windows sqlite3.dll, a std_call dll (to make SQLite
> accessible to VB6)

Are you using Excel or VB6?  They're very different things.

You could try adding something like the following to somewhere near
the beginning of sqlite3_initialize

freopen("sqlite_stdout.txt","a",stdout);
freopen("sqlite_stderr.txt","a",stderr);

This will create two text files for all of sqlite's output.  There
might be side effects to doing this .. honestly I have no idea if
it'll work, and finding where the files are created might be
interesting (they'll be the current directory, but I have no idea what
that is when you're running Excel, or VB6)

Really, this problem is best solved with a debugger.  Even windbg is
better than flying blind, and you can step through the sqlite code in
a debug build even if it's being loaded by something like Excel where
you don't have the source code.


[sqlite] Sqlite fd problem!

2015-11-16 Thread Random Coder
On Mon, Nov 16, 2015 at 3:02 AM, Nader Lavasani
 wrote:
> Bug? or my silly mistake?!

>From the documentation for sqlite3_prepare_v2:

"The calling procedure is responsible for deleting the compiled SQL
statement using sqlite3_finalize() after it has finished with it."

You're not doing this.  Also, really consider using sqlite3_bind_text
or one of the other bind APIs instead of generating SQL statements in
code that can contain user input.


[sqlite] [AGAIN] SQLite on network share

2015-11-13 Thread Random Coder
On Fri, Nov 13, 2015 at 1:46 PM, A. Mannini  
wrote:
> 2) why there are SERVERLESS database (MS Access or VistaDB) that works
> without FS restrictions?

If you think Access works reliably on a network share, you're going to
run in to trouble sooner or later:

https://support.microsoft.com/en-us/kb/2028965

(Among many other issues)


[sqlite] Problems with v3.9.0: entry point sqlite3_finalize could not be located

2015-10-14 Thread Random Coder
On Wed, Oct 14, 2015 at 9:55 AM, jose isaias cabrera
 wrote:
> "The procedure entry point sqlite3_finalize could not be located in the
> dynamic link library SQLITE3.DLL."
>
> and the program aborts.  I had to go back to v3.8.11.1 to make the program
> work again.  Any thoughts?  I thought that this had happened before and it
> was some compiler issue.  Thoughts?

There appears to be a problem with the officially provided DLL.  It
only has sqlite3_json_init exported in the DLL.


[sqlite] SQLite database becomes corrupt on iOS

2015-08-14 Thread Random Coder
On Fri, Aug 14, 2015 at 8:38 AM, Simon Slavin  wrote:
> I have seen a problem like this only in one context, and it had nothing to do 
> with SQLite.  When an iDevice's power starts running low, it sends out 
> notifications to all running Apps and expects their cooperation in shutting 
> down.  An App is meant to react to the notification and shut down in less 
> than (IIRC) 6 seconds, without depending on network connections and without 
> using unusual amounts of power.

And just to add to this:  This is is reasonably good conditions.

I've dealt with a bug (unrelated to SQLite) that a tester of mine
could create data corruption on an iOS device.  The tester's device
had a bad battery, so by the time the device thought it had minutes of
power, it had seconds of life left, at best.  The tester was quite
adept at getting their device in a specific state that would cause our
app to destroy a data file.  I could never reproduce the condition on
my device, and indeed this tester couldn't either.  It had to be this
specific device with it's battery.

This is a lot of words to say:  All sorts of bad things are possible
when these devices start to lose power.  I've run into other issues
that lead me to believe the OS is caching file writes until the app
exits in some situations regardless of various sync calls, but I never
did have time to track down if I was just fooling myself, or if the OS
was indeed doing things to "help" me out.


[sqlite] REGEXP pcre DLL for Windows

2015-05-18 Thread Random Coder
On Mon, May 18, 2015 at 9:43 AM, sonypsx  wrote:
> may i kindly ask again about REGEX pcre DLL for Windows?
>
> Do someone have an idea or even a precompiled DLL which works under sqlite?

As you've found, you don't just need a pcre dll for windows, you need
a sqlite3 module to implement the callbacks sqlite uses.  I'm not
aware if there's version generally available.  I have a version I
built for internal use, based off some public domain code, you can
grab the source or DLL from:

http://bucket-1f8c9d86.s3.amazonaws.com/sqlite3-pcre-src.zip
http://bucket-1f8c9d86.s3.amazonaws.com/sqlite3-pcre.zip

It works for my purposes.  I can't support it beyond that, though.


[sqlite] Windows 8.x security requirements / SafeSEHCheck - NXCheck - DBCheck

2015-04-02 Thread Random Coder
On Thu, Apr 2, 2015 at 10:58 AM,   wrote:
>
> This are basically compiler switches as far as I understand.
>
> I am not a C programmer, so also quite difficult for me to link the library 
> statically.

These tests basically map to the /SAFESEH, /DYNAMICBASE, and /NXCOMPAT
linker flags.  Though, as I understand it, passing these tests is
recommended, and not required for Windows 8 certification.

I have a dump of a build of sqlite from a recent internal build.  I'm
not connected with the Sqlite project, I just use it, and happen to
turn on these flags in my build environment for other reasons.

https://bucket-1f8c9d86.s3.amazonaws.com/sqlite3.zip

You can either use my DLL, or build your own version of the DLL with
these options enabled.

I'd recommend the SQLite team turn them on for the version of the DLL
they distribute, but I'm honestly not sure if there are negative side
effects to doing so.


Re: [sqlite] sqlite3 shell in windows

2015-01-16 Thread Random Coder
On Fri, Jan 16, 2015 at 2:21 PM, James K. Lowden
 wrote:
> 5.  The 32-bit windows sqlite3 shell supports extensions?

Yes, it does.  The version on sqlite.org is compiled with that support.

> 6.  The above messages come from the OS, and result from LoadLibrary
> failing?  IOW, I didn't build a proper extension, windowswise?

Correct.

> 7.  How does the shell behave if SQLITE_OMIT_LOAD_EXTENSION is used?
> Obviously the function would fail, but I wonder if ".load" is dropped
> from the help and parseable syntax?

Yes, it is removed from the parser in do_meta_command() and the help
shown when you do a .help.

> 8.  Where is $HOME in windows, wrt .sqliterc?  I tried %appdata%; that
> didn't seem to be it.

The home is %USERPROFILE%.

If you're seeing the "Error: The specified procedure could not be
found." error, and you're not specifying an entry point in the .load
command, then no doubt the sqlite3_load_extension symbol isn't
properly exported.  I'd verify that your DLL has this symbol exported
using a tool like depends (http://www.dependencywalker.com/).  I'm
guessing you're missing an entry in your .def file, or a similar
location.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3 tool bug

2015-01-16 Thread Random Coder
On Fri, Jan 16, 2015 at 2:02 PM, Dave Dyer  wrote:
> the input side of the pipe.  Perhaps there is some windows conditioning
> that ought to be done by sqlite, on STDIN, to make it into a binary data
> source ?

You should be able to do a freopen(NULL, "rb", stdin); to change stdin
to be in binary mode.  I can't test that it'll help in this case,
however.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Preferred cast in C#

2014-07-14 Thread Random Coder
Could you not do something like this to handle the nullable types?

T GetValue(string field)
{
object obj = reader[field];

if (obj is System.DBNull)
return default(T);
else
return (T)obj;
}

Assuming the type is nullable, it should do the right thing, and if it's an
unexpected type, it'll throw an exception when casting to T.



On Mon, Jul 14, 2014 at 4:07 PM, Edward Ned Harvey (sqlite) <
sql...@nedharvey.com> wrote:

> I understand there are only 5 data types in Sqlite, and that the column
> type isn't necessarily the type of object returned in a query.  Is there a
> more seamless way to cast responses than this?
>
> I would really love to have an easy way of putting a long? into the
> database, and then getting a long? back out.  Maybe it exists and I'm just
> doing it the hard way right now...
>
> string employeeName;
>
> object myObj = reader["employeeName"];
> if (myObj is System.DBNull)
> employeeName = null;
> else if (myObj is string)
> employeeName = (string)myObj;
> else
> throw new Exception("Unexpected object type");
> ___
> 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] Programming API vs console

2013-04-25 Thread Random Coder
On Tue, Apr 23, 2013 at 8:47 PM, Igor Korot  wrote:

> query = wxString::Format(...);
> if( ( result = sqlite3_prepare_v2( m_handle, query, -1, , 0 ) ) !=
> SQLITE_OK )
>

It's been a while since I've worked with wxWidgets, but when I did,
wxString didn't support an implicit conversion like you're using here.

You need to do something like this for your sqlite_prepare_v2 call:

sqlite3_prepare_v2(m_handle, (const char*)query.mb_str(wxConvUTF8), -1,
, 0);

Though, I suppose if I'm right, this should have failed in some other way
much sooner.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Windows-Specific 2-c-files Amalgamation?

2013-03-13 Thread Random Coder
On Wed, Mar 13, 2013 at 1:14 PM, Dominique Devienne  wrote:
> On Mon, Mar 11, 2013 at 5:21 PM, Bert Huijben  wrote:
>> Since Visual C++ 2005 the limit in PDB files was increased to 24 bit. You
>> might still get a warning for compatibility with older tools, but the 'well
>> known limitation' was resolved over 8 years ago; 4 major compiler
>> versions ago.
>>
>
> Perhaps you can enlighten me more about this, as now that I have taken the
> time to double-check this, I'm still seeing the Visual Studio 10 debugger
> incorrectly stepping into the sqlite3.c file:

The PDB format supports a large number of lines.  The debugger,
however, doesn't.

This is fixed in Visual Studio 2012.  You can debug the sqlite3.c
amalgamation with the 2012 debugger. I just verified it works as
advertised.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] I consider this a bug. Anyone else?

2012-06-26 Thread Random Coder
On Tue, Jun 26, 2012 at 8:55 AM,   wrote:
> I do realize and appreciate the public domain source is available. My best
> option is recompiling the DLL but since the project and make files aren't
> designed for Visual Studio it will require time that like everyone her I
> cherish.

To me the best option is to include the SQLite library in your project
statically.  It consists of two files, and adding them to your Visual
Studio project is very easy.  It solves the version issues you've run
into, and also allows you to tweak the #defines for SQLite's build to
target your particular app's needs.  If you can't or don't want to
include it statically, at least build your own version of the DLL,
it's very straight forward and you'll have higher confidence over the
feature set included.

While having a version number in the resource section of the DLL would
solve the "which version of sqlite3.dll is this that's been downloaded
from sqlite.org?" issue (of course, so would calling
sqlite3_libversion), it would not solve the "is this a random version
of sqlite3.dll that someone else built?"  And yes, I've seen all sorts
of fun versions of sqlite floating around.

> Creating a new build also requires me to follow an extensive test
> plan.  I do a complete test plan even if I make a simple text change. Having
> the  DLL out in the public being used by thousands beats any test plan.

So you do extensive testing if you change a text string in your
source, but don't test each and every version of
libraries you use?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FW: Problem with SQLite when deployed.

2012-05-25 Thread Random Coder
On Fri, May 25, 2012 at 9:40 AM, Pavel Ivanov  wrote:
> Except that 64-bit executable cannot load 32-bit DLL and vice versa.
> I'm not sure how this rule is applied to managed executables and DLLs
> loading unmanaged DLLs.

On a 64-bit machine managed executables run as 64-bit assemblies (and
thus can only load 64-bit DLLs) unless the 32-bit flag is set in the
assembly.  You can set this flag via Visual Studio's "Platform Target"
option or CorFlags.exe.  I also seem to recall if a 32-bit assembly
launches a managed assembly, it'll be run as a 32-bit process.

This is why I use a custom SQLite DLL.  I compile and ship both 32 bit
and 64 bit versions and load the proper DLL at runtime depending on
how my process has been run.  Sadly, my solution has too many other
custom features to be something I can publish.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Compiling SQLite3 to run on Windows Mobile 6.5

2012-02-09 Thread Random Coder
On Thu, Feb 9, 2012 at 2:34 PM, Tim Leland  wrote:
> I can use CE if that's the problem. Can someone get sqlite3.exe shell to run
> on windows CE?

I'm sure someone can, but they'll need to know which architecture
you're running on, and possibly what CE components are in that
platform.

Depending on your build of CE, you might be able to just create a
project and bring in shell.c and sqlite3.c and compile it in Platform
Builder.

Unfortunately, I won't be able to help beyond that, I no longer have
access to Platform Builder or random CE devices anymore.  Perhaps
there's another CE expert on the list.  Failing that, you can try
asking for more specific help in one of the CE support forums at
http://social.msdn.microsoft.com/Forums/en-US/category/windowsembeddedcompact

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


Re: [sqlite] Compiling SQLite3 to run on Windows Mobile 6.5

2012-02-09 Thread Random Coder
On Thu, Feb 9, 2012 at 10:17 AM, Tim Leland  wrote:
> Ok now I understand. I need the shell for windows mobile. The reason why im
> doing this is the application running on windows mobile is really just an
> html5 browser storing data in a sqlite database. I need to convert the
> sqlite database to a .csv file and send that file to a ftp server. Any ideas
> on getting the shell to work on windows mobile?

Since Windows Mobile doesn't include the console aspects of CE, not
only will you need to get the SQLite shell to compile, you'll have to
create some sort of GUI shell around it to use it interactively.

Unless someone knows of a Windows Mobile SQLite explorer application
that's already out there, you're going to need to start coding.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Compiling SQLite3 to run on Windows Mobile 6.5

2012-02-09 Thread Random Coder
On Thu, Feb 9, 2012 at 10:07 AM, Tim Leland  wrote:
> What software would I need to compile?

Persumably whatever software you're using to compile the rest of your
application.  Visual Studio is the common way to compile Windows
Mobile applications.

SQLite is a library meant to be used in another program.  While there
is a shell application available for some operating systems, that
shell isn't available for Windows Mobile (nor would it be useful to
most people if it was), so you'll need to integrate the library
directly into your own application.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Compiling SQLite3 to run on Windows Mobile 6.5

2012-02-09 Thread Random Coder
On Thu, Feb 9, 2012 at 9:57 AM, Tim Leland  wrote:
> Ok so what would be the process of compiling the c#? Ive never done anything
> like that before.

Unless you have a need for the C# library, you should skip it.  Just
bring in the C source file and header from the amalgamation from
http://www.sqlite.org/download.html into your project and use it.

I don't remember needing to do anything special to compile sqlite3.c
on Windows Mobile.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Critical issue

2011-06-23 Thread Random Coder
On Thu, Jun 23, 2011 at 9:27 AM, Cyrille  wrote:
> Thank you for these guidelines. Unfortunately, it seems that Visual
> Studio is necessary and I just have the Express version. Do you confirm
> that with the Express version, rebuilding is not possible?

Sorry, I'd think Visual C++ 2010 Express is good enough, but I don't
have a machine I can test that theory on.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Critical issue

2011-06-23 Thread Random Coder
On Wed, Jun 22, 2011 at 10:48 PM, Cyrille  wrote:
>> Alternatively, you could recompile SQLite.Interop.dll to use the
>> static CRT library (/MT).
> Could you please let me know how to proceed to do this?

Download the source from
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

Decompress the archive

Open the sqlite-dotnetsrc-1007300\SQLite.NET.2010.sln solution file

Ensure "ReleaseNativeOnly" is the currently selected solution configuration.

Right click on the SQLite.Interop.2010 project and select Properties

Again, ensure "ReleaseNativeOnly" is the currently selected solution
configuration, and Win32 is the platform

Under Configuration Properties -> C/C++ -> Code Generation, change the
Runtime Library to Multi-threaded (/MT), and click OK

Right click on the project again, and select build.

Test the output,
sqlite-dotnetsrc-1007300\bin\Win32\ReleaseNativeOnly\SQLite.Interop.dll
, in your project.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Critical issue

2011-06-22 Thread Random Coder
On Wed, Jun 22, 2011 at 1:11 PM, Cyrille  wrote:
> I confirm also that my project was set to "anycpu". If I change the
> setting to "x86", is the VS 2010 C++ Redistributable package still
> necessary?

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


Re: [sqlite] Critical issue

2011-06-22 Thread Random Coder
On Wed, Jun 22, 2011 at 10:57 AM, Cyrille  wrote:
> As you said, I have been surprised by the result. One of my users copied
> the missing DLL indicated by Depends (IEShims.dll) to the application
> folder and Depends indicates now another missing DLL: ieframe.dll which
> seems to be again linked to IE.
> Well, I have the feeling that the only possible solution so far is to
> follow your other advice: adding the IE folder to the environment path.
> Could you please explain me how to proceed?
>
> Finally, I still very puzzled how the difference between the DLL error
> indicated by Depends and the DLL which cannot be found according to the
> .NET error message raised while launching the application.
> If the .NET raised an error message: "System.DllNotFoundException:
> Impossible to load the DLL SQLite.Interop.DLL", why this DLL file error
> is not also indicated by Depends?

IEShims and IEFrame are red-herrings.  They're delay-loaded by a
Windows component, and that component knows how to find them, and can
deal with them not being loaded if need be.

The core error is the fact you can't load SQLite.Interop.dll.  If you
open depends and open this DLL on the target machines, I'm betting
you'll see three error messages from depends.  You'll see IEShims.dll
and IEFrame.dll, which you can ignore.  You'll also probably see
MSVCR100.dll, which is the crux of the problem.  This is a guess, but
you probably just need to install the VS 2010 C++ Redistributable
package on the target machines and your project will work.
Alternatively, you could recompile SQLite.Interop.dll to use the
static CRT library (/MT).
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Automating the build of a sqlite database

2011-04-23 Thread Random Coder
On Fri, Apr 22, 2011 at 8:18 AM, Maurice Marinus
 wrote:
> On a windows platform I have the following:
> schema.sql (contains the sql scripts)
> sqlite3.exe (command shell for sqlite -> downloaded from sqlite.org)
> build.bat : A batch file containing the line : sqlite3.exe -init
> schema.sql default.db3

I use something like the following to create a sqlite database as part
of a larger build system:

sqlite3.exe output.sqlite ".read output.sql"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Speed up count(distinct col)

2011-02-13 Thread Random Coder
On Feb 13, 2011, at 3:38 PM, BareFeetWare  wrote:

> On 13/02/2011, at 1:04 AM, Yuzem wrote:
> 
>> I am grabbing the data from the each movie imdb webpage.
> 
> Does IMDB allow use of their data this way? After my brief reading of their 
> site, I thought they charge a $15k minimum per year for data.

They do allow some limited free use of their data, though I doubt they'll be 
happy with users scrapping their site, I'd imagine they prefer devs download 
the database files they provide:

http://www.imdb.com/interfaces

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


Re: [sqlite] SQLite and Windows 95

2010-12-21 Thread Random Coder
On Tue, Dec 21, 2010 at 10:06 AM,
 wrote:
> I wonder about something : those functions are in kernel32.dll on a XP
> computer. Is it possible (I never do that before), to take the file
> "kernel32.dll" on my XP computer, to put it on the Win95 computer in the
> directory of my SQLite application, and to call the functions I need for
> SQLite in this DLL instead of the kernel32.dll of Win95 ?
> Maybe with a call to LoadLibrary and with some calls to GetProcAddress ?

No, not only will that not work, but the license does not allow you to
copy random DLLs from Windows around.

I'd try something like the Legacy Extender
(http://www.legacyextender.com/).  It claims to contain a DLL with
implementations of many Windows NT functions, including this one.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite on 64-bit Windows O/S

2010-03-16 Thread Random Coder
On Tue, Mar 16, 2010 at 6:21 PM, Rashed Iqbal  wrote:
> Has anyone compiled and used SQLite on 64-bit Windows? Are there any
> code changes that would be needed before compiling? Would the same DB
> file work on 32-bit and 64-bit Windows platforms?

I routinely run SQLite on 64 bit and 32 bit windows, moving the
database back and forth without any issues.  There were no issues
building it.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users