Re: [sqlite] RBU fails as of checkin f84a1539 - fixed

2019-12-23 Thread Ralf Junker

On 22.12.2019 17:23, Keith Medcalf wrote:


I get:

RBU error: near ")": syntax error ERROR 1, expected 101 Done - Press
ENTER to exit.

with the current trunk ...


Thanks for following up on this. I spotted a typo in the test code.
Corrected version below. With that, Dan's fix works for me on trunk,
currently at 0b1dbd60f5.

Ralf

--

#include 
#include "sqlite3.h"
#include "sqlite3rbu.h"

static void check(int r, int e) {
  if (r != e) {
printf ("ERROR %d, expected %d\n", e, r);
  }
}

static int callback (void *user, int nCol, char **r, char **c) {
  int i;
  for (i = 0; i < nCol; i++) {
printf("%s ", r[i]);
  }
  printf("\n");
  return 0;
}

static int runrbu(char *zTarget, char *zRbu) {
  sqlite3rbu* rbu;
  int rc;
  char* zError;

  rbu = sqlite3rbu_open (zTarget, zRbu, NULL);
  do {
rc = sqlite3rbu_step(rbu);
  } while (rc == SQLITE_OK);

  rc = sqlite3rbu_close(rbu, );
  if (zError) {
printf("RBU error: %s\n", zError);
sqlite3_free(zError);
  }
  return rc;
}

int main(void)
{
  sqlite3 *db, *dbRbu;
  int rc;

  remove ("test.db");
  check(SQLITE_OK, sqlite3_open_v2 ("test.db", ,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));

  check(SQLITE_OK, sqlite3_exec(db,
"CREATE TABLE t1(a, b, c PRIMARY KEY);" \
"CREATE INDEX i1 ON t1(a, null, b+1);" \
"CREATE INDEX i2 ON t1(a+1, b+1, c+1);" \

"INSERT INTO t1 VALUES(1, 2, 3);" \
"INSERT INTO t1 VALUES(4, 5, 6);" \
"INSERT INTO t1 VALUES(7, 8, 9);" \
"INSERT INTO t1 VALUES(10, 11, 12);" ,
callback, NULL, NULL));

  sqlite3_close(db);

  remove ("rbu.db");
  check(SQLITE_OK, sqlite3_open_v2 ("rbu.db", ,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));

  check(SQLITE_OK, sqlite3_exec(dbRbu,
"CREATE TABLE data_t1(a, b, c, rbu_control);" \
"INSERT INTO data_t1 VALUES(13, 14, 15, 0);" \
"INSERT INTO data_t1 VALUES(NULL, NULL, 6, 1);" \
"INSERT INTO data_t1 VALUES(NULL, 'three', 3, '.x.');",
callback, NULL, NULL));

  sqlite3_close(dbRbu);

  check(SQLITE_DONE, runrbu("test.db", "rbu.db"));

  printf("Done - Press ENTER to exit.\n");
  getchar();

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


Re: [sqlite] RBU fails as of checkin f84a1539 - fixed

2019-12-22 Thread Keith Medcalf

I get:

RBU error: near ")": syntax error
ERROR 1, expected 101
Done - Press ENTER to exit.

with the current trunk ...

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.

>-Original Message-
>From: sqlite-users  On
>Behalf Of Ralf Junker
>Sent: Sunday, 22 December, 2019 04:29
>To: sqlite-users@mailinglists.sqlite.org
>Subject: [sqlite] RBU fails as of checkin f84a1539 - fixed
>
>Replying to myself just to confirm that
>https://www.sqlite.org/src/info/0b9d8a1202c4220f fixes the problem.
>
>Thank you, Dan!
>
>Ralf
>
>On 20.12.2019 17:48, Ralf Junker wrote:
>
>> As of Fossil checkin f84a1539, the RBU code in the following C example
>> is no longer executed to completion. Instead, an error message is
>> generated and the result database is not correctly written.
>>
>> The code works fine with Fossil checkin 28091a48. It generates no error
>> messages and produces the expected result database.
>>
>> The problem is still present on trunk, checkin 289158aa at the time of
>> this writing.
>>
>> Could anyone reproduce my findings?
>>
>> Many thanks,
>>
>> Ralf
>>
>> --
>>
>> #include 
>> #include "sqlite3.h"
>> #include "sqlite3rbu.h"
>>
>> static void check(int r, int e) {
>>    if (r != e) {
>>      printf ("ERROR %d, expected %d\n", e, r);
>>    }
>> }
>>
>> static int callback (void *user, int nCol, char **r, char **c) {
>>    int i;
>>    for (i = 0; i < nCol; i++) {
>>      printf("%s ", r[i]);
>>    }
>>    printf("\n");
>>    return 0;
>> }
>>
>> static int runrbu(char *zTarget, char *zRbu) {
>>    sqlite3rbu* rbu;
>>    int rc;
>>    char* zError;
>>
>>    rbu = sqlite3rbu_open (zTarget, zRbu, NULL);
>>    do {
>>      rc = sqlite3rbu_step(rbu);
>>    } while (rc == SQLITE_OK);
>>
>>    rc = sqlite3rbu_close(rbu, );
>>    if (zError) {
>>      printf("RBU error: %s\n", zError);
>>      sqlite3_free(zError);
>>    }
>>    return rc;
>> }
>>
>> int main(void)
>> {
>>    sqlite3 *db, *dbRbu;
>>    int rc;
>>
>>    remove ("test.db");
>>    check(SQLITE_OK, sqlite3_open_v2 ("test.db", ,
>>      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));
>>
>>    check(SQLITE_OK, sqlite3_exec(db,
>>      "CREATE TABLE t1(a, b, c PRIMARY KEY);" \
>>      "CREATE INDEX i1 ON t1(a, null, b+1);" \
>>      "CREATE INDEX i2 ON t1(a+1, b+1, c+1);" \
>>
>>      "INSERT INTO t1 VALUES(1, 2, 3);" \
>>      "INSERT INTO t1 VALUES(4, 5, 6);" \
>>      "INSERT INTO t1 VALUES(7, 8, 9);" \
>>      "INSERT INTO t1 VALUES(10, 11, 12);" ,
>>      callback, NULL, NULL));
>>
>>    sqlite3_close(db);
>>
>>    remove ("rbu.db");
>>    check(SQLITE_OK, sqlite3_open_v2 ("rbu.db", ,
>>      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));
>>
>>    check(SQLITE_OK, sqlite3_exec(db,
>>      "CREATE TABLE data_t1(a, b, c, rbu_control);" \
>>      "INSERT INTO data_t1 VALUES(13, 14, 15, 0);" \
>>      "INSERT INTO data_t1 VALUES(NULL, NULL, 6, 1);" \
>>      "INSERT INTO data_t1 VALUES(NULL, 'three', 3, '.x.');",
>>      callback, NULL, NULL));
>>
>>    sqlite3_close(dbRbu);
>>
>>    check(SQLITE_DONE, runrbu("test.db", "rbu.db"));
>>
>>    printf("Done - Press ENTER to exit.\n");
>>    getchar();
>>
>>    return 0;
>> }
>
>___
>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] RBU fails as of checkin f84a1539 - fixed

2019-12-22 Thread Ralf Junker

Replying to myself just to confirm that
https://www.sqlite.org/src/info/0b9d8a1202c4220f fixes the problem.

Thank you, Dan!

Ralf

On 20.12.2019 17:48, Ralf Junker wrote:


As of Fossil checkin f84a1539, the RBU code in the following C example
is no longer executed to completion. Instead, an error message is
generated and the result database is not correctly written.

The code works fine with Fossil checkin 28091a48. It generates no error
messages and produces the expected result database.

The problem is still present on trunk, checkin 289158aa at the time of
this writing.

Could anyone reproduce my findings?

Many thanks,

Ralf

--

#include 
#include "sqlite3.h"
#include "sqlite3rbu.h"

static void check(int r, int e) {
   if (r != e) {
     printf ("ERROR %d, expected %d\n", e, r);
   }
}

static int callback (void *user, int nCol, char **r, char **c) {
   int i;
   for (i = 0; i < nCol; i++) {
     printf("%s ", r[i]);
   }
   printf("\n");
   return 0;
}

static int runrbu(char *zTarget, char *zRbu) {
   sqlite3rbu* rbu;
   int rc;
   char* zError;

   rbu = sqlite3rbu_open (zTarget, zRbu, NULL);
   do {
     rc = sqlite3rbu_step(rbu);
   } while (rc == SQLITE_OK);

   rc = sqlite3rbu_close(rbu, );
   if (zError) {
     printf("RBU error: %s\n", zError);
     sqlite3_free(zError);
   }
   return rc;
}

int main(void)
{
   sqlite3 *db, *dbRbu;
   int rc;

   remove ("test.db");
   check(SQLITE_OK, sqlite3_open_v2 ("test.db", ,
     SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));

   check(SQLITE_OK, sqlite3_exec(db,
     "CREATE TABLE t1(a, b, c PRIMARY KEY);" \
     "CREATE INDEX i1 ON t1(a, null, b+1);" \
     "CREATE INDEX i2 ON t1(a+1, b+1, c+1);" \

     "INSERT INTO t1 VALUES(1, 2, 3);" \
     "INSERT INTO t1 VALUES(4, 5, 6);" \
     "INSERT INTO t1 VALUES(7, 8, 9);" \
     "INSERT INTO t1 VALUES(10, 11, 12);" ,
     callback, NULL, NULL));

   sqlite3_close(db);

   remove ("rbu.db");
   check(SQLITE_OK, sqlite3_open_v2 ("rbu.db", ,
     SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));

   check(SQLITE_OK, sqlite3_exec(db,
     "CREATE TABLE data_t1(a, b, c, rbu_control);" \
     "INSERT INTO data_t1 VALUES(13, 14, 15, 0);" \
     "INSERT INTO data_t1 VALUES(NULL, NULL, 6, 1);" \
     "INSERT INTO data_t1 VALUES(NULL, 'three', 3, '.x.');",
     callback, NULL, NULL));

   sqlite3_close(dbRbu);

   check(SQLITE_DONE, runrbu("test.db", "rbu.db"));

   printf("Done - Press ENTER to exit.\n");
   getchar();

   return 0;
}


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


[sqlite] RBU fails as of checkin f84a1539

2019-12-20 Thread Ralf Junker

As of Fossil checkin f84a1539, the RBU code in the following C example
is no longer executed to completion. Instead, an error message is
generated and the result database is not correctly written.

The code works fine with Fossil checkin 28091a48. It generates no error
messages and produces the expected result database.

The problem is still present on trunk, checkin 289158aa at the time of
this writing.

Could anyone reproduce my findings?

Many thanks,

Ralf

--

#include 
#include "sqlite3.h"
#include "sqlite3rbu.h"

static void check(int r, int e) {
  if (r != e) {
printf ("ERROR %d, expected %d\n", e, r);
  }
}

static int callback (void *user, int nCol, char **r, char **c) {
  int i;
  for (i = 0; i < nCol; i++) {
printf("%s ", r[i]);
  }
  printf("\n");
  return 0;
}

static int runrbu(char *zTarget, char *zRbu) {
  sqlite3rbu* rbu;
  int rc;
  char* zError;

  rbu = sqlite3rbu_open (zTarget, zRbu, NULL);
  do {
rc = sqlite3rbu_step(rbu);
  } while (rc == SQLITE_OK);

  rc = sqlite3rbu_close(rbu, );
  if (zError) {
printf("RBU error: %s\n", zError);
sqlite3_free(zError);
  }
  return rc;
}

int main(void)
{
  sqlite3 *db, *dbRbu;
  int rc;

  remove ("test.db");
  check(SQLITE_OK, sqlite3_open_v2 ("test.db", ,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));

  check(SQLITE_OK, sqlite3_exec(db,
"CREATE TABLE t1(a, b, c PRIMARY KEY);" \
"CREATE INDEX i1 ON t1(a, null, b+1);" \
"CREATE INDEX i2 ON t1(a+1, b+1, c+1);" \

"INSERT INTO t1 VALUES(1, 2, 3);" \
"INSERT INTO t1 VALUES(4, 5, 6);" \
"INSERT INTO t1 VALUES(7, 8, 9);" \
"INSERT INTO t1 VALUES(10, 11, 12);" ,
callback, NULL, NULL));

  sqlite3_close(db);

  remove ("rbu.db");
  check(SQLITE_OK, sqlite3_open_v2 ("rbu.db", ,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL));

  check(SQLITE_OK, sqlite3_exec(db,
"CREATE TABLE data_t1(a, b, c, rbu_control);" \
"INSERT INTO data_t1 VALUES(13, 14, 15, 0);" \
"INSERT INTO data_t1 VALUES(NULL, NULL, 6, 1);" \
"INSERT INTO data_t1 VALUES(NULL, 'three', 3, '.x.');",
callback, NULL, NULL));

  sqlite3_close(dbRbu);

  check(SQLITE_DONE, runrbu("test.db", "rbu.db"));

  printf("Done - Press ENTER to exit.\n");
  getchar();

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