[sqlite] cannot compile sqlite3 with intel compiler (ICC) - log and hints for a possible solution

2017-07-08 Thread Roberto C.
Hi,

while trying to install and sqlite package for R statistical language
(Rsqlite)  I came across I bug: i could not compile the package with the
intel compiler ICC / ICPC. You can find the whole discussion (and the
solution) here - https://github.com/rstats-db/RSQLite/issues/223

However, the maintainer suggested me to take the issue upstream to the
sqlite mailing list. Therefore, here I am.

The diagnosis of the problem is:

The undefined symbol, __builtin_mul_overflow, is a GCC primitive. SQLite
has the option to call it directly. It's supposed to disable itself through
a some pre-processor checks if it's not supported by the current compiler,
but I believe icpc defines some pre-processor flags the same as GCC for
compatibility.

SQLite does check for SQLITE_DISABLE_INTRINSIC to disable calling these,
regardless of compiler-defined pre-processor directives. I'd suggest adding
-DSQLITE_DISABLE_INTRINSIC to the build (I believe in src/Makevars
).


... and the solution to the specific RSQLite issue is a  minor change to
the source code (see https://github.com/rstats-db/RSQLite/pull/224/files).


Below, instead, you can find the compilation log of sqlite with ICC under
Archlinux

==> Making package: sqlite 3.18.0-1 (sab  8 lug 2017, 16.52.07, CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
 -> Found sqlite-src-318.zip
 -> Found sqlite-doc-318.zip
 -> Found license.txt
==> Validating source files with sha1sums...
   sqlite-src-318.zip ... Passed
   sqlite-doc-318.zip ... Passed
   license.txt ... Passed
==> Extracting sources...
 -> Extracting sqlite-src-318.zip with bsdtar
 -> Extracting sqlite-doc-318.zip with bsdtar
==> Starting prepare()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... icc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether icc accepts -g... yes
checking for icc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by icc... /usr/lib/hardening-wrapper/bin/ld
checking if the linker (/usr/lib/hardening-wrapper/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/lib/hardening-wrapper/bin/ld option to reload object
files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from icc object... ok
checking how to run the C preprocessor... icc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if icc supports -fno-rtti -fno-exceptions... yes
checking for icc option to produce PIC... -fPIC -DPIC
checking if icc PIC flag -fPIC -DPIC works... yes
checking if icc static flag -static works... yes
checking if icc supports -c -o file.o... yes
checking if icc supports -c -o file.o... (cached) yes
checking whether the icc linker (/usr/lib/hardening-wrapper/bin/ld -m
elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for intptr_t... yes

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-10 Thread Paulo Roberto
Thank you very much, it worked!

On Tue, Aug 9, 2016 at 11:49 PM, Richard Hipp <d...@sqlite.org> wrote:

> On 8/9/16, Paulo Roberto <betobran...@gmail.com> wrote:
> >
> > I found your solution pretty elegant and I tried to implement it.
> > But after solving a lot of building issues with the sqlite3ext header
>
> It does not have to be implemented as a loadable extension.  Just copy
> the lines https://www.sqlite.org/src/artifact/8440f8d0b4?ln=41-53 into
> your application, then invoke
> https://www.sqlite.org/src/artifact/8440f8d0b4?ln=65-66 on the
> database connection right after you get it back from sqlite3_open().
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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] C API - Parameterized Atomic Transactions

2016-08-09 Thread Paulo Roberto
Thank you for all the answers.

Clemens,
The counterid in my case is a text field and not an integer. That's why I
need to sanitize.

Clemens and Keith,
As each of my process has its own connection to the database, I tried your
solution using BEGIN IMMEDIATE and it worked successfully.
Thank you.


Richard,

I found your solution pretty elegant and I tried to implement it.
But after solving a lot of building issues with the sqlite3ext header I was
not able to figure out how to use the function sqlite3_remember_init even
reading the MACROS definition.

My problem is with the parameter :

const sqlite3_api_routines *pApi

No matter what value I pass I keep receiving the signal SIGSEV
i.e. Segmentation fault.

Do you have another reference to give to me?

Thanks for your help.

Regards.

Paulo Roberto.


On Tue, Aug 9, 2016 at 9:07 PM, Keith Medcalf <kmedc...@dessus.com> wrote:

>
> > "BEGIN EXCLUSIVE TRANSACTION;"
> >  "SELECT counter FROM mytable WHERE counterid = ?;"
> >  "UPDATE mytable SET counter=? WHERE counterid = ?;"
> >   "COMMIT TRANSACTION;"
>
> > I have a counter that I need to increment and get its previous value in
> one
> > operation.
> > To access this counter I must pass as a parameter to the query a specific
> > WHERE condition.
>
> To paraphrase:
>
> I want to return the current value of a counter identified by an id and
> then increment it.  This operation must be atomic (have repeatable read
> isolation).
>
> BEGIN IMMEDIATE;
> SELECT counter FROM mytable WHERE counterid = ?;
> UPDATE mytable SET counter = counter + 1 WHERE counterid = ?;
> COMMIT;
>
> Of course, the 1 in the increment does not need to be a constant but can
> be a ? if you are incrementing by some arbitrary value.
>
> You need to prepare and execute the statements one after each.
>
> And yes, the select and update, performed inside the same transaction, on
> a connection not being simultaneously used for "other purposes" is executed
> with repeatable read isolation.
>
>
>
>
> ___
> 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


[sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Paulo Roberto
Hello,

I need some help to do a simple operation, increment a counter and get its
former value.
I could have some race condition, so the transaction must be atomic.

I also would like to use prepared statements to accomplish that, so I have
less effort sanitizing inputs.

My problem:

I have a counter that I need to increment and get its previous value in one
operation.
To access this counter I must pass as a parameter to the query a specific
WHERE condition.

I would like something like this:

"BEGIN EXCLUSIVE TRANSACTION;"
 "SELECT counter FROM mytable WHERE counterid = ?;"
 "UPDATE mytable SET counter=? WHERE counterid = ?;"
  "COMMIT TRANSACTION;"

The *sqlite3_exec* doesn't allow me to pass parameters.
And the documentation of *sqlite3_prepare_v2 *says: "*These routines only
compile the first statement in zSql, so *pzTail is left pointing to what
remains uncompiled*"

My question is: Preparing 4 statements, binding then and calling *sqlite3_step
*for each one of then in order, would have the expected atomic operation
behavior or not? If not, how could I achieve this?

Thank you in advance.

Regards.

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


Re: [sqlite] Custom Collation comparing only firt character?

2011-08-26 Thread Roberto Colnaghi

Thank you for your detailed reply.
Though I cannot use DLLs since it is an iPhone iOS (MacOSX) operational 
system.I was hoping for a collation callback that is called for all characters, 
not only the first.
For my subset of data, it fits just perfect. All comparing fields are UTF8 
VARCHAR.
Shouldn't sqlite3_create_collation be called for every single character? Let's 
say the comparing names are "São Paulo" and "Santos". ->  SELECT * FROM Game 
WHERE TeamHome = 'SANTOS' COLLATE anyCIAI;







The LOG function shows a comparison between S and other first char only only:








41 65 A - 53 83 S = -18
43 67 C - 53 83 S = -16
46 70 F - 53 83 S = -13
53 83 S - 53 83 S = 0
49 73 I - 53 83 S = -10
46 70 F - 53 83 S = -13
50 80 P - 53 83 S = -3
43 67 C - 53 83 S = -16
47 71 G - 53 83 S = -12
I was expecting it to go further in the comparison:"São Paulo" and "Santos" 
should LOGS - Sã - ao - n -> stops here, not what your looking for
When using it on ORDER BY, it is clear that only the first char is compared.
Since ICU is not an option for iPhone, I've run out of options and ideas here.
Thanks again,











Date: Thu, 25 Aug 2011 13:30:57 +0200
To: colna...@msn.com
From: j...@antichoc.net
Subject: Re: [sqlite] Custom Collation comparing only firt character?



Hi Roberto,


It all depends on your data source(s).  If you're sure you have all
accented codepoints dealt whith in your custom collation, then it may be
enough.  But if your application has any possibility to have to deal
some day with codepoints that you didn't consider in your
collation, then you're going to have it changed, possibily several times,
while the app is in the wild.  That may be a serious issue with
embedded systems ...


FYI I forward you a download link to a small SQLite extension I wrote for
dealing with Unicode text from several locales.  Brief background:
my wife and I run a e-shop.  We have customers in 27 countries and
suppliers in India and China, among other regions.  For instance I
had to syndicate catalogs and price lists from several indian sources,
some of them writen in indian scripts and using indian digits.


In short, the extension offers locale-independant unaccentuation, casing
and collation(s).  There are a number of other text-related
functions inside as well, like a locale-independant fuzzy
compare.


You can download the extension
here.


It isn't a replacement for ICU: ICU is a _huge_ beast, is slow and
requires you to select a _specific_ locale to work with for every
operation.  My extension is oriented towards locale-independancy,
allowing you to perform operations on columns holding text from anywhere
(using any Unicode codepoint).  Of course locale-independant
collation is less than perfect when you focus on a given specific locale:
for that ICU is way better.  The full Windows x86 footprint is
<180kb and even includes functions for utf-8 and utf-16 text to avoid
back and forth UTF conversions.  Compare to 16+Mb of ICU...


While it's likely that the whole baby may not be 100% fitted to your use
case, you can still grab ideas, code, tables from the included
source.  Be sure to take the time to read the explanations on top of
the C source.


The archive comes with a ready-to-use x86 Windows DLL which allows you to
play with the various functions without requiring you to write a single
line of code, for instance using a third-party SQLite manager like SQLite
Expert (by far my favorite at any rate).


Feel free to do whatever you want with the source but please report bugs
and/or issues.

Don't hesitate to chime here should you have any question.


Best regards.


--

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


[sqlite] Custom Collation comparing only firt character?

2011-08-25 Thread Roberto Colnaghi










Hi,


I'm using iOS SQLite with a custom collation.


I've registered it:
sqlite3_create_collation(sqlDatabase, 
"anyCIAI", 
SQLITE_UTF16, 
nil,
collationAnyCIAI);


And it is used like this:
"select * from Team where Name = 'SOMETHING' COLLATE anyCIAI;"


It works though only the FIRST character seems to be compared instead of the 
whole "Name".
Is there anything missing here?


The collation method should compare a á à ã... and so on as equal.

Thank you!










int collationAnyCIAI(void *arg1, int str1Length, const void *str1, int 
str2Length, const void *str2) {
NSString *strA = [NSString hexStringWithData:str1 ofLength:1];
NSString *strB = [NSString hexStringWithData:str2 ofLength:1];
int striA;
sscanf([strA cString], "%x", );
int striB;
sscanf([strB cString], "%x", );


//convert to accentless
//aA with accent to capital A
if( (striA >= 192 && striA <= 197) || (striA >= 224 && striA <= 229) ){
striA = 65;
}
//çÇ to C
if( striA == 199 || striA == 231 ){
striA = 67;
}
//eE with accent to capital E
if( (striA >= 200 && striA <= 203) || (striA >= 232 && striA <= 235) ){
striA = 69;
}
//iI with accent to capital I
if( (striA >= 204 && striA <= 207) || (striA >= 236 && striA <= 239) ){
striA = 73;
}
//oO with accent to capital O
if( (striA >= 210 && striA <= 214) || (striA >= 242 && striA <= 246) ){
striA = 79;
}
//uU with accent to capital U
if( (striA >= 217 && striA <= 220) || (striA >= 249 && striA <= 252) ){
striA = 85;
}
//a-z to A-Z
if( striA >= 97 && striA <= 122 ){
striA -= 32;
}


//convert to accentless
//aA with accent to capital A
if( (striB >= 192 && striB <= 197) || (striB >= 224 && striB <= 229) ){
striB = 65;
}
//çÇ to C
if( striB == 199 || striB == 231 ){
striB = 67;
}
//eE with accent to capital E
if( (striB >= 200 && striB <= 203) || (striB >= 232 && striB <= 235) ){
striB = 69;
}
//iI with accent to capital I
if( (striB >= 204 && striB <= 207) || (striB >= 236 && striB <= 239) ){
striB = 73;
}
//oO with accent to capital O
if( (striB >= 210 && striB <= 214) || (striB >= 242 && striB <= 246) ){
striB = 79;
}
//uU with accent to capital U
if( (striB >= 217 && striB <= 220) || (striB >= 249 && striB <= 252) ){
striB = 85;
}
//a-z to A-Z
if( striB >= 97 && striB <= 122 ){
striB -= 32;
}

int result = striA - striB;


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


Re: [sqlite] Ticks to unixepoch date

2010-07-13 Thread Roberto Dalmonte

Thanks for your answer.
Please find a test database in the attachment.
As you can see I have 1 table with 10 records, and the columns StartDate 
and EndDate represent a DateTime field, where the values are saved as ticks.
There is a view that tries to convert the ticks into unixepoch values, 
but I receive a floating point error.

Can you please take a look at it?
Best Regards
Roberto Dalmonte
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Ticks to unixepoch date

2010-07-13 Thread Roberto Dalmonte
Thanks for pointing that out Israel.
I had the right value (-62135596800) but I mistakenly pasted something else.
Nonetheless I get the following error:

invalid floating point operation
Any idea to make that statement work?
Best Regards
Roberto Dalmonte
Il 13/07/2010 16:46, Israel Lins Albuquerque ha scritto:
> Let me understand you...
>
> if tick is 0 the date id 0001/01/01 12:00:00?
> if yes the select do you want is
>
> SELECT datetime((TICK_VALUE / 100) - 62135553600, 'unixepoch') AS Expr1
>
>
> use that site for help!
> http://www.epochconverter.com/
>
>
>
> - "Roberto Dalmonte"<rob...@tiscali.it>  escreveu:
>
>> In theory it should be possible to do it right now using the following
>> syntax ...
>>
>> SELECT datetime((columnAsTicks / 100) - 186796800,
>> 'unixepoch') AS Expr1
>> FROM Table
>>
>> ...unfortunately it doesn't work, at least the way I tried it.
>>
>> The operation is the following:
>> 1) transforms the ticks in seconds (divide ticks per 1 million);
>> 2) subtract the seconds passed from date 0001/01/01 (starting date in
>> System.DateTime) to 1970/1/1 (starting date in Unixepoch)
>> 3) Use the result with the built-in SQLite function datetime.
>>
>> This way you could build a view and be able to see a normal date instead
>> of ticks.
>>
>> Any idea?
>> Roberto
>> ___
>> 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


[sqlite] Ticks to unixepoch date

2010-07-13 Thread Roberto Dalmonte
In theory it should be possible to do it right now using the following 
syntax ...

SELECTdatetime((columnAsTicks / 100) - 186796800, 
'unixepoch') AS Expr1
FROMTable

...unfortunately it doesn't work, at least the way I tried it.

The operation is the following:
1) transforms the ticks in seconds (divide ticks per 1 million);
2) subtract the seconds passed from date  0001/01/01 (starting date in 
System.DateTime) to 1970/1/1 (starting date in Unixepoch)
3) Use the result with the built-in SQLite function datetime.

This way you could build a view and be able to see a normal date instead 
of ticks.

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


[sqlite] SELECT TicksToDateTime(AppointmentStart)

2010-07-13 Thread Roberto Dalmonte
Hi, I'm a C# developer and happy user of a SQLite database.
I use System.Data.SQLite dll and  I'm saving datetime data asSystem. 
DateTime.Ticks and I'm very happy with it.
The only thing I would like to have is something similar to the existing
SELECT datetime(1092941466, 'unixepoch');

I would need something like:
SELECT TicksToDateTime(AppointmentStart) where AppointmentStart is an 
ipothetical Table Column defined as integer in SQLITE (System.Int64 in 
.Net).
This way I could build a view to look my appointment table in a human 
readable format.
Is there such a function or is there a way to build it?
Best Regards Roberto Dalmonte
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Repost: Accessing a DB while copying it causes Windows to eat virtual memory

2009-07-07 Thread Roberto
Haven't seen your previous post but just a WAG, have you selected the
VM Size column in task manager to show you per process VM usage. In XP
TM, it is under Tools Menu/Select Columns/Virtual Memory Size. This
should indicate which process is hogging VM.

2009/7/7 Stan Bielski :
> Sorry for the repost, but the original thread was hijacked by another
> list user. This is a serious problem IMHO; it looks like the DB can't
> be backed-up without rendering the machine unusable if a query hits it
> while a copy is in progress.
>
> Hello,
>
> In the course of copying a largish (20 GB) database file while
> accessing it via sqlite3, the machine became very unresponsive. I
> opened task manager and found that the system was using a huge amount
> of virtual memory, causing it to thrash. Per-process memory usage
> looked normal and did not add up to anywhere near system-wide VM
> usage.
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] out of memory with sqlite3 shell

2009-02-11 Thread Roberto Lumbreras
I'm using the default allocator, and it is a uclinux system without dynamic
libraries, everything must be staticaly linked, so ltrace can't  help
(anyway, I think there is no ltrace available for this machine).

I'll try to use gdbserver to debug it, but I really don't understand why
sqlite3 is doing different things (working/not working) depending on which
filesystem the database file is located.

Salud,
Roberto Lumbreras


On Tue, Feb 10, 2009 at 9:42 PM, Roger Binns <rog...@rogerbinns.com> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Roberto Lumbreras wrote:
> > With strace the problem is clear: sqlite3 calls "old_mmap" with length=0.
> > I'm running version 2.6.25-uc0 of uCLinux, so mmap returns EINVAL because
> > length==0, then sqlite3 says "out of memory".
>
> The default SQLite 3 code never calls mmap.  Go ahead and grep the code
> to see!  Are you using a custom allocator?  If not then your malloc
> library is the problem.
>
> The ltrace command can help find the library routines responsible.
>
> Roger
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkmR5psACgkQmOOfHg372QT0DACgyI1/4fN5H2jFBPELIEiRRy1c
> 3HcAoMIDA7tNIW4K9SO4BVeIctQI3zjw
> =ssx5
> -END PGP SIGNATURE-
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] out of memory with sqlite3 shell

2009-02-10 Thread Roberto Lumbreras
Hi all,

I've an out of memory error with the sqlite3 (3.6.10) shell and a very small
database, in an uclinux embedded system (m68k arch).

With strace the problem is clear: sqlite3 calls "old_mmap" with length=0.
I'm running version 2.6.25-uc0 of uCLinux, so mmap returns EINVAL because
length==0, then sqlite3 says "out of memory".

The funny part is that I'm unable to get the error if the database file is
in a NFS mounted filesystem, but I always get
the error with the file in a local jffs2 filesystem.

What can I do to solve this problem?

I send you attached both strace logs.

Regards,
Roberto Lumbreras
117   execve("/nfs/sqlite3", ["/nfs/sqlite3", "/flash/config.db"], [/* 8 vars 
*/]) = 0
117   ioctl(0, SNDCTL_TMR_TIMEBASE, {B9600 opost isig icanon echo ...}) = 0
117   ioctl(1, SNDCTL_TMR_TIMEBASE, {B9600 opost isig icanon echo ...}) = 0
117   ioctl(0, SNDCTL_TMR_TIMEBASE, {B9600 opost isig icanon echo ...}) = 0
117   rt_sigaction(SIGINT, {b833a6, [INT], SA_RESTART}, {SIG_DFL}, 8) = 0
117   access("/flash/config.db", F_OK) = 0
117   old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = fc7000
117   open("/flash/config.db", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
117   fcntl(3, F_GETFD) = 0
117   fcntl(3, F_SETFD, FD_CLOEXEC) = 0
117   fstat(3, {st_mode=S_IFREG|0644, st_size=46080, ...}) = 0
117   lseek(3, 0, SEEK_SET) = 0
117   read(3, "SQLite format 3\0\4\0\1\1\0@  \0\0\0\3\0\0\0\0"..., 100) = 100
117   old_mmap(NULL, 53248, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = 3d
117   old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = 524000
117   getuid32()= 0
117   open("/etc/passwd", O_RDONLY) = 4
117   ioctl(4, SNDCTL_TMR_TIMEBASE, 42e810) = -1 ENOTTY (Not a typewriter)
117   old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = 4ee000
117   read(4, "root:*:0:0:Administr"..., 4096) = 71
117   close(4)  = 0
117   open("//.sqliterc", O_RDONLY) = -1 ENOENT (No such file or directory)
117   write(1, "SQLite version 3.6.10\nEnter \".he"..., 96) = 96
117   getuid32()= 0
117   open("/etc/passwd", O_RDONLY) = 4
117   ioctl(4, SNDCTL_TMR_TIMEBASE, 42e808) = -1 ENOTTY (Not a typewriter)
117   read(4, "root:*:0:0:Administr"..., 4096) = 71
117   close(4)  = 0
117   write(1, "sqlite> ", 8)   = 8
117   read(0, "select * from actors;\n", 4096) = 22
117   fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, 
len=1}) = 0
117   fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741826, 
len=510}) = 0
117   fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1073741824, 
len=1}) = 0
117   access("/flash/config.db-journal", F_OK) = -1 ENOENT (No such file or 
directory)
117   fstat(3, {st_mode=S_IFREG|0644, st_size=46080, ...}) = 0
117   lseek(3, 0, SEEK_SET) = 0
117   read(3, "SQLite format 3\0\4\0\1\1\0@  \0\0\0\3\0\0\0\0"..., 1024) = 1024
117   lseek(3, 7168, SEEK_SET)  = 7168
117   read(3, "\r\0\0\0\5\0\0\0\1t\001Æ\2\3Z\0\0\0\0\0\0\0\0\0\0\0"..., 
1024) = 1024
117   old_mmap(NULL, 0, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) = 
-1 EINVAL (Invalid argument)
117   fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
117   write(1, "SQL error: out of memory\n", 25) = 25
117   write(1, "sqlite> ", 8)   = 8
117   read(0, "", 4096) = 0
117   close(3)  = 0
117   --- SIGILL (Illegal instruction) ---
117   +++ killed by SIGILL +++
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite 3.6.0 across dll

2008-07-25 Thread Roberto
You need to clarify what you mean by 'module'. Data is not shared in
DLL's (sperate memory space and all that..), each calling application
will need their own copy of data initialized by a shared library. If
you have a global variable in a dll and need to share this data across
multiple processes, then you need to look into memory mapped files.

2008/7/25 Jacek Oleksy <[EMAIL PROTECTED]>:
> Hello,
> I'm using VC++.NET 2003 & Windows XP SP2.
> I have following problem with version 3.6.0:
>
> sqlite configuration is being hold in a global variable sqlite3Config.
>
> My application uses a dll, which initializes sqlite database. Dll's copy
> of the sqlite3Config variable is initialized properly and sqlite calls
> from inside the dll work fine.
>
> However, the main module's copy of sqlite3Config is still empty and when
> I try to use the database from the main module a crash occurs in
> sqlite3_mutex_enter. It can be avoided by initializing sqlite in main
> module (e.g. by opening a database and closing it).
>
> The question is: can I use one database connection (one sqlite3 pointer)
> in multiple modules? In such case database operations from main module
> and from dll will be using different sqlite3Config variables, is it safe?
>
> Other solution is to perform all sqlite operations in one module or to
> open new db connection for each module.
> And btw: v3.5.9 works fine...
>
> Am I missing something here? Please correct me if I'm wrong...
>
> Thanks,
> Jacek
> ___
> 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] Problem loading extension in Delphi (FTS2)

2007-08-13 Thread Roberto
Might be a typo, but your declaration defines the calling convention
as 'stdcall' (instead of 'cdecl'), was your sqlite3.dll custom built
with this calling convention? I don't think much of sqlite would work
with stdcall.

On 13/08/07, Andre du Plessis <[EMAIL PROTECTED]> wrote:
>
> sqlite3_enable_load_extension : function (sqlite3_value: Pointer; AOnOff: 
> Integer): Integer; cdecl;
> sqlite3_load_extension : function (sqlite3_value: Pointer; AFileName, 
> AProcedure : PChar;
> var AErrorMsg : PChar): Integer; cdecl;
>
> var
>   Error : Pchar;
>   ConnectionHandle : Pointer; // Handle you got from call to sqlite3_open
> begin
> sqlite3_load_extension(ConnectionHandle, 'fts2.dll', nil, Error));
>
> This all worked very well for me.
>
> the problem as you say is that Aducom component does not expose this property 
> for you, but as far as I know you get the source for the component is 
> available so it's a small change for you to expose it.
>
> The problem with DISQLite3 is that it is not free and the sources for the 
> component is not available.
>
> Where fts and sqlite is and there are good documentation for fts.
>
>
> -Original Message-
> From: Ralf Junker [mailto:[EMAIL PROTECTED]
> Sent: 10 August 2007 03:14 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Problem loading extension in Delphi (FTS2)
>
> Hello Henrik Ræder,
>
> >I'm trying to load the FTS2 extension in Delphi, using the Aducom
> >components. Am really close, but still stuck, and thinking it's a problem
> >with the parameter to sqlite3_enable_load_extension().
>
> DISQLite3 (http://www.yunqa.de/delphi/sqlite3/) does not expose such problems.
>
> Look at the full text search demo project which incorporates both FTS1 and 
> FTS2 into a single *.exe application, with _no_ DLLs or external files needed.
>
> The new customizable tokenizer interface will be demonstrated by a 
> Unicode-aware Pascal tokenizer with the upcoming version of DISQLite3 as soon 
> as the FTS vacuum fix is official released.
>
> Ralf
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>


[sqlite] problems with .dump procedure

2007-06-19 Thread Roberto Davico

Hi all,

  I am Roberto and I find a problem using sqlite3 (version: SQLite 
version 3.3.8).


  I make a sample db to explain the situation:

  1) Create the sample database using command line tool:

sqlite> .schema
CREATE TABLE LOG (ID INTEGER PRIMARY KEY AUTOINCREMENT, MSG TEXT );
CREATE TABLE USERS (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, 
SURNAME TEXT);

CREATE VIEW USR AS SELECT NAME FROM USERS;
CREATE TRIGGER USR_DELETE AFTER DELETE ON USERS BEGIN INSERT INTO LOG 
(ID, MSG) VALUES( NULL, 'Cancellato utente'); END;



  2) Export with .dump command procedure

sqlite> .output dumpo.txt
sqlite> .dump
sqlite> .output stdout
sqlite> .quit


  3) Analyze the dump file:

~$ cat dumpo.txt
BEGIN TRANSACTION;
CREATE TABLE USERS (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, 
SURNAME TEXT);

DELETE FROM sqlite_sequence;
CREATE TABLE LOG (ID INTEGER PRIMARY KEY AUTOINCREMENT, MSG TEXT );
COMMIT;

where are my view and trigger?

Is it a problem on my handwork or it isn't possible to dump views or 
triggers? are there many settings to do before dump?


thanks all for any advice...

ciao
Roberto

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



Re: [sqlite] Usage of special characters in insert query

2006-12-13 Thread Roberto

Escape you input strings: insert into foo values ('I haven''t done that');

On 13/12/06, Kirrthana M <[EMAIL PROTECTED]> wrote:

Hi,

In my query for inserting values into the database i have a statement as
given below
insert into table_name values('I haven't done that');

table is created with this option
create table table_name(str varchar(20));

when the insert statement is executed it gives the error in haven't,It is
working fine if i remove the apostrophe,
but my input string will contain the apostrophe..
Give me a suggestion for rectifying this

Thanks,
Kirrthana







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



Re: [sqlite] sqlite3 close() run time errors

2006-12-12 Thread Roberto

On 12/12/06, Michele Santucci <[EMAIL PROTECTED]> wrote:

this's a run-time error not a linker error.


It's a runtime error cos it is linked incorrectly!

Specify the sqlite.def file (which IIRC lists the undecorated aliases
of the sqlite functions) as an option to the command line of implib.

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



Re: [sqlite] sqlite3 close() run time errors

2006-12-11 Thread Roberto

You are probably linking against exports with a leading underscore.
(The exports of sqlite3.dll don't have the _underscore). Does your dev
environment/linker have the option to disable this underscore
generation?

On 11/12/06, Michele Santucci <[EMAIL PROTECTED]> wrote:

Hello,

I'm trying to use sqlite3 into a CVI (National Itruments ANSI C dev tool). I 
took the last sqlite3 dll and source.
I create the .lib file linked it to the binary and included the sqlite3.h 
file... but as long as I start the application I got an error about a missing 
entry point of the _sqlite3_close() function... why?
May depends on mscvrt dependancies?

Distinti saluti,

 Michele Santucci
=
Software Development Manager
*
Celin Avio s.r.l.
*
tel. +39-0187933876
fax +39-0187933654
web: http://www.celinavio.it
=



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



Re: [sqlite] about call back of sqlite.

2006-12-08 Thread Roberto

On 08/12/06, hongsion <[EMAIL PROTECTED]> wrote:

Hi sqlite,
I want to using sqlite this way.  Application  A  register callback
to sqlite db. And application B  will modify sqlite db. I want each time
sqlite was modified by B, A is notified by callback. Is this possible in
sqlite?  A and B run in different process. Thanks!




No it is not possible, you have to implement your own cross process
mechanism to notify applications of changes. Another idea DRH brough
up in the past, is to poll a table which stores ID's of items that
have changed.

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



Re: [sqlite] C++ SQLite

2006-11-28 Thread Roberto

Check that the version of VB, or VB itself supports calling external
functions using 'cdecl' calling convention (instead of WINAPI
stdcall).

On 28/11/06, RB Smissaert <[EMAIL PROTECTED]> wrote:

Yes, that looks to be the way to do it. Basically will have to learn how to
translate C defines to VB declares.

RBS



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



[sqlite] Disabling locking?

2006-09-21 Thread Roberto Edwins

I want to use SQLite with only one user executing queries sequentially , so
I don't need locking. Is there a simple way to completely disabling locking?
Specific instructions if possible please, thanks...


Re: [sqlite] About Triggers

2006-08-08 Thread Roberto

On 07/08/06, chetana bhargav <[EMAIL PROTECTED]> wrote:

  Can you elobarate more on this. ( For me if two threads register for the same 
trigger condition, with different callback functions, do both the functions get 
called)


The short answer to your question is no. (But I could be wrong) If I
remember  correctly, when Thread A and B both register a custom
function in a trigger, say for an update, Then when Thread A does an
update, only the trigger in Thread A will be 'notified'.


Re: [sqlite] Multibyte

2006-06-27 Thread Roberto

I am confused what are you trying to acheive by building a Unicode DLL?

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

Hi to all

I have created my own 2 SQLite-DLL's, one as a Unicode-DLL and the
other one as Multibyte-DLL.

If I create a Test-App with Unicode selected and import the
Unicode-DLL it works fine. If I do the same, but have Multibyte
select und import the MBCS-DLL, some crazy things happens:
Some in the DB stored (by Test-App) Fields are confused.
Not all... only some...  That means, all Fields who are
temporarly stored in a COleVariant are buggy after they written
to DB.

The same MBCS-Test-App works fine, if I import the Unicode-DLL.
Now I'm really confused.  ;-)

How do it right? Is it ok, if I ever use a Unicode-DLL?

Many thanks and best greetings from Germany
Anne

--


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail



Re: [sqlite] Where is the sqlite3.h file?

2006-06-26 Thread Roberto

The .h file is in the preprocessed source. The def file lists the
exports from the dll, which is useful when some new experimental
functions get defined in the .h file, but are not yet exported form
the Dll.

On 25/06/06, onemind <[EMAIL PROTECTED]> wrote:


Hi,

I am trying to use the .dll with c but it doesn't come with the eader file.
Also, what is the.def file that comes with it?



Re: [sqlite] Extra functions - New Project?

2006-05-24 Thread Roberto

On 24/05/06, Christian Smith <[EMAIL PROTECTED]> wrote:

Attach a patch to the ticket that implements your new functions. Send your
declaration of dedication of the code to the public domain to the list,
and hope DRH includes the patch in the next release.


IIRC, That has been suggested in the past, the consensus was to not
include extra functions, in keeping with the 'lite' in the project
name.


Re: [sqlite] Extra functions - New Project?

2006-05-24 Thread Roberto

On 24/05/06, Mikey C <[EMAIL PROTECTED]> wrote:


Hi,

I am in need of some new SQL functions and wanted to ask advice on the best
way to integrate these functions into SQLite 3. I am not a proficient C
coder unfortunately.
What is the best way forward?  Have someone develop these and add them
directly to func.c or (to aid upgrading) create a new source and header file
and add them to the project?  How can new functions be added without
removing the ability to upgrade the source to 3.5.6 etc when patches are
released to func.c?


You don't need to modify the SQlite source to keep your user defined
functions. Write your routines and keep them seperate from sqlite, and
register them in your applicaiton when you first open your database.
Unless the API for user defined finctions changes, you won't need to
make any modifications you your code on each sqlite release.


Re: [sqlite] calling convention ...

2006-05-17 Thread Roberto

cdecl throughout, and remember your callback & SQL function definitions as
well ;-)

On 17/05/06, Marten Feldtmann <[EMAIL PROTECTED]> wrote:


I wanted to use the prebuild dll of sqlite - and I was looking
for the information, what calling convention was used within
the sqlite.dll.

It seems to me, that "cdecl" is used and NOT "stdcall" - right ?


Marten



Re: [sqlite] Using sqlite3_open or sqlite3_open16?

2006-04-25 Thread Roberto
Windows (NT, 2000, XP etc..) unicode strings are in UCS-2 (!= UTF-16)
You should be calling SHGetSpecialFolderPathW (note the W at the end)
with a 'wide' buffer for the "My Documents" directory, before
converting this to UTF-8 and passing it to sqlite_open().
HTH.

On 24/04/06, COS <[EMAIL PROTECTED]> wrote:
> Thanks for the clarification. This information got me to the right
> direction. I have found the "MultiByteToWideChar" function. It does what I
> need. But instead of making conversions I decided to use the "IsTextUnicode"
> function (I didn't know that one either) which provides far more information
> about the string. If it returns true then I can safely (I suppose) use the
> sqlite3_open16 to open the database. In my tests it worked perfectly, but I
> guess the best way to really test this is asking some of our users to do so.
> ;-)
>
> Thanks a lot for your time and help on this. You really helped me a lot.
>
> Best Regards,
>
> COS
>
>


Re: [sqlite] future of sqlite

2006-02-08 Thread Roberto
Never seen such a list, but if you have the time & effort to look at
he CVS source, it might give you a clue about what's coming up in the
next release.

On 08/02/06, Miguel Angel Latorre Díaz <[EMAIL PROTECTED]> wrote:
> Is there any list of future enhancements, new features, etc on sqlite we can
> drool for?
>
>


Re: [sqlite] Prevent the error message box from popping up?

2006-01-05 Thread Roberto
You will need to be clearer on what error message you are seeing.
AFAIK SQLite does not display any error messages, is this a feature of
your development environment?

On 02/01/06, Tsolakos Stavros <[EMAIL PROTECTED]> wrote:
> Hi all.
>
> I am new both to this list and sqlite. Great tool.
>
> I apologize if the question is a bit stupid, but I searched the whole
> site without being able to find answer.
>
> How can I prevent this message box from popping up under Windows? I
> would like sqlite3_exec fail silently and only report the error through
> its return value.
>
> Thanks,
> Stavros
>
> PS: WinXP, sqlite327, MSVC6SP6
>


[sqlite] How to deal with Filesize-Limit of 2GB on Windows 95

2004-06-18 Thread Roberto Saccon
Hi all
I am a happy user of sqlite, but currently  my filesizes are little, 
because I store Multimedia data on a Berkeley-DB-like storage (QDBM), 
which can be splitted into several files. Now I am thinking about 
storing the multimedia data also with sqlite in the upcoming 3.0 
release, because it has native BLOB support. Well, I haven't done  any 
test yet about performance, but one concern I have is the filesize limit 
of 2 GB on MS Windows  95. Does sqlite provide some way of splitting the 
database file in small pieces ? How are other developers dealing with 
this filesize isssue for old MS Windows systems ?

regards
Roberto
P.S. if this qustion has been anwsered before, this is my first post to 
the list, and I really googeled a lot about the topic, but didn't found 
anything.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]