Re: [sqlite] How preserve the string metric in an extension.

2014-09-20 Thread Andrea Peri
Hi, I resolve the bug. Thx for explanations. Effectively the proble was that the documentation dont explain very well why is needed to call a sqlite3_value_text. The only obvious explanation is that it is changed, but never say about what is this changed, neither is report what transformation

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Scott Robison
On Fri, Sep 19, 2014 at 8:53 PM, Keith Medcalf wrote: > >Please carefully re-read my comment: 'defined as "char**" or equivalent'. > >"char** argv" is the same as "char* argv[]" in every way except for > >spelling. > > but char** is not equivalent to sqlite_value** and a

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Keith Medcalf
>> There is no magic associated with a symbol name in C -- it is simply >> what you chose to call it. Just because you chose to call something >>"argc" does not mean that it is a count of anything (much less a count >>of arguments), nor even that it is a default width integer; nor does

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Scott Robison
On Fri, Sep 19, 2014 at 5:56 PM, Keith Medcalf wrote: > > >While you are correct that the action is "nonsensical" based on the > >definition of the API, surely you can concede that in an environment (C > >programming) where "argv" is an intrinsic part of every program thanks

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Igor Tandetnik
On 9/19/2014 7:56 PM, Keith Medcalf wrote: the actual type of the argument strings passed to the main function of a C program is char*[], not char** It's valid either way. C99 6.7.5.3/7 A declaration of a parameter as "array of type" shall be adjusted to "qualified pointer to type"... And

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Keith Medcalf
>While you are correct that the action is "nonsensical" based on the >definition of the API, surely you can concede that in an environment (C >programming) where "argv" is an intrinsic part of every program thanks to >that name's standard use as a parameter to main But that is because you

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Scott Robison
On Fri, Sep 19, 2014 at 3:08 PM, Igor Tandetnik wrote: > On 9/19/2014 4:36 PM, Andrea Peri wrote: > >> >> I don't understand why this difference >> > > I don't understand why you expected there to *not* be a difference between > a program that performs a nonsensical action,

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Igor Tandetnik
On 9/19/2014 4:36 PM, Andrea Peri wrote: printf("%s",argv[0]); argv[0] is sqlite_value*, not a char*. It's not a pointer to a NUL-terminated string, which is what %s format specifier expects. Instead If I use this other printf("%s",sqlite3_value_text(argv[0])); I have correctly "aaa"

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Andrea Peri
Hi, thx for clarification. I do no change UTF8-UTF16 (I hope). I was guessing the sqlite3_value_text was changing because I does this simple test: try-ing passing "aaa" to the function and try-ing a printf("%s",argv[0]); inside the function I have on stdout something like: "P^. " Instead

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Richard Hipp
On Fri, Sep 19, 2014 at 4:22 PM, Andrea Peri wrote: > Hi, > I'm trying to implement a sqlite extension using some string metric > algorithms. > > My goal is to compare two strings and retrieve the metric. > > I understand that to use the argv[0] and argv[1] args inside an >