A minor patch for fisql
Merle Reinhart <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
All, Where I work, we have found it useful to be able to pass the database to open on the fisql commandline. I have used the -D switch to allow this as that is what Sybase's isql and SQSH use. Anyway, the attached patch file patches fisql.c to add the new switch and fisql.txt to update the man page. Merle Reinhart _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds
fisql.patch
(application/octet-stream, 2.3 KB)
--- src/apps/fisql/fisql.c_orig 2009-09-24 10:55:52.000000000 -0400
+++ src/apps/fisql/fisql.c 2009-09-24 11:08:05.000000000 -0400
@@ -266,7 +266,8 @@
int printedcompute = 0;
BYTE *bylist;
int nby;
- char adash;
+ char adash;
+ const char *database_name = NULL;
editor = getenv("EDITOR");
if (!editor) {
@@ -278,7 +279,7 @@
opterr = 0;
optarg = NULL;
- while (!errflg && (c = getopt(argc, argv, "eFgpnvXYa:c:E:h:H:i:I:J:l:m:o:P:s:S:t:U:w:y:z:A:"))
+ while (!errflg && (c = getopt(argc, argv, "eFgpnvXYa:c:D:E:h:H:i:I:J:l:m:o:P:s:S:t:U:w:y:z:A:"))
!= -1) {
switch (c) {
case 'e':
@@ -374,9 +375,12 @@
case 'z':
language = optarg;
break;
- case 'A':
+ case 'A':
size = atoi(optarg);
break;
+ case 'D':
+ database_name = optarg;
+ break;
default:
errflg++;
break;
@@ -385,7 +389,7 @@
if (errflg) {
fprintf(stderr, "usage: fisql [-e] [-F] [-g] [-p] [-n] [-v] [-X] [-Y]\n");
- fprintf(stderr, "\t[-a display_charset] [-c cmdend] [-E editor]\n");
+ fprintf(stderr, "\t[-a display_charset] [-c cmdend] [-D database_name] [-E editor]\n");
fprintf(stderr, "\t[-h headers] [-H hostname] [-i inputfile]\n");
fprintf(stderr, "\t[-I interfaces_file] [-J client character set]\n");
fprintf(stderr, "\t[-l login_timeout] [-m errorlevel]\n");
@@ -489,6 +493,9 @@
if (perfstats) {
dbsetopt(dbproc, DBSTAT, "time", 0);
}
+ if (database_name) {
+ dbuse(dbproc, database_name);
+ }
while (1) {
if (sigsetjmp(restart, 1)) {
--- doc/fisql.txt_orig 2010-11-03 15:13:16.000000000 -0400
+++ doc/fisql.txt 2010-11-04 12:20:02.000000000 -0400
@@ -4,7 +4,8 @@
SYNOPSIS
fisql [-e] [-F] [-g] [-p] [-n] [-v] [-X] [-Y]
- \[a] [-a display_charset] [-c cmdend] [-E editor]
+ \[a] [-a display_charset] [-c cmdend]
+ \[a] [-D database] [-E editor]
\[a] [-h headers] [-H hostname] [-i inputfile]
\[a] [-I interfaces_file] [-J client_charset]
\[a] [-l login_timeout] [-m errorlevel]
@@ -24,6 +25,8 @@
-a display_charset The client charset name. Not implemented.
-c cmdend Command terminator, defaults to go.
+
+ -D Database name on the server to use.
-e Echo SQL input (usually in outputfile)