Skip to Content.
Sympa Menu

freetds - Re: [freetds] tsql script file patch

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Carlo Simeone <simeo AT simeosoft.com>
  • To: brian AT bruns.com, FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Cc:
  • Subject: Re: [freetds] tsql script file patch
  • Date: Tue, 15 Feb 2005 13:02:24 +0100


Il mar, 2005-02-15 alle 11:55, Brian Bruns ha scritto:
> 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
>
Just to be "case-compatible" with other options :-)
Let's be "f", I agree.

We could play also with header and footer options but
it's not worth,,

-----------
pccarlo:/usr/local/freetds-0.63.dev.20040621/src/apps # diff -u tsql.c
tsql.c.old
--- tsql.c 2005-02-15 12:57:53.755320211 +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 #


>
> 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:
> >


--
Carlo Simeone





Archive powered by MHonArc 2.6.24.

Top of Page