Re: [sqlite] how to disable dot commands?

2020-01-12 Thread Xingwei Lin
I like this answer!! I think I think it's the easiest way.

On Mon, Jan 13, 2020 at 10:22 AM Keith Medcalf  wrote:

>
> On Sunday, 12 January, 2020 18:44, Xingwei Lin 
> wrote:
>
> >Is there any way can we disable the dot commands feature in sqlite?
>
> SQLite does not process dot commands, they are commands to the shell.c
> SQLite Application program.
>
> The current shell.c application currently does not have a way to omit the
> meta commands.
>
> However, if you build your own you can simply search shell.c (or
> shell.c.in) for the function do_meta_command function definition and have
> it execute a "return 0;" at the top of the function after the variable
> declarations rather that process the meta command.  This will not remove
> the code that handles the meta commands but merely bypass the processing of
> them.
>
> That is make it look thusly by inserting the return 0; line:
>
> /*
> ** If an input line begins with "." then invoke this routine to
> ** process that line.
> **
> ** Return 1 on error, 2 to exit, and 0 otherwise.
> */
> static int do_meta_command(char *zLine, ShellState *p){
>   int h = 1;
>   int nArg = 0;
>   int n, c;
>   int rc = 0;
>   char *azArg[52];
>
>   return 0;
>
> #ifndef SQLITE_OMIT_VIRTUALTABLE
>   if( p->expert.pExpert ){
> expertFinish(p, 1, 0);
>   }
> #endif
>
> --
> The fact that there's a Highway to Hell but only a Stairway to Heaven says
> a lot about anticipated traffic volume.
>
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Best regards,
Xingwei Lin
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to disable dot commands?

2020-01-12 Thread Keith Medcalf

On Sunday, 12 January, 2020 18:44, Xingwei Lin  wrote:

>Is there any way can we disable the dot commands feature in sqlite?

SQLite does not process dot commands, they are commands to the shell.c SQLite 
Application program.

The current shell.c application currently does not have a way to omit the meta 
commands.

However, if you build your own you can simply search shell.c (or shell.c.in) 
for the function do_meta_command function definition and have it execute a 
"return 0;" at the top of the function after the variable declarations rather 
that process the meta command.  This will not remove the code that handles the 
meta commands but merely bypass the processing of them.

That is make it look thusly by inserting the return 0; line:

/*
** If an input line begins with "." then invoke this routine to
** process that line.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
static int do_meta_command(char *zLine, ShellState *p){
  int h = 1;
  int nArg = 0;
  int n, c;
  int rc = 0;
  char *azArg[52];

  return 0;

#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( p->expert.pExpert ){
expertFinish(p, 1, 0);
  }
#endif

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




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


Re: [sqlite] how to disable dot commands?

2020-01-12 Thread Igor Korot
Hi,

On Sun, Jan 12, 2020 at 7:44 PM Xingwei Lin  wrote:
>
> Hi,
>
> Is there any way can we disable the dot commands feature in sqlite?

Are you talking about the SQLite shell?
Why do you want to disable them? What is your specific scenario?

Thank you.

>
> --
> Best regards,
> Xingwei Lin
> ___
> 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


Re: [sqlite] how to disable dot commands?

2020-01-12 Thread Simon Slavin
On 13 Jan 2020, at 1:43am, Xingwei Lin  wrote:

> Is there any way can we disable the dot commands feature in sqlite?

SQLite – the library you call from C and other programming languages – does not 
support the dot commands.  It doesn't recognise them.  If you try to use them 
you will get a complaint about bad syntax.

The dot commands are part of the SQLite command line shell program.  Only this 
one program understands the dot commands.  The source code for this program is 
part of the SQLite download package.

You could make your own copy of that program which did not support the dot 
commands.  But that would not stop someone else from using their copy on your 
own database files.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] how to disable dot commands?

2020-01-12 Thread Xingwei Lin
Hi,

Is there any way can we disable the dot commands feature in sqlite?

-- 
Best regards,
Xingwei Lin
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users