freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Brian Bruns <brian.bruns AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] tsql script file patch
- Date: Tue, 15 Feb 2005 05:55:58 -0500
Any particular reason for capital F? lowercase -f in standard for
input file on many (most?) unix programs (sed, awk, tar, etc...), I'd
like to follow the convention. Makes life easier on users.
Brian
On Tue, 15 Feb 2005 11:01:57 +0100, Carlo Simeone <simeo AT simeosoft.com> wrote:
>
> This patch allow to execute arbitrary scripts via tsql in a
> non-interactive way using a simple syntax like:
>
> tsql .... -F <script name>
>
> If you thnk this could be useful here is the patch:
> ---------------------------
> pccarlo:/usr/local/freetds-0.63.dev.20040621/src/apps # diff -u tsql.c
> tsql.c.old
> --- tsql.c 2005-02-15 10:35:20.206870516 +0100
> +++ tsql.c.old 2005-02-14 17:33:42.000000000 +0100
> @@ -77,8 +77,6 @@
> OPT_NOHEADER = 0x08
> };
>
> -char *scriptfile = NULL;
> -
> int do_query(TDSSOCKET * tds, char *buf, int opt_flags);
> static void tsql_print_usage(const char *progname);
> int get_opt_flags(char *s, int *opt_flags);
> @@ -218,7 +216,7 @@
> tsql_print_usage(const char *progname)
> {
> fprintf(stderr,
> - "Usage:\t%s [-S <server> | -H <hostname> -p <port>] -U
> <username> [ -P <password> ] [ -I <config file> ] [ -F <script
> file>\n\t%s -C\n",
> + "Usage:\t%s [-S <server> | -H <hostname> -p <port>] -U
> <username> [ -P <password> ] [ -I <config file> ]\n\t%s -C\n",
> progname, progname);
> }
>
> @@ -294,7 +292,7 @@
> printf("using default charset \"%s\"\n", charset);
> }
>
> - while ((opt = getopt(argc, argv, "H:S:I:V::P:U:p:vCF:")) != -1)
> {
> + while ((opt = getopt(argc, argv, "H:S:I:V::P:U:p:vC")) != -1) {
> switch (opt) {
> case 'H':
> hostname = (char *) malloc(strlen(optarg) + 1);
> @@ -334,10 +332,6 @@
> "iODBC:", settings->iodbc ? "yes" : "no",
> "unixodbc:", settings->unixodbc ? "yes" : "no");
> exit(0);
> break;
> - case 'F':
> - scriptfile = (char *) malloc(strlen(optarg) +
> 1);
> - strcpy(scriptfile, optarg);
> - break;
> default:
> tsql_print_usage(argv[0]);
> exit(1);
> @@ -497,14 +491,6 @@
> mybuf = (char *) malloc(bufsz);
> mybuf[0] = '\0';
>
> - /* if scriptfile is not null is a batch */
> - if (scriptfile != NULL) {
> - line = 0;
> - slurp_input_file(scriptfile, &mybuf, &bufsz, &line);
> - do_query(tds, mybuf, opt_flags);
> - return 0;
> - }
> -
> for (;;) {
> sprintf(prompt, "%d> ", ++line);
> if (s)
> pccarlo:/usr/local/freetds-0.63.dev.20040621/src/apps #
>
> ---------------------------
> --
> Carlo Simeone
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
-
[freetds] Re: FreeTDS Digest, Vol 25, Issue 15,
Michael David, 02/14/2005
- <Possible follow-up(s)>
- RE: [freetds] Re: FreeTDS Digest, Vol 25, Issue 15, ZIGLIO, Frediano, VF-IT, 02/15/2005
-
RE: [freetds] Re: FreeTDS Digest, Vol 25, Issue 15,
ZIGLIO, Frediano, VF-IT, 02/15/2005
-
[freetds] tsql script file patch,
Carlo Simeone, 02/15/2005
-
Re: [freetds] tsql script file patch,
Brian Bruns, 02/15/2005
- Re: [freetds] tsql script file patch, Carlo Simeone, 02/15/2005
-
Re: [freetds] tsql script file patch,
James K. Lowden, 02/15/2005
-
Re: [freetds] tsql script file patch,
Brian Bruns, 02/15/2005
- Re: [freetds] tsql script file patch, Craig Berry, 02/15/2005
- Re: [freetds] tsql script file patch, Carlo Simeone, 02/16/2005
-
Re: [freetds] tsql script file patch,
Brian Bruns, 02/15/2005
-
Re: [freetds] tsql script file patch,
Brian Bruns, 02/15/2005
-
[freetds] tsql script file patch,
Carlo Simeone, 02/15/2005
Archive powered by MHonArc 2.6.24.