Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Accept a "/" or "go" on a line by itself as an SQL statement terminator in the command-line shell. This allows SQL Server and Oracle scripts to be played into SQLite without change. (CVS 944) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
8211f57b38b87a42c856e267bd243984 |
User & Date: | drh 2003-04-29 18:01:28 |
Context
2003-04-30
| ||
11:38 | In the shell tool, delay opening the database until it is needed but also make sure it is opened before trying to use the "db" pointer. Ticket #302. (CVS 945) check-in: 20fcead4 user: drh tags: trunk | |
2003-04-29
| ||
18:01 | Accept a "/" or "go" on a line by itself as an SQL statement terminator in the command-line shell. This allows SQL Server and Oracle scripts to be played into SQLite without change. (CVS 944) check-in: 8211f57b user: drh tags: trunk | |
17:19 | Allow the ASC or DESC keyword to appear after a column name in a CREATE INDEX statement. SQLite indices are aways ASC (ascending) regardless of which keyword is used. (CVS 943) check-in: 1a0c5420 user: drh tags: trunk | |
Changes
Changes to src/shell.c.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... 917 918 919 920 921 922 923 924 925 926 927 928 929 930 ... 943 944 945 946 947 948 949 950 951 952 953 954 955 956 |
** 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.73 2003/04/26 03:03:07 drh Exp $ */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include "sqlite.h" #include <ctype.h> ................................................................................ if( *z==0 ) return 1; continue; } return 0; } return 1; } /* ** Read input from *in and process it. If *in==0 then input ** is interactive - the user is typing it it. Otherwise, input ** is coming from a file or device. A prompt is issued and history ** is saved only if input is interactive. An interrupt signal will ** cause this routine to exit immediately, unless input is interactive. ................................................................................ if( p->echoOn ) printf("%s\n", zLine); if( _all_whitespace(zLine) ) continue; if( zLine && zLine[0]=='.' && nSql==0 ){ int rc = do_meta_command(zLine, db, p); free(zLine); if( rc ) break; continue; } if( zSql==0 ){ int i; for(i=0; zLine[i] && isspace(zLine[i]); i++){} if( zLine[i]!=0 ){ nSql = strlen(zLine); zSql = malloc( nSql+1 ); |
| > > > > > > > > > > > > > > > > > > |
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 ... 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
** 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.74 2003/04/29 18:01:28 drh Exp $ */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include "sqlite.h" #include <ctype.h> ................................................................................ if( *z==0 ) return 1; continue; } return 0; } return 1; } /* ** Return TRUE if the line typed in is an SQL command terminator other ** than a semi-colon. The SQL Server style "go" command is understood ** as is the Oracle "/". */ static int _is_command_terminator(const char *zLine){ extern int sqliteStrNICmp(const char*,const char*,int); while( isspace(*zLine) ){ zLine++; }; if( zLine[0]=='/' && _all_whitespace(&zLine[1]) ) return 1; /* Oracle */ if( sqliteStrNICmp(zLine,"go",2)==0 && _all_whitespace(&zLine[2]) ){ return 1; /* SQL Server */ } return 0; } /* ** Read input from *in and process it. If *in==0 then input ** is interactive - the user is typing it it. Otherwise, input ** is coming from a file or device. A prompt is issued and history ** is saved only if input is interactive. An interrupt signal will ** cause this routine to exit immediately, unless input is interactive. ................................................................................ if( p->echoOn ) printf("%s\n", zLine); if( _all_whitespace(zLine) ) continue; if( zLine && zLine[0]=='.' && nSql==0 ){ int rc = do_meta_command(zLine, db, p); free(zLine); if( rc ) break; continue; } if( _is_command_terminator(zLine) ){ strcpy(zLine,";"); } if( zSql==0 ){ int i; for(i=0; zLine[i] && isspace(zLine[i]); i++){} if( zLine[i]!=0 ){ nSql = strlen(zLine); zSql = malloc( nSql+1 ); |