I have a strange problem with an FTS table in my sqlite database. I am creating a table like this:
CREATE VIRTUAL TABLE table01 USING fts4(name, content, tokenize=icu ru_RU);
Then inserting two rows, one with name and content and one only with name.
INSERT INTO table01(name, content) VALUES('Abc1', 'asdasd');
INSERT INTO table01(name) VALUES('Abc2');
And when I am trying to update or delete row with only name column filled I am getting an error "Access violation at address 7244CF96 in module 'sqlite3.dll'. Read of address 00000000.". There is all ok with other row, I can update it or delete as usual. It doesn't matter what locale do I use, I've tried en_US and many others. And there is no difference between fts3 and fts4. It seems like ICU bug, because there is no problem with built-in tokenizers of sqlite. Is it ICU or sqlite bug, or I am doing something wrong? I've tried this on SQLite Expert and in my project with all required compile options and all libraries included.
Latest in the stack frame:
msvcr100d.dll!strlen(unsigned char * buf) Line 81 Asm
my_prog.exe!icuOpen(sqlite3_tokenizer * pTokenizer, const char * zInput, int nInput, sqlite3_tokenizer_cursor * * ppCursor) Line 60276 + 0x9 bytes
my_prog.exe!fts3PendingTermsAdd(Fts3Table * p, const char * zText, int iCol, unsigned int * pnWord) Line 52616 + 0x18 bytes C
my_prog.exe!fts3DeleteTerms(int * pRC, Fts3Table * p, Mem * * apVal, unsigned int * aSz) Line 52828 + 0x1a bytes C
fts3DeleteTerms is getting null pointer instead of string and passing it down. I cannot debug it step-by-step right now (I am using amalgamation and VS 2010 cannot debug more than 65535 lines code).
Address 00000000 is, of course, a null pointer. Sounds like an sqlite3 bug (at least in the fts4/icu glue) if it is trying to pass null to the ICU tokenizer. Can you build everything in debug mode and find out who is getting the access violation?
Related
I am fetching data table to R from hana but it is showing some kind of error.
Succesfully integrated and odbc got connected but data is not fetching.
sqlFetch(ch,'SELECT * FROM "MY_SCHEMA.TICKETS_BY_YEAR"')
Error in odbcTableExists(channel, sqtable) :
‘SELECT * FROM "MY_SCHEMA.TICKETS_BY_YEAR"’: table not found on channel
i expected for the data but it is not coming
The cause of the error message is the wrong use of double-quotes (“).
To correctly quote the schema name and the table name, each of them need to be enclosed in a couple of quotation marks like so:
FROM “SCHEMA_NAME”.”TABLE_NAME”
^ ^ ^ ^
Your command in R needs to look like this:
sqlFetch(ch, 'SELECT * FROM "MY_SCHEMA”.”TICKETS_BY_YEAR"')
I'm repeatedly getting this error from 10.0.29-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
ERROR 1071 (42000) at line 81: Specified key was too long; max key
length is 767 bytes
The line targeted will typically look like this:
name VARCHAR(255) NOT NULL UNIQUE,
Changing it to a VARCHAR(63) makes the error go away. Is this a bug in MariaDB?
To work around this error, do one of
Workaround: do one of
Upgrade to 5.7.7 (or later) for 3072 byte limit instead of 767
Change 255 to 191 on the VARCHAR (assuming your values are not too long)
ALTER .. CONVERT TO utf8 -- but this disallows Emoji and some Chinese
Use a "prefix" index (ill-advised)
Reconfigure (for 5.6.3 - 5.7.6) (below)
Reconfiguring 5.6.3 or 5.5.14:
SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_large_prefix=1;
logout & login (to get the global values);
ALTER TABLE tbl ROW_FORMAT=DYNAMIC; (or COMPRESSED)
(The version numbers are based on Oracle's MySQL; the MariaDB version numbers are different for this issue.)
To follow up on the accepted answer - to change to UTF8, which I found the easiest solution, you can use the below line in MariaDb when creating your table:
name varchar(255) CHARACTER SET 'utf8' UNIQUE NOT NULL,
Could anyone please tell me is this the right model for non-deterministic values of integer and unsigned integer in Frama-C?
/* Suppose Frama-C is installed in /usr/local -default prefix */
#include "/usr/local/share/frama-c/builtin.h"
#include "/usr/local/share/frama-c/libc/limits.h"
...
#define nondet_int() Frama_C_interval(INT_MIN, INT_MAX)
#define nondet_uint() Frama_C_interval(0, UINT_MAX)
...
Are there any exceptions if I use the above code with different architectures in option -machdep?
No, in the Neon version you have to manually define the appropriate macro if you want to use another -machdep. You would typically end up with a command-line like that:
frama-c -cpp-extra-args="-D__FC_MACHDEP_X86_64" -machdep x86_64
Forthcoming Sodium release will make the -cpp-extra-args unnecessary, as well as providing by default a -I option to let preprocessor search into Frama-C's libc header, so that you won't have to provide it yourself or rely on absolute paths in your #include directive
NB: This answer is not a commitment to any particular date for the Sodium release.
One reason Frama_C_interval(0, UINT_MAX) may not work as intended is that Frama_C_interval has type int (int, int). When you happen to want the entire range of unsigned int values, that actually tends to help because the conversions that are introduced are subject to approximation, but in general the fact that Frama_C_interval is declared as returning an int is a nuisance.
The latest released version already has Frama_C_unsigned_int_interval, but it is in share/libc/__fc_builtin.h (installed to /usr/local/share/frama-c/libc/__fc_builtin.h. The file builtin.h looks like a vestigial remnant, especially with the $Id$ line dating back to when development was done under SVN.
For specifying that a value should be all possible unsigned intvalues, Frama_C_unsigned_int_interval(0, -1) saves yourself the trouble of including limit.h. The int value -1 passed as argument is converted to the largest unsigned int as per C rules.
I need to use the Sqlite vapi without any depedence on GLib. SQlite is non-gobject library, so it should be possible to do that.
However, when I try to compile the following file with the --profile posix
option,
using Sqlite;
void main() {
stdout.printf("Hello, World!");
}
I get am error messages:
sqlite3.vapi:357.56-357.59: error: The symbol `GLib' could not be found
public int bind_blob (int index, void* value, int n,
GLib.DestroyNotify destroy_notify);
^^^^
sqlite3.vapi:362.68-362.71: error: The symbol `GLib' could not be found
public int bind_text (int index, owned string value, int n = -1,
GLib.DestroyNotify destroy_notify = GLib.g_free);
^^^^
sqlite3.vapi:411.42-411.45: error: The symbol `GLib' could not be found
public void result_blob (uint8[] data, GLib.DestroyNotify?
destroy_notify = GLib.g_free);
^^^^
sqlite3.vapi:420.59-420.62: error: The symbol `GLib' could not be found
public void result_text (string value, int length = -1,
GLib.DestroyNotify? destroy_notify = GLib.g_free);
^^^^
Compilation failed: 4 error(s), 0 warning(s)
It seems that several of the functions defined in the sqlite vapi make references to the GLib.g_free and GLib.DestroyNotify symbols. Are there any posix alternatives to those?
That should be fairly simple to solve, and I can imagine several solutions.
It boils down to declaring a different delegate void DestroyNotify (void* data) (either in the posix.vapi or sqlite3.vapi) and bind free() in posix.vapi.
The problem is the namespace, and you might need to file a bug and discuss it with the developers. If you want to avoid this problem and are ready to go with a workaround, just create a mini glib.vapi GLib namespace, where you bind only the DestroyNotify() and g_free() (binding to libc/posix free).
I would think that sqlite3 should not use GLib, but rather libc/posix, so you should be fine by modifying only posix.vapi and sqlite3.vapi and filing a bug with your patch (awesome, a contrib!).
Note that classes are unavailable under the POSIX profile, as Vala requires a support library (i.e. GLib, Dova) to support those features. Jürg Billeter has acknowledged that support for the POSIX profile is experimental and limited:
https://bugzilla.gnome.org/show_bug.cgi?id=618348
The only way you have is re-writing the sqlite VAPI (or just the classes/methods you need) making them posix friendly (but I guess you can't use classes in that way).
if the vapi for sqlite depends on glib you could just write your own or use the sqlite c code with c and just make some extern statements for the functions you need. for example i made a tool wich mixes vala and c for linux pure c for win32 and objective c and c for mac
https://github.com/boscowitch/wadoku-notify
i just added the 2 functions i need at the beginning of my vala app like this:
extern void init_db(char * path,bool mm);
extern void lookup(char * str);
i added the whole sqlite source cause i needed to activate full text indexing and change a bit in the code and in the beginning of vala there was no sqlite vapi
I want to investigate how to access SQLite DB from SAS. What's the easiest way of doing this? Is there a SAS product that we can license to do that? I don't want to use ODBC drivers as that seems to have been written a long time ago and is not officially part of SQLite.
SAS supports reading data from pipes (in a unix environment). Essentially, you can set up a filename statement to execute an sqlite command in the host environment, then process the command output as if reading it from a text file.
SAS Support page: http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#pipe.htm
Example:
*----------------------------------------------
* (1) Write a command in place of the file path
* --> important: the 'pipe' option makes this work
*----------------------------------------------;
filename QUERY pipe 'sqlite3 database_file "select * from table_name"';
*----------------------------------------------
* (2) Use a datastep to read the output from sqlite
*----------------------------------------------;
options linesize=max; *to prevent truncation of results;
data table_name;
infile QUERY delimiter='|' missover dsd lrecl=32767;
length
numeric_id 8
numeric_field 8
character_field_1 $40
character_field_2 $20
wide_character_field $500
;
input
numeric_id
numeric_field $
character_field_1 $
character_field_2 $
wide_character_field $
;
run;
*----------------------------------------------
* (3) View the results, process data etc.
*----------------------------------------------;
proc contents;
proc means;
proc print;
run;