Re: [sqlite] Bug: incorrect forward declaration ofsqlite3_win32_sleep

2012-06-18 Thread Joe Mistachkin

Roger Binns wrote:
>
> The change looks okay on eyeballing it, but I do still question this
> symbol being exported SQLite API and undocumented.  There is already a
> sqlite3_sleep. 
> 

The new function is unsupported; however, it is required from places in
the testing infrastructure where the sqlite3_sleep function cannot be
called for one reason or another (e.g. there is no VFS yet).

--
Joe Mistachkin

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


Re: [sqlite] Bug: incorrect forward declaration of sqlite3_win32_sleep

2012-06-18 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 18/06/12 14:16, Roger Binns wrote:
> I'll be able to check this evening (it is considerably harder for me
> to test on Windows than other platforms).

I failed trying to test, as everything kept going wrong and it would
require substantial surgery to my build system for Windows which only
works well with official releases.

The change looks okay on eyeballing it, but I do still question this
symbol being exported SQLite API and undocumented.  There is already a
sqlite3_sleep.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk/gDv8ACgkQmOOfHg372QTHSACgzwRZBHsqer+aT0EBmzLNkkE7
YI8An3+gI0YIyVm0aWGb9mmZsJwbX2pD
=8ODK
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Odd insertion error FTS4 + ICU

2012-06-18 Thread E. Timothy Uy
Dear Dan,

With the change from U8_NEXT to U16_NEXT, I am able to insert 一日耶羅波安出. I
was also able to insert the rest of the data set (about 31000 more rows
containing both traditional and simplified Chinese). Is this an ICU error?
Seems like everything should be using U8_ in the tokenizer.

Thank you much.

Respectfully,
Tim


On Mon, Jun 18, 2012 at 2:20 PM, E. Timothy Uy  wrote:

> I'll take a look right now. Though my first thought was if you change
> U8_NEXT to U16_NEXT, wouldn't you have to change it everywhere else?  I
> recompiled ICU with U_CHARSET_IS_UTF8 earlier and this did not help.
>
>
> On Mon, Jun 18, 2012 at 2:06 PM, Dan Kennedy wrote:
>
>> On 06/19/2012 03:39 AM, E. Timothy Uy wrote:
>> > If anyone can unravel this mystery, it would be much appreciated. For
>> now,
>> > I inserted a comma - 一日、耶羅波安出 and it works. I suspect it must be somehow
>> > that the sequence of bytes encodes another character, which throws the
>> > tokenizer out of whack or maybe the fts4aux table.
>>
>> Can you try with this:
>>
>>  http://www.sqlite.org/src/info/892b74116a
>>
>> Thanks.
>> ___
>> 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] Odd insertion error FTS4 + ICU

2012-06-18 Thread E. Timothy Uy
I'll take a look right now. Though my first thought was if you change
U8_NEXT to U16_NEXT, wouldn't you have to change it everywhere else?  I
recompiled ICU with U_CHARSET_IS_UTF8 earlier and this did not help.

On Mon, Jun 18, 2012 at 2:06 PM, Dan Kennedy  wrote:

> On 06/19/2012 03:39 AM, E. Timothy Uy wrote:
> > If anyone can unravel this mystery, it would be much appreciated. For
> now,
> > I inserted a comma - 一日、耶羅波安出 and it works. I suspect it must be somehow
> > that the sequence of bytes encodes another character, which throws the
> > tokenizer out of whack or maybe the fts4aux table.
>
> Can you try with this:
>
>  http://www.sqlite.org/src/info/892b74116a
>
> Thanks.
> ___
> 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] insert in db

2012-06-18 Thread Igor Tandetnik

On 6/18/2012 4:53 PM, deltagam...@gmx.net wrote:

BTW, if i go through the programm with the debugger, there is nothing
written in the sqlitedb.
Why ?
Im using mscv 2010


Something is written to the DB, but to a different one from the one you 
are looking at. You are using a relative path to the DB file, which 
means it's relative to the current working directory. Unless you 
explicitly specify otherwise in project settings, the current working 
directory is different when starting the program under debugger vs. when 
you start it without.


I predict you'll find two files named ah.db in two different directories.
--
Igor Tandetnik

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


Re: [sqlite] Bug: incorrect forward declaration of sqlite3_win32_sleep

2012-06-18 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 18/06/12 10:25, Joe Mistachkin wrote:
> 
> The previous check-in should have cleared the compilation error you 
> reported (?); however, I've made another change which should produce 
> the desired effects:
> 
> https://www.sqlite.org/src/info/21266c68af

I'll be able to check this evening (it is considerably harder for me to
test on Windows than other platforms).

However I'll note that sqlite3_win32_sleep really should be private as it
isn't documented as part of the SQLite API:

  https://www.sqlite.org/c3ref/funclist.html

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk/fmroACgkQmOOfHg372QRAtwCeI7S0Orr8ue5rE2fVbn6Q2Eck
1IoAnjUok2LsIz7LGVR9NzF1EnMbNU36
=iZnN
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Odd insertion error FTS4 + ICU

2012-06-18 Thread Dan Kennedy
On 06/19/2012 03:39 AM, E. Timothy Uy wrote:
> If anyone can unravel this mystery, it would be much appreciated. For now,
> I inserted a comma - 一日、耶羅波安出 and it works. I suspect it must be somehow
> that the sequence of bytes encodes another character, which throws the
> tokenizer out of whack or maybe the fts4aux table.

Can you try with this:

  http://www.sqlite.org/src/info/892b74116a

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


Re: [sqlite] insert in db

2012-06-18 Thread deltagam...@gmx.net

Am 18.06.2012 22:31, schrieb Pavel Ivanov:

rc = sqlite3_bind_text(insert_stmt, 1, eventtype, sizeof(eventtype),
NULL);

You measure size of pointer eventtype here. If you want to know size
of the string it points to you need to call strlen(eventtype) instead
of sizeof(eventtype).


Pavel


On Mon, Jun 18, 2012 at 4:26 PM, deltagam...@gmx.net
  wrote:

I defined in main()  my char intype[]="chattinges";
and call the insert_in_db  with insert_in_db(intype, 7);
but in the db is written only chat instead of chattings.
Where is the problem ?


void insert_in_db(char const *eventtype, int zaehler) {

int rc;
char *exec_errmsg;

const char dbname[] = "ah.db";

sqlite3 *db = NULL;



rc = sqlite3_open(dbname,);
if(SQLITE_OK != rc) {
fprintf(stderr, "Can't open database %s (%i): %s\n", dbname, rc,
sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}


const char insert_sql[] = "INSERT INTO eventlog (eventtype, counter)
VALUES (?,?)";
sqlite3_stmt *insert_stmt = NULL;



rc = sqlite3_prepare_v2(db, insert_sql, -1,_stmt, NULL);
if(SQLITE_OK != rc) {
fprintf(stderr, "Can't prepare insert statment %s (%i): %s\n",
insert_sql, rc, sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}



char injectionattack[] =  "contering";
// The NULL is "Don't attempt to free() the value when it's bound", since
it's on the stack here
//rc = sqlite3_bind_text(insert_stmt, 1, injectionattack,
sizeof(injectionattack), NULL);
rc = sqlite3_bind_text(insert_stmt, 1, eventtype, sizeof(eventtype),
NULL);


if(SQLITE_OK != rc) {
fprintf(stderr, "Error binding value in insert (%i): %s\n", rc,
sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
} else {
printf("Successfully bound string for insert: '%s'\n", eventtype);
}


//double realvalue = 3.14159;
//int realvalue = 3;

//rc = sqlite3_bind_double(insert_stmt, 2, realvalue);
rc = sqlite3_bind_int(insert_stmt, 2, zaehler);

if(SQLITE_OK != rc) {
fprintf(stderr, "Error binding value in insert (%i): %s\n", rc,
sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
} else {
printf("Successfully bound real for insert: %d\n", zaehler);
}


rc = sqlite3_step(insert_stmt);
if(SQLITE_DONE != rc) {
fprintf(stderr, "insert statement didn't return DONE (%i): %s\n", rc,
sqlite3_errmsg(db));
} else {
printf("INSERT completed\n\n");
}

sqlite3_finalize(insert_stmt);

sqlite3_close(db);

};


int main() {

char intype[]="chattinges";

cout<<  endl;

// Create an in-memory database
//const char dbname[] = ":memory:";
const char dbname[] = "ah.db";

// Actual database handle
sqlite3 *db = NULL;

// Database commands
const char create_sql[] = "CREATE TABLE eventlog ("
"id INTEGER PRIMARY KEY,"
"eventdate datetime default current_timestamp"
"eventtype TEXT,"
"counter INTEGER"
")";

// SQLite return value
int rc;

// Open the database
rc = sqlite3_open(dbname,);
if(SQLITE_OK != rc) {
fprintf(stderr, "Can't open database %s (%i): %s\n", dbname, rc,
sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}


// SQLite exec returns errors with this
char *exec_errmsg;

// Use exec to run simple statements that can only fail/succeed
rc = sqlite3_exec(db, create_sql, NULL, NULL,_errmsg);
if(SQLITE_OK != rc) {
fprintf(stderr, "Error creating table (%i): %s\n", rc, exec_errmsg);
sqlite3_free(exec_errmsg);
sqlite3_close(db);
//exit(1);
}


sqlite3_close(db);

insert_in_db(intype, 7);

exit(0);


sqlite3_close(db);
return 0;
}

___
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

Thx Pavel Ivanov,
I additional missed the ; at the end of the line  rc = 
sqlite3_bind_text(insert_stmt, 1, eventtype, strlen(eventtype), NULL);
BTW, if i go through the programm with the debugger, there is nothing 
written in the sqlitedb.

Why ?
Im using mscv 2010


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


Re: [sqlite] Odd insertion error FTS4 + ICU

2012-06-18 Thread E. Timothy Uy
If anyone can unravel this mystery, it would be much appreciated. For now,
I inserted a comma - 一日、耶羅波安出 and it works. I suspect it must be somehow
that the sequence of bytes encodes another character, which throws the
tokenizer out of whack or maybe the fts4aux table.

一
19968
%E4%B8%80
日
26085
%E6%97%A5
耶
32822
%E8%80%B6
羅
32645
%E7%BE%85
波
27874
%E6%B3%A2
安
23433
%E5%AE%89
出
20986
%E5%87%BA


On Mon, Jun 18, 2012 at 12:59 PM, E. Timothy Uy  wrote:

> Thanks for writing back Dan. Using charCodeAt() in Javascript, I have the
> following for 一日耶羅波安出:
>
> 19968
> 26085
> 32822
> 32645
> 27874
> 23433
> 20986
>
> I tried entering subsets of the data:
>
> 一日耶羅波安出 - Error: SQL logic error or missing database <-- target
> 一日耶羅波安 - Ok
> 日耶羅波安出 - Ok
> 耶羅波安出 - Ok
> 一日耶羅波安出x - Error: SQL logic error or missing database
> 一日耶羅波安x出 - Error: SQL logic error or missing database
> 一日耶羅波x安出 - Error: SQL logic error or missing database
> 一日耶羅x波安出 - Ok
> 一日耶x羅波安出 - Ok
> 一日x耶羅波安出 - Ok
> 一x日耶羅波安出 - Ok
> x一日耶羅波安出 - Ok
>
> I'm a bit concerned that this might be an indicator for a deeper issue.
> Running Ubuntu Linux x64.
>
> Respectfully,
> Tim
>
>
> On Mon, Jun 18, 2012 at 12:29 PM, Dan Kennedy wrote:
>
>> On 06/19/2012 02:11 AM, E. Timothy Uy wrote:
>> > I recompiled ICU using U_CHARSET_IS_UTF8 and the error persists.
>> >
>> > On Mon, Jun 18, 2012 at 11:45 AM, E. Timothy Uy  wrote:
>> >
>> >> Hopefully someone has some insight on this. I am using FTS4 with
>> >> tokenize=icu (and PRAGMA encoding="UTF-8"). I'm getting getting an
>> error
>> >> inserting the following into my virtual table:
>> >>
>> >> 一日耶羅波安出
>>
>> Can you post the list of codepoints in this text? Or the hex
>> of the utf-16 or utf-8 encoding of the same?
>> ___
>> 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] insert in db

2012-06-18 Thread Pavel Ivanov
>    rc = sqlite3_bind_text(insert_stmt, 1, eventtype, sizeof(eventtype),
> NULL);

You measure size of pointer eventtype here. If you want to know size
of the string it points to you need to call strlen(eventtype) instead
of sizeof(eventtype).


Pavel


On Mon, Jun 18, 2012 at 4:26 PM, deltagam...@gmx.net
 wrote:
> I defined in main()  my char intype[]="chattinges";
> and call the insert_in_db  with insert_in_db(intype, 7);
> but in the db is written only chat instead of chattings.
> Where is the problem ?
>
>
> void insert_in_db(char const *eventtype, int zaehler) {
>
>    int rc;
>    char *exec_errmsg;
>
>    const char dbname[] = "ah.db";
>
>    sqlite3 *db = NULL;
>
>
>
>    rc = sqlite3_open(dbname, );
>    if(SQLITE_OK != rc) {
>        fprintf(stderr, "Can't open database %s (%i): %s\n", dbname, rc,
> sqlite3_errmsg(db));
>        sqlite3_close(db);
>        exit(1);
>    }
>
>
>    const char insert_sql[] = "INSERT INTO eventlog (eventtype, counter)
> VALUES (?,?)";
>    sqlite3_stmt *insert_stmt = NULL;
>
>
>
>    rc = sqlite3_prepare_v2(db, insert_sql, -1, _stmt, NULL);
>    if(SQLITE_OK != rc) {
>        fprintf(stderr, "Can't prepare insert statment %s (%i): %s\n",
> insert_sql, rc, sqlite3_errmsg(db));
>        sqlite3_close(db);
>        exit(1);
>    }
>
>
>
>    char injectionattack[] =  "contering";
>    // The NULL is "Don't attempt to free() the value when it's bound", since
> it's on the stack here
>    //rc = sqlite3_bind_text(insert_stmt, 1, injectionattack,
> sizeof(injectionattack), NULL);
>    rc = sqlite3_bind_text(insert_stmt, 1, eventtype, sizeof(eventtype),
> NULL);
>
>
>    if(SQLITE_OK != rc) {
>        fprintf(stderr, "Error binding value in insert (%i): %s\n", rc,
> sqlite3_errmsg(db));
>        sqlite3_close(db);
>        exit(1);
>    } else {
>        printf("Successfully bound string for insert: '%s'\n", eventtype);
>    }
>
>
>    //double realvalue = 3.14159;
>    //int realvalue = 3;
>
>    //rc = sqlite3_bind_double(insert_stmt, 2, realvalue);
>    rc = sqlite3_bind_int(insert_stmt, 2, zaehler);
>
>    if(SQLITE_OK != rc) {
>        fprintf(stderr, "Error binding value in insert (%i): %s\n", rc,
> sqlite3_errmsg(db));
>        sqlite3_close(db);
>        exit(1);
>    } else {
>        printf("Successfully bound real for insert: %d\n", zaehler);
>    }
>
>
>    rc = sqlite3_step(insert_stmt);
>    if(SQLITE_DONE != rc) {
>        fprintf(stderr, "insert statement didn't return DONE (%i): %s\n", rc,
> sqlite3_errmsg(db));
>    } else {
>        printf("INSERT completed\n\n");
>    }
>
>    sqlite3_finalize(insert_stmt);
>
>    sqlite3_close(db);
>
> };
>
>
> int main() {
>
>    char intype[]="chattinges";
>
>    cout << endl;
>
>    // Create an in-memory database
>    //const char dbname[] = ":memory:";
>    const char dbname[] = "ah.db";
>
>    // Actual database handle
>    sqlite3 *db = NULL;
>
>    // Database commands
>    const char create_sql[] = "CREATE TABLE eventlog ("
>            "id INTEGER PRIMARY KEY,"
>            "eventdate datetime default current_timestamp"
>            "eventtype TEXT,"
>            "counter INTEGER"
>            ")";
>
>    // SQLite return value
>    int rc;
>
>    // Open the database
>    rc = sqlite3_open(dbname, );
>    if(SQLITE_OK != rc) {
>        fprintf(stderr, "Can't open database %s (%i): %s\n", dbname, rc,
> sqlite3_errmsg(db));
>        sqlite3_close(db);
>        exit(1);
>    }
>
>
>    // SQLite exec returns errors with this
>    char *exec_errmsg;
>
>    // Use exec to run simple statements that can only fail/succeed
>    rc = sqlite3_exec(db, create_sql, NULL, NULL, _errmsg);
>    if(SQLITE_OK != rc) {
>        fprintf(stderr, "Error creating table (%i): %s\n", rc, exec_errmsg);
>        sqlite3_free(exec_errmsg);
>        sqlite3_close(db);
>        //exit(1);
>    }
>
>
>    sqlite3_close(db);
>
>    insert_in_db(intype, 7);
>
>    exit(0);
>
>
>    sqlite3_close(db);
>    return 0;
> }
>
> ___
> 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] insert in db

2012-06-18 Thread deltagam...@gmx.net

I defined in main()  my char intype[]="chattinges";
and call the insert_in_db  with insert_in_db(intype, 7);
but in the db is written only chat instead of chattings.
Where is the problem ?


void insert_in_db(char const *eventtype, int zaehler) {

int rc;
char *exec_errmsg;

const char dbname[] = "ah.db";

sqlite3 *db = NULL;



rc = sqlite3_open(dbname, );
if(SQLITE_OK != rc) {
fprintf(stderr, "Can't open database %s (%i): %s\n", dbname, 
rc, sqlite3_errmsg(db));

sqlite3_close(db);
exit(1);
}


const char insert_sql[] = "INSERT INTO eventlog (eventtype, 
counter) VALUES (?,?)";

sqlite3_stmt *insert_stmt = NULL;



rc = sqlite3_prepare_v2(db, insert_sql, -1, _stmt, NULL);
if(SQLITE_OK != rc) {
fprintf(stderr, "Can't prepare insert statment %s (%i): %s\n", 
insert_sql, rc, sqlite3_errmsg(db));

sqlite3_close(db);
exit(1);
}



char injectionattack[] =  "contering";
// The NULL is "Don't attempt to free() the value when it's bound", 
since it's on the stack here
//rc = sqlite3_bind_text(insert_stmt, 1, injectionattack, 
sizeof(injectionattack), NULL);
rc = sqlite3_bind_text(insert_stmt, 1, eventtype, 
sizeof(eventtype), NULL);



if(SQLITE_OK != rc) {
fprintf(stderr, "Error binding value in insert (%i): %s\n", rc, 
sqlite3_errmsg(db));

sqlite3_close(db);
exit(1);
} else {
printf("Successfully bound string for insert: '%s'\n", eventtype);
}


//double realvalue = 3.14159;
//int realvalue = 3;

//rc = sqlite3_bind_double(insert_stmt, 2, realvalue);
rc = sqlite3_bind_int(insert_stmt, 2, zaehler);

if(SQLITE_OK != rc) {
fprintf(stderr, "Error binding value in insert (%i): %s\n", rc, 
sqlite3_errmsg(db));

sqlite3_close(db);
exit(1);
} else {
printf("Successfully bound real for insert: %d\n", zaehler);
}


rc = sqlite3_step(insert_stmt);
if(SQLITE_DONE != rc) {
fprintf(stderr, "insert statement didn't return DONE (%i): 
%s\n", rc, sqlite3_errmsg(db));

} else {
printf("INSERT completed\n\n");
}

sqlite3_finalize(insert_stmt);

sqlite3_close(db);

};


int main() {

char intype[]="chattinges";

cout << endl;

// Create an in-memory database
//const char dbname[] = ":memory:";
const char dbname[] = "ah.db";

// Actual database handle
sqlite3 *db = NULL;

// Database commands
const char create_sql[] = "CREATE TABLE eventlog ("
"id INTEGER PRIMARY KEY,"
"eventdate datetime default current_timestamp"
"eventtype TEXT,"
"counter INTEGER"
")";

// SQLite return value
int rc;

// Open the database
rc = sqlite3_open(dbname, );
if(SQLITE_OK != rc) {
fprintf(stderr, "Can't open database %s (%i): %s\n", dbname, 
rc, sqlite3_errmsg(db));

sqlite3_close(db);
exit(1);
}


// SQLite exec returns errors with this
char *exec_errmsg;

// Use exec to run simple statements that can only fail/succeed
rc = sqlite3_exec(db, create_sql, NULL, NULL, _errmsg);
if(SQLITE_OK != rc) {
fprintf(stderr, "Error creating table (%i): %s\n", rc, 
exec_errmsg);

sqlite3_free(exec_errmsg);
sqlite3_close(db);
//exit(1);
}


sqlite3_close(db);

insert_in_db(intype, 7);

exit(0);


sqlite3_close(db);
return 0;
}

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


Re: [sqlite] Odd insertion error FTS4 + ICU

2012-06-18 Thread E. Timothy Uy
Thanks for writing back Dan. Using charCodeAt() in Javascript, I have the
following for 一日耶羅波安出:

19968
26085
32822
32645
27874
23433
20986

I tried entering subsets of the data:

一日耶羅波安出 - Error: SQL logic error or missing database <-- target
一日耶羅波安 - Ok
日耶羅波安出 - Ok
耶羅波安出 - Ok
一日耶羅波安出x - Error: SQL logic error or missing database
一日耶羅波安x出 - Error: SQL logic error or missing database
一日耶羅波x安出 - Error: SQL logic error or missing database
一日耶羅x波安出 - Ok
一日耶x羅波安出 - Ok
一日x耶羅波安出 - Ok
一x日耶羅波安出 - Ok
x一日耶羅波安出 - Ok

I'm a bit concerned that this might be an indicator for a deeper issue.
Running Ubuntu Linux x64.

Respectfully,
Tim


On Mon, Jun 18, 2012 at 12:29 PM, Dan Kennedy  wrote:

> On 06/19/2012 02:11 AM, E. Timothy Uy wrote:
> > I recompiled ICU using U_CHARSET_IS_UTF8 and the error persists.
> >
> > On Mon, Jun 18, 2012 at 11:45 AM, E. Timothy Uy  wrote:
> >
> >> Hopefully someone has some insight on this. I am using FTS4 with
> >> tokenize=icu (and PRAGMA encoding="UTF-8"). I'm getting getting an error
> >> inserting the following into my virtual table:
> >>
> >> 一日耶羅波安出
>
> Can you post the list of codepoints in this text? Or the hex
> of the utf-16 or utf-8 encoding of the same?
> ___
> 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] Odd insertion error FTS4 + ICU

2012-06-18 Thread Dan Kennedy
On 06/19/2012 02:11 AM, E. Timothy Uy wrote:
> I recompiled ICU using U_CHARSET_IS_UTF8 and the error persists.
> 
> On Mon, Jun 18, 2012 at 11:45 AM, E. Timothy Uy  wrote:
> 
>> Hopefully someone has some insight on this. I am using FTS4 with
>> tokenize=icu (and PRAGMA encoding="UTF-8"). I'm getting getting an error
>> inserting the following into my virtual table:
>>
>> 一日耶羅波安出

Can you post the list of codepoints in this text? Or the hex
of the utf-16 or utf-8 encoding of the same?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Building an fts Query for Double Quote

2012-06-18 Thread Carl Desautels
On Mon, Jun 18, 2012 at 12:57 PM, Richard Hipp  wrote:

> Double-quote is syntactically significant to FTS3 - it delimits two or more
> word in a phrase search.  You cannot search for words that contain
> double-quote using FTS3.
>

Thank you

-- 
Carlin W. Desautels
Research Assistant
Seneca's Centre for Development of Open Technology
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Odd insertion error FTS4 + ICU

2012-06-18 Thread E. Timothy Uy
I recompiled ICU using U_CHARSET_IS_UTF8 and the error persists.

On Mon, Jun 18, 2012 at 11:45 AM, E. Timothy Uy  wrote:

> Hopefully someone has some insight on this. I am using FTS4 with
> tokenize=icu (and PRAGMA encoding="UTF-8"). I'm getting getting an error
> inserting the following into my virtual table:
>
> 一日耶羅波安出
>
> If I add a byte to the front, lets say "|", it works. If I delete the
> first character, or delete the last, it works too. If I add more
> characters, it doesn't work. Seems like it is an encoding issue, and I
> wonder if it isn't because ICU is using UTF-16 internally.  This is a
> 1/31000 problem but aggravating nonetheless. If I don't use tokenize=icu it
> works.
>
> The error is SQLITE_ERROR: SQL logic error or missing database.
>
> Respectfully,
> Tim
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Odd insertion error FTS4 + ICU

2012-06-18 Thread E. Timothy Uy
Hopefully someone has some insight on this. I am using FTS4 with
tokenize=icu (and PRAGMA encoding="UTF-8"). I'm getting getting an error
inserting the following into my virtual table:

一日耶羅波安出

If I add a byte to the front, lets say "|", it works. If I delete the first
character, or delete the last, it works too. If I add more characters, it
doesn't work. Seems like it is an encoding issue, and I wonder if it isn't
because ICU is using UTF-16 internally.  This is a 1/31000 problem but
aggravating nonetheless. If I don't use tokenize=icu it works.

The error is SQLITE_ERROR: SQL logic error or missing database.

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


Re: [sqlite] Bug: incorrect forward declaration of sqlite3_win32_sleep

2012-06-18 Thread Joe Mistachkin

The previous check-in should have cleared the compilation error you
reported (?); however, I've made another change which should produce
the desired effects:

https://www.sqlite.org/src/info/21266c68af 

--
Joe Mistachkin

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


Re: [sqlite] escaping GLOB pattern

2012-06-18 Thread Yuriy Kaminskiy
Richard Hipp wrote:
> On Mon, Jun 18, 2012 at 3:34 AM, Baruch Burstein wrote:
> 
>> Is there a built-in way to escape a GLOB pattern? Will it escape it if I
>> bind it to a parameter in a prepared function instead of embedding it
>> directly in the query string?

no, sqlite3_bind* won't escape glob/like/regexp metacharacters in parameters.

> What do you mean by "escape a GLOB pattern"?

Not an OP, but I'd guess "escape all wildcard characters in string so that it
only match bare string by GLOB". So that e.g. "foo GLOB escape_glob(?)" is
exactly same as "foo = ?".
Of course case above is redundant (just use "="), but it could be useful in more
complex cases, like
   SELECT * FROM t WHERE foo GLOB (escape_glob(?)||'*[a-z]');

(Note: fictional example, there are no escape_glob() function in sqlite 
currently).

(Note: currently sqlite cannot use index with pattern computed in complex
expression [e.g. "foo GLOB (escape_glob(?)||'*')"]; but it /can/ use index in
"foo GLOB ?" when pattern in parameter have prefix match - so if you need
efficiency and your pattern may contain prefix matches, you should compute
pattern [escape, concatenate,...] in C code, not in SQL).

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


Re: [sqlite] Building an fts Query for Double Quote

2012-06-18 Thread Richard Hipp
On Mon, Jun 18, 2012 at 12:10 PM, Carl Desautels <
carlin.desaut...@senecacollege.ca> wrote:

> Hi,
>
> I'm using SQLite 3.7.12 and I'm trying to build an fts phrase query to
> match a string containing a double-quote.
>

Double-quote is syntactically significant to FTS3 - it delimits two or more
word in a phrase search.  You cannot search for words that contain
double-quote using FTS3.


>
> Given the table created by the following commands:
>
>   - create virtual table tbl using fts4(txt);
>   - insert into tbl values ('quot"ed'), ('quoted');
>
> I have tried to search for "quot"ed" in the following ways and provided
> their respective errors:
>
>   - match('"*\"*"')
>  - Error: malformed MATCH expression: ["*\"*"]
>  - match('"*"*"')
>  - Error: malformed MATCH expression: ["*"*"]
>   - match('"*\\"*"')
>  - Error: malformed MATCH expression: ["*\\"*"]
>   - match('"*\\\"*"')
>  - Error: malformed MATCH expression: ["*\\\"*"]
>
> --
> Carlin W. Desautels
> Research Assistant
> Seneca's Centre for Development of Open Technology
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] Bug: incorrect forward declaration of sqlite3_win32_sleep

2012-06-18 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 18/06/12 01:03, Joe Mistachkin wrote:
> Could you try using the code in the "compiler-compat" branch and see if
> the problem clears?

The fix in this changeset is not a fix:

  http://www.sqlite.org/src/info/f970a3de61fe2ebaf1778c4a3383cfdc52299162

If you replace the extern with SQLITE_API then it will be correct.  Note
that it is possible to compile the amalgamation with SQLITE_API set to
static and with some trailing code to access SQLite.  Doing so means that
none of the SQLite symbols are exposed in the rest of the app/dll and
hence won't clash with any other versions of SQLite that may end up being
loaded or referenced.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk/fV34ACgkQmOOfHg372QTLRQCgitnrpy80qcnzII8CSOGOlz+7
qw8AoM8akEVowzhB9kqBKbTon0i/ZooE
=R3tj
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Insert and select date and time

2012-06-18 Thread Igor Tandetnik

On 6/18/2012 12:02 PM, deltagam...@gmx.net wrote:

Now the question, is it ok to use the sqlite3 DATETIME('now') function
to store the
data in sqlite and "parse/split" it when it is retrieved from the GUI
into date and time part ?


I don't see why not.


In this case I thought of a trigger to fill the db automatically
-- 
CREATE TRIGGER insert_t1_timestamp AFTER  INSERT ON t1
BEGIN
  UPDATE t1 SET timestamp = DATETIME('NOW')  WHERE rowid = new.rowid;
END;
-- 


Just put "DEFAULT CURRENT_TIMESTAMP" clause on timestamp column in 
CREATE TABLE. You don't need any triggers.



If I dont use the trigger, would I comitt a string to my timestamp column ?


I'm not sure I understand the question. Note that DATETIME('NOW') 
actually produces a string. SQLite doesn't have a dedicated type for 
dates, times or timestamps.



Has someone an example ?


An example of what?


And the other way, if I select from the db, how to I get the timestamp
in the
c++ prog ?


The same way you retrive the value from any other column. I'm not sure I 
understand the nature of the problem.

--
Igor Tandetnik

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


[sqlite] Building an fts Query for Double Quote

2012-06-18 Thread Carl Desautels
Hi,

I'm using SQLite 3.7.12 and I'm trying to build an fts phrase query to
match a string containing a double-quote.

Given the table created by the following commands:

   - create virtual table tbl using fts4(txt);
   - insert into tbl values ('quot"ed'), ('quoted');

I have tried to search for "quot"ed" in the following ways and provided
their respective errors:

   - match('"*\"*"')
  - Error: malformed MATCH expression: ["*\"*"]
  - match('"*"*"')
  - Error: malformed MATCH expression: ["*"*"]
   - match('"*\\"*"')
  - Error: malformed MATCH expression: ["*\\"*"]
   - match('"*\\\"*"')
  - Error: malformed MATCH expression: ["*\\\"*"]

-- 
Carlin W. Desautels
Research Assistant
Seneca's Centre for Development of Open Technology
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Insert and select date and time

2012-06-18 Thread deltagam...@gmx.net

In the GUI I have an calendar element.
Later in the GUI the date-boundaries should be choosen with the calendar 
element, to show the report

only for this timeframe.
In a "report window" date and time are 2 different columns.
The data itself is determined from another c++ programm and written in a 
sqlite3 db.


Now the question, is it ok to use the sqlite3 DATETIME('now') function 
to store the
data in sqlite and "parse/split" it when it is retrieved from the GUI 
into date and time part ?

In this case I thought of a trigger to fill the db automatically
-- 
CREATE TRIGGER insert_t1_timestamp AFTER  INSERT ON t1
BEGIN
 UPDATE t1 SET timestamp = DATETIME('NOW')  WHERE rowid = new.rowid;
END;
-- 
If I dont use the trigger, would I comitt a string to my timestamp column ?
Has someone an example ?
And the other way, if I select from the db, how to I get the timestamp 
in the

c++ prog ?

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


[sqlite] Wierd behavior of sqlite trigger with DBI

2012-06-18 Thread Prashant Tekriwal
Hi,

 

I am facing a very weird issue with SQLite's triggers.

 

I have a database having two tables whose schema is defined below:

 

create table table1 ( id integer primary key );

 

insert into table1 values (-1);

 

create table table2 (

 id integer primary key,

 no integer,

 hidden integer,

 start_time integer

);

 

I have the following 'AFTER INSERT' trigger that updates 3 fields of the
table using an update statement:

 

create trigger set_id_and_no_table2 after insert on table2

where no = -1 and hidden = 1

begin

update table1 set id = id + 1;

update table2 set id = (select id from table1), no = (select id from
table1), start_time = strftime('%s', 'now') where id = -1;

end;

 

I have a perl script that inserts the record in the table2.

 

use DBI;

 

$dbh = DBI->connect('dbi:SQLite:records', '', '');

 

$dbh->do('insert into table2(id, no, hidden) values (-1,   -1,  1)');

 

 

Now when I execute this script, this is what I get when I query the 'table2'
table.

 

#perl insert_record.pl

 

#sqlite3 records

SQLite version 3.3.13

Enter ".help" for instructions

sqlite> select * from table2;

0|-1|1|1340038692  <- Here the value should be 0 instead of -1 in
second column

 

Another insert into table,

 

#perl insert_record.pl

 

#sqlite3 records

SQLite version 3.3.13

Enter ".help" for instructions

sqlite> select * from table2;

0|-1|1|1340038692  <- Here the value should be 0 instead of -1 in
second column

1|-1|1|1340038723  <- Here the value should be 1 instead of -1 in
second column

 

The problem above is that the trigger is updating only fields id and
start_time of the table 'table2' whereas its not able to update 'no' field,
its always '-1'.

 

 

Now to add to the weirdness, if I insert a record in table2 using sqlite
prompt, then the 'no' field is also getting updated.

 

#sqlite3 records

SQLite version 3.3.13

Enter ".help" for instructions

sqlite> insert into table2(id, no, hidden) values (-1,   -1,  1);

sqlite> select * from table2;

0|-1|1|1340038692

1|-1|1|1340038723

2|2|1|1340038789   <- Here the value is correct i.e. 2 in the second
column

 

Any idea what could be wrong here.

 

I am really stuck due to this.

 

Thanks,

Prashant

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


Re: [sqlite] C++ programming - int sqlite3_prepare_v2() question

2012-06-18 Thread Igor Tandetnik
Arbol One  wrote:
> Continuing with the questions and moving to the step three.
> int sqlite3_step(sqlite3_stmt*);
> ---
> rc = sqlite3_step(stmt);
> if(rc != SQLITE_DONE) {
> sqlite3_close(db);
> std::cout << "error sqlite3_step: " << rc << std::endl;
> exit(-3);
> }
> Any suggestions?

None.
-- 
Igor Tandetnik

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


Re: [sqlite] C++ programming - sqlite3_column() question

2012-06-18 Thread Pavel Ivanov
Function sqlite3_column_count() returns number of columns in your
SELECT statement. For all other statements it returns 0.

Pavel


On Mon, Jun 18, 2012 at 7:35 AM, Arbol One  wrote:
> After creating a database, I, now, would like to create a table called 
> 'friend', but for some reason 'sqlite3_column()' reports zero.
>  What elese do I have to do to have the table created, this is what I have so 
> far done.
>  int main() {
>  sqlite3 *db; // Data Base
>  sqlite3_stmt* stmt;
>  int rc; // return code
>
>  // SQL statement
>  std::string create_table("CREATE TABLE friend (name TEXT, address TEXT, age 
> INT)");
>  // 1.) Open database
>  rc = sqlite3_open_v2(dbName.c_str(),
>  ,
>  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
>  NULL);
>  if(rc != SQLITE_OK) {
>  sqlite3_close(db);
>  std::cout << "error open_v2: " << rc << std::endl;
>  exit(-1);
>  } else {
>  std::cout << "Welcome to a whole new world!" << std::endl;
>  std::cin.get();
>  }
>  // 2.) Convert SQL text into a prepared statement and receive a valid 
> validated statement
>  rc = sqlite3_prepare_v2(
>  db, /* Database handle */
>  create_table.c_str() , /* SQL statement, UTF-8 encoded */
>  create_table.length(), /* Maximum length of zSql in bytes. */
>  , /* OUT: Statement handle */
>  NULL /* OUT: Pointer to unused portion of zSql */
>  );
>  if(rc != SQLITE_OK) {
>  sqlite3_close(db);
>  std::cout << "error prepare_v2: " << rc << std::endl;
>  exit(-2);
>  }
>  //3.) Evaluate the SQL stament passed to sqlite3_prepare_v2()
>  rc = sqlite3_step(stmt);
>  if(rc != SQLITE_DONE) {
>  sqlite3_close(db);
>  std::cout << "error sqlite3_step: " << rc << std::endl;
>  exit(-3);
>  }
>  //3.1
>  rc = sqlite3_column_count(stmt);
>  std::cout << "Number of colums: " << rc << std::endl;
>  sqlite3_finalize(stmt);
>  sqlite3_close(db);
>  std::cout << "Good bye!" << std::endl;
>  return 0;
>  }
> ___
> 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] escaping GLOB pattern

2012-06-18 Thread Jay A. Kreibich
On Mon, Jun 18, 2012 at 10:34:38AM +0300, Baruch Burstein scratched on the wall:
> Is there a built-in way to escape a GLOB pattern? Will it escape it if I
> bind it to a parameter in a prepared function instead of embedding it
> directly in the query string?

  If it is an identifier (table name, column name, etc.), use double
  quotes.  Double quites can be escaped by using two in a row.

  For example:

CREATE TABLE t ( "a*b""c" INT );

  Will create a column with the name a*b"c.

  For string literals, you need to use single quotes.  Same rules apply.

  Parameters do not require escapes, and the values inside a parameter
  will not be evaluated as part of the SQL statement.  This is why
  parameters are invaluable in preventing injection attacks.  Parameters
  can only be used for data values, however, not identifiers.  So,
  while you do not have to escape a * inside a parameter, you cannot
  use a parameter to reference the name of a table or column.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] C++ programming - sqlite3_column() question (doc flaw?)

2012-06-18 Thread Larry Brasfield

After creating a database, I, now, would like to create a table called 
'friend', but for some reason 'sqlite3_column()' reports zero.
 What elese do I have to do to have the table created, this is what I have so 
far done.
 int main() {
 sqlite3 *db; // Data Base
 sqlite3_stmt* stmt;
 int rc; // return code

 // SQL statement
 std::string create_table("CREATE TABLE friend (name TEXT, address TEXT, age 
INT)");
 // 1.) Open database
 rc = sqlite3_open_v2(dbName.c_str(),
 ,
 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
 NULL);
 if(rc != SQLITE_OK) {
 sqlite3_close(db);
 std::cout << "error open_v2: " << rc << std::endl;
 exit(-1);
 } else {
 std::cout << "Welcome to a whole new world!" << std::endl;
 std::cin.get();
 }
 // 2.) Convert SQL text into a prepared statement and receive a valid 
validated statement
 rc = sqlite3_prepare_v2(
 db, /* Database handle */
 create_table.c_str() , /* SQL statement, UTF-8 encoded */
 create_table.length(), /* Maximum length of zSql in bytes. */
 , /* OUT: Statement handle */
 NULL /* OUT: Pointer to unused portion of zSql */
 );
 if(rc != SQLITE_OK) {
 sqlite3_close(db);
 std::cout << "error prepare_v2: " << rc << std::endl;
 exit(-2);
 }
 //3.) Evaluate the SQL stament passed to sqlite3_prepare_v2()
 rc = sqlite3_step(stmt);
 if(rc != SQLITE_DONE) {
 sqlite3_close(db);
 std::cout << "error sqlite3_step: " << rc << std::endl;
 exit(-3);
 }
 //3.1
 rc = sqlite3_column_count(stmt);
 std::cout << "Number of colums: " << rc << std::endl;
 sqlite3_finalize(stmt);
 sqlite3_close(db);
 std::cout << "Good bye!" << std::endl;
 return 0;
 }



The documentation does not say this in so many words, but:
You should place your call to sqlite3_column_count(...) after the 
prepare and before any sqlite3_step(...) which exhaust the result set.


The documentation for the sqlite3_column_count function says "This 
routine returns 0 if pStmt is an SQL statement that does not return 
data".  If this includes a pStmt for which data will no longer be 
returned, (as appears to be the case from the OP's report), this more 
stringent requirement should be mentioned.


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


Re: [sqlite] sqlite-3.7.13 fails to build with gcc2-.95.3

2012-06-18 Thread Joe Mistachkin

scottmc wrote:
> 
> The build of sqlite-3.7.13 fails to build with gcc2-.95.3 on a recent
> Haiku nightly build, near line 2650 of shell.c probably from this
> change:
> 

Could you try using the code in the "compiler-compat" branch and see if the
problem clears?

--
Joe Mistachkin

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


[sqlite] C++ programming - sqlite3_column() question

2012-06-18 Thread Arbol One
After creating a database, I, now, would like to create a table called 
'friend', but for some reason 'sqlite3_column()' reports zero.
 What elese do I have to do to have the table created, this is what I have so 
far done.
 int main() {
 sqlite3 *db; // Data Base
 sqlite3_stmt* stmt;
 int rc; // return code

 // SQL statement
 std::string create_table("CREATE TABLE friend (name TEXT, address TEXT, age 
INT)");
 // 1.) Open database
 rc = sqlite3_open_v2(dbName.c_str(),
 , 
 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
 NULL);
 if(rc != SQLITE_OK) {
 sqlite3_close(db);
 std::cout << "error open_v2: " << rc << std::endl;
 exit(-1);
 } else {
 std::cout << "Welcome to a whole new world!" << std::endl;
 std::cin.get();
 }
 // 2.) Convert SQL text into a prepared statement and receive a valid 
validated statement
 rc = sqlite3_prepare_v2(
 db, /* Database handle */
 create_table.c_str() , /* SQL statement, UTF-8 encoded */
 create_table.length(), /* Maximum length of zSql in bytes. */
 , /* OUT: Statement handle */
 NULL /* OUT: Pointer to unused portion of zSql */
 );
 if(rc != SQLITE_OK) {
 sqlite3_close(db);
 std::cout << "error prepare_v2: " << rc << std::endl;
 exit(-2);
 }
 //3.) Evaluate the SQL stament passed to sqlite3_prepare_v2()
 rc = sqlite3_step(stmt);
 if(rc != SQLITE_DONE) {
 sqlite3_close(db);
 std::cout << "error sqlite3_step: " << rc << std::endl;
 exit(-3);
 }
 //3.1
 rc = sqlite3_column_count(stmt);
 std::cout << "Number of colums: " << rc << std::endl;
 sqlite3_finalize(stmt);
 sqlite3_close(db);
 std::cout << "Good bye!" << std::endl;
 return 0;
 }
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] escaping GLOB pattern

2012-06-18 Thread Richard Hipp
On Mon, Jun 18, 2012 at 3:34 AM, Baruch Burstein wrote:

> Is there a built-in way to escape a GLOB pattern? Will it escape it if I
> bind it to a parameter in a prepared function instead of embedding it
> directly in the query string?
>


What do you mean by "escape a GLOB pattern"?


>
> --
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] C++ programming - int sqlite3_prepare_v2() question

2012-06-18 Thread Arbol One
LOL, some times I surprise myself with the most stupid of questions! Yes, you 
were very clear, Igor, sorry about that!!
 Continuing with the questions and moving to the step three.
 int sqlite3_step(sqlite3_stmt*);
 ---
 rc = sqlite3_step(stmt);
 if(rc != SQLITE_DONE) {
 sqlite3_close(db);
 std::cout << "error sqlite3_step: " << rc << std::endl;
 exit(-3);
 }
 Any suggestions?

- Original Message -
From: Igor Tandetnik
Sent: 06/17/12 06:41 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ programming - int sqlite3_prepare_v2() question

 Arbol One  wrote: > //2 . ) create a table > 
sqlite3_stmt** stmt; Which part of "sqlite3_stmt* stmt;" did you find unclear? 
> std::string create_table("CREATE TABLE friend (name TEXT, address TEXT, age 
INT)"); > rc = sqlite3_prepare_v2( > db, /* Database handle */ > 
create_table.c_str() , /* SQL statement, UTF-8 encoded */ > 
create_table.length(), /* Maximum length of zSql in bytes. */ > stmt, /* OUT: 
Statement handle */ Which part of "pass " did you find unclear? -- Igor 
Tandetnik ___ 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] Bug: incorrect forward declaration of sqlite3_win32_sleep

2012-06-18 Thread Joe Mistachkin

Roger Binns wrote:
> 
> There should not be an extern since SQLITE_API will be appropriately
> defined.  And if SQLITE_API is set to static as is my case then there is a
> compilation failure.
> 

Could you try using the code in the "compiler-compat" branch and see if the
problem clears?
 
--
Joe Mistachkin

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


[sqlite] escaping GLOB pattern

2012-06-18 Thread Baruch Burstein
Is there a built-in way to escape a GLOB pattern? Will it escape it if I
bind it to a parameter in a prepared function instead of embedding it
directly in the query string?

-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Bug: incorrect forward declaration of sqlite3_win32_sleep

2012-06-18 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This line is a problem:

  SQLITE_API extern void sqlite3_win32_sleep(DWORD milliseconds);

There should not be an extern since SQLITE_API will be appropriately
defined.  And if SQLITE_API is set to static as is my case then there is a
compilation failure.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk/ezuMACgkQmOOfHg372QSKzACgkaVUTmho3pIYAEmG1DMmUKd7
A18AoNlE6RxKUcOTggXB4nAclPezZorw
=iNne
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users