Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The .dump output uses INSERT instead of COPY now. Expression syntax of the form "expr NOT NULL" is now supported. (CVS 276) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
20382325c7c8c6b11bd45b23060d0f7f |
User & Date: | drh 2001-10-01 14:29:23.000 |
Context
2001-10-02
| ||
13:01 | Remove C++ comments from btree.c. (CVS 277) (check-in: 4b7710e2da user: drh tags: trunk) | |
2001-10-01
| ||
14:29 | The .dump output uses INSERT instead of COPY now. Expression syntax of the form "expr NOT NULL" is now supported. (CVS 276) (check-in: 20382325c7 user: drh tags: trunk) | |
2001-09-28
| ||
23:15 | Version 2.0.0 (CVS 470) (check-in: c0a8a1fb42 user: drh tags: trunk) | |
Changes
Changes to VERSION.
|
| | | 1 | 2.0.1 |
Changes to src/parse.y.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** ** @(#) $Id: parse.y,v 1.33 2001/10/01 14:29:23 drh Exp $ */ %token_prefix TK_ %token_type {Token} %default_type {Token} %extra_argument {Parse *pParse} %syntax_error { sqliteSetString(&pParse->zErrMsg,"syntax error",0); |
︙ | ︙ | |||
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | expr(A) ::= expr(X) MINUS expr(Y). {A = sqliteExpr(TK_MINUS, X, Y, 0);} expr(A) ::= expr(X) STAR expr(Y). {A = sqliteExpr(TK_STAR, X, Y, 0);} expr(A) ::= expr(X) SLASH expr(Y). {A = sqliteExpr(TK_SLASH, X, Y, 0);} expr(A) ::= expr(X) CONCAT expr(Y). {A = sqliteExpr(TK_CONCAT, X, Y, 0);} expr(A) ::= expr(X) ISNULL(E). { A = sqliteExpr(TK_ISNULL, X, 0, 0); sqliteExprSpan(A,&X->span,&E); } expr(A) ::= expr(X) NOTNULL(E). { A = sqliteExpr(TK_NOTNULL, X, 0, 0); sqliteExprSpan(A,&X->span,&E); } expr(A) ::= NOT(B) expr(X). { A = sqliteExpr(TK_NOT, X, 0, 0); sqliteExprSpan(A,&B,&X->span); } expr(A) ::= MINUS(B) expr(X). [UMINUS] { A = sqliteExpr(TK_UMINUS, X, 0, 0); | > > > > > > > > | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | expr(A) ::= expr(X) MINUS expr(Y). {A = sqliteExpr(TK_MINUS, X, Y, 0);} expr(A) ::= expr(X) STAR expr(Y). {A = sqliteExpr(TK_STAR, X, Y, 0);} expr(A) ::= expr(X) SLASH expr(Y). {A = sqliteExpr(TK_SLASH, X, Y, 0);} expr(A) ::= expr(X) CONCAT expr(Y). {A = sqliteExpr(TK_CONCAT, X, Y, 0);} expr(A) ::= expr(X) ISNULL(E). { A = sqliteExpr(TK_ISNULL, X, 0, 0); sqliteExprSpan(A,&X->span,&E); } expr(A) ::= expr(X) IS NULL(E). { A = sqliteExpr(TK_ISNULL, X, 0, 0); sqliteExprSpan(A,&X->span,&E); } expr(A) ::= expr(X) NOTNULL(E). { A = sqliteExpr(TK_NOTNULL, X, 0, 0); sqliteExprSpan(A,&X->span,&E); } expr(A) ::= expr(X) NOT NULL(E). { A = sqliteExpr(TK_NOTNULL, X, 0, 0); sqliteExprSpan(A,&X->span,&E); } expr(A) ::= NOT(B) expr(X). { A = sqliteExpr(TK_NOT, X, 0, 0); sqliteExprSpan(A,&B,&X->span); } expr(A) ::= MINUS(B) expr(X). [UMINUS] { A = sqliteExpr(TK_UMINUS, X, 0, 0); |
︙ | ︙ |
Changes to src/shell.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** ** $Id: shell.c,v 1.35 2001/10/01 14:29:23 drh Exp $ */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include "sqlite.h" #include <unistd.h> #include <ctype.h> |
︙ | ︙ | |||
123 124 125 126 127 128 129 | sqlite *db; /* The database */ int echoOn; /* True to echo input commands */ int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ int mode; /* An output mode setting */ int showHeader; /* True to show column names in List or Column mode */ int escape; /* Escape this character when in MODE_List */ | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | sqlite *db; /* The database */ int echoOn; /* True to echo input commands */ int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ int mode; /* An output mode setting */ int showHeader; /* True to show column names in List or Column mode */ int escape; /* Escape this character when in MODE_List */ char *zDestTable; /* Name of destination table when MODE_Insert */ char separator[20]; /* Separator character for MODE_List */ int colWidth[100]; /* Requested width of each column when in column mode*/ int actualWidth[100]; /* Actual width of each column */ }; /* ** These are the allowed modes. |
︙ | ︙ | |||
349 350 351 352 353 354 355 | output_html_string(p->out, azArg[i] ? azArg[i] : ""); fprintf(p->out,"</TD>\n"); } fprintf(p->out,"</TD></TR>\n"); break; } case MODE_Insert: { | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < | | < | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | output_html_string(p->out, azArg[i] ? azArg[i] : ""); fprintf(p->out,"</TD>\n"); } fprintf(p->out,"</TD></TR>\n"); break; } case MODE_Insert: { fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable); for(i=0; i<nArg; i++){ char *zSep = i>0 ? ",": ""; if( azArg[i]==0 ){ fprintf(p->out,"%sNULL",zSep); }else if( is_numeric(azArg[i]) ){ fprintf(p->out,"%s%s",zSep, azArg[i]); }else{ if( zSep[0] ) fprintf(p->out,"%s",zSep); output_quoted_string(p->out, azArg[i]); } } fprintf(p->out,");\n"); } } return 0; } /* ** Set the destination table field of the callback_data structure to ** the name of the table given. Escape any quote characters in the ** table name. */ static void set_table_name(struct callback_data *p, const char *zName){ int i, n; int needQuote; char *z; if( p->zDestTable ){ free(p->zDestTable); p->zDestTable = 0; } if( zName==0 ) return; needQuote = !isalpha(*zName) && *zName!='_'; for(i=n=0; zName[i]; i++, n++){ if( !isalnum(zName[i]) && zName[i]!='_' ){ needQuote = 1; if( zName[i]=='\'' ) n++; } } if( needQuote ) n += 2; z = p->zDestTable = malloc( n+1 ); if( z==0 ){ fprintf(stderr,"Out of memory!\n"); exit(1); } n = 0; if( needQuote ) z[n++] = '\''; for(i=0; zName[i]; i++){ z[n++] = zName[i]; if( zName[i]=='\'' ) z[n++] = '\''; } if( needQuote ) z[n++] = '\''; z[n] = 0; } /* ** This is a different callback routine used for dumping the database. ** Each row received by this callback consists of a table name, ** the table type ("index" or "table") and SQL to create the table. ** This routine should print text sufficient to recreate the table. */ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){ struct callback_data *p = (struct callback_data *)pArg; if( nArg!=3 ) return 1; fprintf(p->out, "%s;\n", azArg[2]); if( strcmp(azArg[1],"table")==0 ){ struct callback_data d2; d2 = *p; d2.mode = MODE_Insert; d2.zDestTable = 0; set_table_name(&d2, azArg[0]); sqlite_exec_printf(p->db, "SELECT * FROM '%q'", callback, &d2, 0, azArg[0] ); set_table_name(&d2, 0); } return 0; } /* ** Text of a help message */ static char zHelp[] = |
︙ | ︙ | |||
458 459 460 461 462 463 464 465 466 467 | /* Process the input line. */ if( nArg==0 ) return; n = strlen(azArg[0]); c = azArg[0][0]; if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){ char *zErrMsg = 0; if( nArg==1 ){ sqlite_exec(db, "SELECT name, type, sql FROM sqlite_master " | > | | > > | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | /* Process the input line. */ if( nArg==0 ) return; n = strlen(azArg[0]); c = azArg[0][0]; if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){ char *zErrMsg = 0; fprintf(p->out, "BEGIN TRANSACTION;\n"); if( nArg==1 ){ sqlite_exec(db, "SELECT name, type, sql FROM sqlite_master " "WHERE type!='meta' AND sql NOT NULL " "ORDER BY tbl_name, type DESC, name", dump_callback, p, &zErrMsg ); }else{ int i; for(i=1; i<nArg && zErrMsg==0; i++){ sqlite_exec_printf(db, "SELECT name, type, sql FROM sqlite_master " "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOT NULL " "ORDER BY type DESC, name", dump_callback, p, &zErrMsg, azArg[i] ); } } if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); free(zErrMsg); }else{ fprintf(p->out, "COMMIT;\n"); } }else if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 ){ int j; char *z = azArg[1]; int val = atoi(azArg[1]); |
︙ | ︙ | |||
560 561 562 563 564 565 566 567 568 | }else if( strncmp(azArg[1],"column",n2)==0 ){ p->mode = MODE_Column; }else if( strncmp(azArg[1],"list",n2)==0 ){ p->mode = MODE_List; }else if( strncmp(azArg[1],"html",n2)==0 ){ p->mode = MODE_Html; }else if( strncmp(azArg[1],"insert",n2)==0 ){ p->mode = MODE_Insert; if( nArg>=3 ){ | > > | | | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | }else if( strncmp(azArg[1],"column",n2)==0 ){ p->mode = MODE_Column; }else if( strncmp(azArg[1],"list",n2)==0 ){ p->mode = MODE_List; }else if( strncmp(azArg[1],"html",n2)==0 ){ p->mode = MODE_Html; }else if( strncmp(azArg[1],"insert",n2)==0 ){ char *zTab; int k, n; p->mode = MODE_Insert; if( nArg>=3 ){ set_table_name(p, azArg[2]); }else{ set_table_name(p, "table"); } }else { fprintf(stderr,"mode should be on of: column html insert line list\n"); } }else if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){ |
︙ | ︙ | |||
654 655 656 657 658 659 660 | new_argv[1] = 0; new_colv[0] = "sql"; new_colv[1] = 0; callback(&data, 1, new_argv, new_colv); }else{ sqlite_exec_printf(db, "SELECT sql FROM sqlite_master " | | | | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | new_argv[1] = 0; new_colv[0] = "sql"; new_colv[1] = 0; callback(&data, 1, new_argv, new_colv); }else{ sqlite_exec_printf(db, "SELECT sql FROM sqlite_master " "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOTNULL " "ORDER BY type DESC, name", callback, &data, &zErrMsg, azArg[1]); } }else{ sqlite_exec(db, "SELECT sql FROM sqlite_master " "WHERE type!='meta' AND sql NOTNULL " "ORDER BY tbl_name, type DESC, name", callback, &data, &zErrMsg ); } if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); free(zErrMsg); |
︙ | ︙ | |||
874 875 876 877 878 879 880 881 882 883 | sqlite_version ); process_input(&data, 0); }else{ process_input(&data, stdin); } } sqlite_close(db); return 0; } | > | 915 916 917 918 919 920 921 922 923 924 925 | sqlite_version ); process_input(&data, 0); }else{ process_input(&data, stdin); } } set_table_name(&data, 0); sqlite_close(db); return 0; } |
Changes to www/changes.tcl.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | } proc chng {date desc} { puts "<DT><B>$date</B></DT>" puts "<DD><P><UL>$desc</UL></P></DD>" } chng {2001 Sep 28 (2.0.0)} { <li>Automatically build binaries for Linux and Windows and put them on the website.</li> } chng {2001 Sep 28 (2.0-alpha-4)} { | > > > > > > > > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | } proc chng {date desc} { puts "<DT><B>$date</B></DT>" puts "<DD><P><UL>$desc</UL></P></DD>" } chng {2001 Oct 1 (2.0.1)} { <li>The ".dump" output from the shell does not work if there are embedded newlines anywhere in the data. This is an old bug that was carried forward from version 1.0. To fix it, the ".dump" output no longer uses the COPY command. It instead generates INSERT statements.</li> <li>Extend the expression syntax to support "expr NOT NULL" (with a space between the "NOT" and the "NULL") in addition to "expr NOTNULL" (with no space).</li> } chng {2001 Sep 28 (2.0.0)} { <li>Automatically build binaries for Linux and Windows and put them on the website.</li> } chng {2001 Sep 28 (2.0-alpha-4)} { |
︙ | ︙ |