SQLite

Check-in [d8568aacf0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ensure that test tool "tserver" finalizes all statements before attempting to close a database handle.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | server-edition
Files: files | file ages | folders
SHA3-256: d8568aacf083b63cdcf68d744ddb07a7615d14f169be6c632813a266a1e8a1cf
User & Date: dan 2017-06-20 19:20:07.502
Context
2017-06-28
20:12
Fix bugs in test program tserver.c. (Leaf check-in: 093b9108ea user: dan tags: server-edition)
2017-06-27
20:23
Support clients within a single process only. (check-in: dfa9a4d53e user: dan tags: server-process-edition)
2017-06-20
19:20
Ensure that test tool "tserver" finalizes all statements before attempting to close a database handle. (check-in: d8568aacf0 user: dan tags: server-edition)
2017-06-07
15:55
Add too/tserver.c - the implementation of a simple multi-threaded server designed for interactive testing of concurrency between connections used by different threads of the same process. (check-in: 05b4fc4340 user: dan tags: server-edition)
Changes
Unified Diff Ignore Whitespace Patch
Changes to tool/tserver.c.
264
265
266
267
268
269
270

271
272
273
274
275
276
277
}

static void *handle_client(void *pArg){
  char zCmd[32*1024];             /* Read buffer */
  int nCmd = 0;                   /* Valid bytes in zCmd[] */
  int res;                        /* Result of read() call */
  int rc = SQLITE_OK;


  ClientCtx ctx;
  memset(&ctx, 0, sizeof(ClientCtx));

  ctx.fd = (int)(intptr_t)pArg;
  ctx.nRepeat = 1;
  rc = sqlite3_open(zDatabaseName, &ctx.db);







>







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
}

static void *handle_client(void *pArg){
  char zCmd[32*1024];             /* Read buffer */
  int nCmd = 0;                   /* Valid bytes in zCmd[] */
  int res;                        /* Result of read() call */
  int rc = SQLITE_OK;
  int j;

  ClientCtx ctx;
  memset(&ctx, 0, sizeof(ClientCtx));

  ctx.fd = (int)(intptr_t)pArg;
  ctx.nRepeat = 1;
  rc = sqlite3_open(zDatabaseName, &ctx.db);
342
343
344
345
346
347
348




349
350
351
352
353
354
355
        }
      }
    }while( rc==SQLITE_OK && nConsume>0 );
  }

  fprintf(stdout, "Client %d disconnects\n", ctx.fd);
  close(ctx.fd);




  sqlite3_close(ctx.db);
  return 0;
} 

int main(int argc, char *argv[]) {
  sqlite3 *db;
  int sfd;







>
>
>
>







343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
        }
      }
    }while( rc==SQLITE_OK && nConsume>0 );
  }

  fprintf(stdout, "Client %d disconnects\n", ctx.fd);
  close(ctx.fd);
  for(j=0; j<ctx.nPrepare; j++){
    sqlite3_finalize(ctx.apPrepare[j]);
  }
  sqlite3_free(ctx.apPrepare);
  sqlite3_close(ctx.db);
  return 0;
} 

int main(int argc, char *argv[]) {
  sqlite3 *db;
  int sfd;