Modified:
MYODBCShell/MYODBCShell.h
MYODBCShell/main.cpp
Log:
Modified: MYODBCShell/MYODBCShell.h
===================================================================
--- MYODBCShell/MYODBCShell.h 2006-04-18 17:26:56 UTC (rev 82)
+++ MYODBCShell/MYODBCShell.h 2006-04-18 17:39:51 UTC (rev 83)
@@ -30,8 +30,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef MYODBC_INSTALLER_H
-#define MYODBC_INSTALLER_H
+#ifndef MYODBC_SHELL_H
+#define MYODBC_SHELL_H
#include <QObject>
#include <QCoreApplication>
@@ -40,7 +40,6 @@
#include <MYODBCC.h>
-
class MYODBCShell : public QObject
{
public:
@@ -50,6 +49,8 @@
QTextStream *pstreamStdOut;
QTextStream *pstreamStdErr;
+
+protected:
int OpenDatabase( SQLHENV *phEnv, SQLHDBC *phDbc, char *szDSN, char *szUID, char
*szPWD );
int ExecuteSQL( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNames, int
bHTMLTable );
int ExecuteHelp( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNames, int
bHTMLTable );
@@ -66,9 +67,8 @@
void WriteBodyDelimited( SQLHSTMT hStmt, char cDelimiter );
void WriteFooterHTMLTable( SQLHSTMT hStmt );
void WriteFooterNormal( SQLHSTMT hStmt, SQLCHAR *szSepLine, SQLINTEGER nRows );
-
- int DumpODBCLog( SQLHENV hEnv, SQLHDBC hDbc, SQLHSTMT hStmt );
-
+ bool doShowErrors();
+// int DumpODBCLog( SQLHENV hEnv, SQLHDBC hDbc, SQLHSTMT hStmt );
};
++++++++++++++++
Modified: MYODBCShell/main.cpp
===================================================================
--- MYODBCShell/main.cpp 2006-04-18 17:26:56 UTC (rev 82)
+++ MYODBCShell/main.cpp 2006-04-18 17:39:51 UTC (rev 83)
@@ -1,19 +1,81 @@
-/*!
- \file A mysql-like console interface which uses ODBC exclusively.
-*/
+/*!
+ \file main.cpp
+ \author Peter Harvey <pharvey@stripped>
+ Copyright (C) MySQL AB 2004-2006, Released under GPL.
+ \version Connector/ODBC v5
+ \date 2006
+ \brief Command-line ODBC tool.
+ This program is a command-line tool for working with ODBC - it
+ allows statements to be submitted to a data source and displays
+ results in a variety of formats.
+
+ \license GPL
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ There are special exceptions to the terms and conditions of the GPL as it
+ is applied to this software. View the full text of the exception in file
+ EXCEPTIONS in the directory of this software distribution.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
#include "MYODBCShell.h"
-#ifdef HAVE_READLINE
- #include <readline/readline.h>
- #include <readline/history.h>
-#endif
-#ifdef HAVE_SETLOCALE
- #ifdef HAVE_LOCALE_H
- #include <locale.h>
- #endif
-#endif
+MYODBCShell *pShell = NULL;
+int doShowSyntax( QTextStream *pstream )
+{
+ (*pstream) << "+---" << endl;
+ (*pstream) << "| MYODBCShell v" << MYODBC_DRIVER_VER << endl;
+ (*pstream) << "+---" << endl;
+ (*pstream) << "|" << endl;
+ (*pstream) << "| Syntax" << endl;
+ (*pstream) << "|" << endl;
+ (*pstream) << "| MYODBCShell DSN | CONNECT_STRING [UID [PWD]] [options]"
<< endl;
+ (*pstream) << "|" << endl;
+ (*pstream) << "| Options" << endl;
+ (*pstream) << "|" << endl;
+ (*pstream) << "| -r Use SQLDriverConnect to connect" << endl;
+ (*pstream) << "| and use STR as connection string" <<
endl;
+ (*pstream) << "| -b batch.(no prompting etc)" << endl;
+ (*pstream) << "| -dx delimit columns with x" << endl;
+ (*pstream) << "| -x0xXX delimit columns with XX, where " << endl;
+ (*pstream) << "| x is in hex, ie 0x09 is tab " << endl;
+ (*pstream) << "| -w wrap results in an HTML table " << endl;
+ (*pstream) << "| -c column names on first row. " << endl;
+ (*pstream) << "| (only used when -d) " << endl;
+ (*pstream) << "| -mn limit column display width to n" << endl;
+ (*pstream) << "| -v verbose. " << endl;
+ (*pstream) << "| -lx set locale to x " << endl;
+ (*pstream) << "| --version version " << endl;
+ (*pstream) << "|" << endl;
+ (*pstream) << "| Examples" << endl;
+ (*pstream) << "|" << endl;
+ (*pstream) << "| Batch mode..." << endl;
+ (*pstream) << "| cat My.sql | MYODBCShell mydsn myid mypwd -w -b"
<< endl;
+ (*pstream) << "|" << endl;
+ (*pstream) << "| Connect string using SQLDriverConnect..." << endl;
+ (*pstream) << "| MYODBCShell 'DRIVER=myodbc3;DSN=test;UID=uid;PWD=pwd'
-r" << endl;
+ (*pstream) << "+---" << endl;
+
+ return 1;
+}
+
+
++++++++++++++++++
+
int bDriverConnect = 0;
int bVerbose = 0;
int nUserWidth = 0;
| Thread |
|---|
| • Connector/ODBC 5 commit: r83 - MYODBCShell | pharvey | 18 Apr |