List:GUI Tools« Previous MessageNext Message »
From:jorge Date:April 26 2002 12:57am
Subject:bk commit - MyCC
View as plain text  
Below is the list of changes that have just been commited into a local
MyCC repository of 'jorge'. When 'jorge' does a push, they will
be propogaged to the main repository and within 24 hours after the push
into the public repository. 

ChangeSet@stripped, 2002-04-25 18:57:49-06:00, jorge@stripped
  Globals.cpp:
    Added global options used by the query tab in CGeneralConfig
  CSqlTable.cpp:
    Cleanup
  CMySQLQuery.cpp:
    Added several static members that parse queries.
  CGeneralConfig.cpp:
    Added Query config tab
  CQueryWindow.cpp:
    Added automatic LIMIT option
  CTableSpecific.cpp:
    CTableSpecific::QueryWindow now has the ability to open a table without executing the inicial select statement.
  p_QueryConfig.ui:
    new file

  include/CQueryWindow.h
    1.9 02/04/25 18:55:52 jorge@stripped +2 -0

  include/Globals.h
    1.11 02/04/25 18:55:52 jorge@stripped +7 -0

  include/CGeneralConfig.h
    1.3 02/04/25 18:55:51 jorge@stripped +27 -0

  include/CMySQLConnection.h
    1.9 02/04/25 18:55:51 jorge@stripped +1 -0

  include/CMySQLQuery.h
    1.10 02/04/25 18:55:50 jorge@stripped +3 -2

  src/CListViewProperties.cpp
    1.6 02/04/25 18:55:25 jorge@stripped +5 -5

  src/CMySQLConnection.cpp
    1.13 02/04/25 18:55:21 jorge@stripped +13 -0

  src/Globals.cpp
    1.11 02/04/25 18:54:57 jorge@stripped +25 -0
    Added global options used by the query tab in CGeneralConfig

  src/CSqlTable.cpp
    1.33 02/04/25 18:54:46 jorge@stripped +10 -8
    Cleanup

  src/CMySQLQuery.cpp
    1.18 02/04/25 18:54:19 jorge@stripped +70 -23
    Added several static members that parse queries.

  src/CGeneralConfig.cpp
    1.11 02/04/25 18:54:10 jorge@stripped +390 -252
    Added Query config tab

  src/CTableTools.cpp
    1.9 02/04/25 18:53:43 jorge@stripped +3 -4

  src/CQueryWindow.cpp
    1.25 02/04/25 18:53:26 jorge@stripped +60 -9
    Added automatic LIMIT option

  src/CTableSpecific.cpp
    1.12 02/04/25 18:48:48 jorge@stripped +4 -3
    CTableSpecific::QueryWindow now has the ability to open a table without executing the inicial select statement.

  ui/p_QueryConfig.ui
    1.2 02/04/24 18:19:03 jorge@stripped +33 -38

  ui/p_QueryConfig.ui
    1.1 02/04/24 10:41:24 jorge@stripped +218 -0

  ui/p_QueryConfig.ui
    1.0 02/04/24 10:41:24 jorge@stripped +0 -0
    BitKeeper file /my/mycc/ui/p_QueryConfig.ui

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jorge
# Host:	linux.jorge.mysql.com
# Root:	/my/mycc
--- New file ---
+++ ui/p_QueryConfig.ui	02/04/24 10:41:24
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>p_QueryConfig</class>
<widget class="QWidget">
    <property name="name">
        <cstring>p_QueryConfig</cstring>
    </property>
    <property name="geometry">
        <rect>
            <x>0</x>
            <y>0</y>
            <width>346</width>
            <height>261</height>
        </rect>
    </property>
    <property name="caption">
        <string>Queries</string>
    </property>
    <grid>
        <property name="name">
            <cstring>unnamed</cstring>
        </property>
        <property name="margin">
            <number>4</number>
        </property>
        <property name="spacing">
            <number>2</number>
        </property>
        <widget class="QButtonGroup" row="2" column="0" rowspan="1" colspan="3">
            <property name="name">
                <cstring>CommentsBox</cstring>
            </property>
            <property name="title">
                <string>Default Comment Style</string>
            </property>
            <property name="whatsThis" stdset="0">
                <string>This is the commenting style which will be used by default.</string>
            </property>
            <grid>
                <property name="name">
                    <cstring>unnamed</cstring>
                </property>
                <property name="margin">
                    <number>11</number>
                </property>
                <property name="spacing">
                    <number>6</number>
                </property>
                <widget class="QRadioButton" row="0" column="0">
                    <property name="name">
                        <cstring>hashComments</cstring>
                    </property>
                    <property name="text">
                        <string>Hash [ # Comment ]</string>
                    </property>
                    <property name="whatsThis" stdset="0">
                        <string>When selected, the Hash commenting style will be used.

Hash comments look as follows:

# Commented text</string>
                    </property>
                </widget>
                <widget class="QRadioButton" row="1" column="0">
                    <property name="name">
                        <cstring>dashComments</cstring>
                    </property>
                    <property name="text">
                        <string>Dash [ -- Comment ]</string>
                    </property>
                    <property name="whatsThis" stdset="0">
                        <string>When selected, the Dash commenting style will be used.

Dash comments look as follows:

 -- Commented text</string>
                    </property>
                </widget>
                <widget class="QRadioButton" row="2" column="0">
                    <property name="name">
                        <cstring>cComments</cstring>
                    </property>
                    <property name="text">
                        <string>C-Style [ /* Comment */ ]</string>
                    </property>
                    <property name="whatsThis" stdset="0">
                        <string>When selected, the C-Style commenting style will be used.

C-Style comments look as follows:

/* Commented text */</string>
                    </property>
                </widget>
            </grid>
        </widget>
        <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="3">
            <property name="name">
                <cstring>OpenTablesBox</cstring>
            </property>
            <property name="title">
                <string>Open Table Options</string>
            </property>
            <property name="whatsThis" stdset="0">
                <string>This is the action that will be taken when one double-clicks on a Table in the database tree</string>
            </property>
            <grid>
                <property name="name">
                    <cstring>unnamed</cstring>
                </property>
                <property name="margin">
                    <number>11</number>
                </property>
                <property name="spacing">
                    <number>6</number>
                </property>
                <widget class="QRadioButton" row="1" column="0">
                    <property name="name">
                        <cstring>onlySqlStatement</cstring>
                    </property>
                    <property name="text">
                        <string>Do not execute the query</string>
                    </property>
                    <property name="whatsThis" stdset="0">
                        <string>This option will automatically issue a SELECT * FROM Table statement but will not execute the query.</string>
                    </property>
                </widget>
                <widget class="QRadioButton" row="0" column="0">
                    <property name="name">
                        <cstring>allRecords</cstring>
                    </property>
                    <property name="text">
                        <string>Retrieve all records</string>
                    </property>
                    <property name="whatsThis" stdset="0">
                        <string>This option will automatically execute a SELECT * FROM Table statement to retreive all the records in a Table.</string>
                    </property>
                </widget>
            </grid>
        </widget>
        <widget class="QCheckBox" row="0" column="0">
            <property name="name">
                <cstring>limitQueries</cstring>
            </property>
            <property name="text">
                <string>Automatically limit SELECT queries to</string>
            </property>
            <property name="whatsThis" stdset="0">
                <string>This option will append the LIMIT directive to SELECT queries if it hasn't been defined already.</string>
            </property>
        </widget>
        <spacer row="3" column="0">
            <property name="name" stdset="0">
                <cstring>Spacer2</cstring>
            </property>
            <property name="orientation">
                <enum>Vertical</enum>
            </property>
            <property name="sizeType">
                <enum>Expanding</enum>
            </property>
            <property name="sizeHint">
                <size>
                    <width>20</width>
                    <height>20</height>
                </size>
            </property>
        </spacer>
        <widget class="QSpinBox" row="0" column="1">
            <property name="name">
                <cstring>limitSpinBox</cstring>
            </property>
            <property name="maxValue">
                <number>1000000000</number>
            </property>
            <property name="minValue">
                <number>1</number>
            </property>
            <property name="value">
                <number>1000</number>
            </property>
            <property name="whatsThis" stdset="0">
                <string>This is the maximum number of records that will be retrieved when a SELECT query is executed.</string>
            </property>
        </widget>
        <spacer row="0" column="2">
            <property name="name" stdset="0">
                <cstring>Spacer1</cstring>
            </property>
            <property name="orientation">
                <enum>Horizontal</enum>
            </property>
            <property name="sizeType">
                <enum>Expanding</enum>
            </property>
            <property name="sizeHint">
                <size>
                    <width>20</width>
                    <height>20</height>
                </size>
            </property>
        </spacer>
    </grid>
</widget>
<tabstops>
    <tabstop>limitQueries</tabstop>
    <tabstop>limitSpinBox</tabstop>
    <tabstop>allRecords</tabstop>
    <tabstop>onlySqlStatement</tabstop>
    <tabstop>hashComments</tabstop>
    <tabstop>dashComments</tabstop>
    <tabstop>cComments</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
</UI>


--- 1.2/include/CGeneralConfig.h	Thu Jan  3 15:59:19 2002
+++ 1.3/include/CGeneralConfig.h	Thu Apr 25 18:55:51 2002
@@ -37,6 +37,33 @@
 class QListBox;
 class QListBoxItem;
 class privateTabConfig;
+class QButtonGroup;
+class QRadioButton;
+
+class p_QueryConfig : public privateTabConfig
+{ 
+  Q_OBJECT
+    
+public:
+  p_QueryConfig( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+  void setDefaultValues(CConfig * conn = 0);
+  bool save(CConfig *conn);
+  
+private:
+  QButtonGroup* CommentsBox;
+  QRadioButton* hashComments;
+  QRadioButton* dashComments;
+  QRadioButton* cComments;
+  QButtonGroup* OpenTablesBox;
+  QRadioButton* onlySqlStatement;
+  QRadioButton* allRecords;
+  QCheckBox* limitQueries;
+  QSpinBox* limitSpinBox;
+  QGridLayout* p_QueryConfigLayout;
+  QGridLayout* CommentsBoxLayout;
+  QGridLayout* OpenTablesBoxLayout;
+  void init();
+};
 
 class p_SyntaxHighlight : public privateTabConfig
 { 

--- 1.8/include/CMySQLConnection.h	Thu Apr 18 22:50:09 2002
+++ 1.9/include/CMySQLConnection.h	Thu Apr 25 18:55:51 2002
@@ -77,6 +77,7 @@
 
   bool setDatabaseName(const QString & dbname);
   QString getDatabaseName() {return m_DatabaseName; }
+  QString getRealDatabaseName();
 
   QString getFieldSeparator(bool escape = false);
   QString getFieldEncloser(bool escape = false);

--- 1.9/include/CMySQLQuery.h	Thu Apr 18 12:13:03 2002
+++ 1.10/include/CMySQLQuery.h	Thu Apr 25 18:55:50 2002
@@ -27,6 +27,7 @@
 class CMySQLQuery
 {
 public:
+  enum stripQueryType { STRIP_COMMENTS, GET_QUERY_TYPE };
   CMySQLQuery(CMySQLConnection *conn);
   ~CMySQLQuery();
   void freeResult();
@@ -42,8 +43,8 @@
   bool exec_static(const QString &qry, bool showAffected=false, bool *printedMessage=0, bool showError=true);
   const QString Row(unsigned int idx);
   bool printAffectedRows(bool isSelectQuery, bool printAffected, bool showError=true, const QString &time = QString::null);  
-  static bool ColumnQuery (QStringList &list, CMySQLConnection *m, const QString &qry, unsigned int r=0, bool blocking = false, bool showError = true);
-  static QString getQueryType(const QString &q=QString::null);
+  static bool ColumnQuery (QStringList &list, CMySQLConnection *m, const QString &qry, unsigned int r=0, bool blocking = false, bool showError = true);  
+  static QString stripQuery(const QString &q, stripQueryType type = STRIP_COMMENTS);
   void dataSeek(unsigned long r);
   unsigned long getFieldLength(unsigned int index);
   void export_current_row(QTextStream& ts, QString& sep,

--- 1.8/include/CQueryWindow.h	Mon Apr  1 12:08:54 2002
+++ 1.9/include/CQueryWindow.h	Thu Apr 25 18:55:52 2002
@@ -84,6 +84,8 @@
   void ReloadHistoryList();
   void doExecuteQuery(const QString &);
   void setQuery(const QString &);
+  void setWindowCaption();
+  void finishedExecuteQuery(const QString &qryType = QString::null);
   
 protected:
   QHBoxLayout* CQueryWindowLayout;

--- 1.10/include/Globals.h	Fri Feb 22 00:48:04 2002
+++ 1.11/include/Globals.h	Thu Apr 25 18:55:52 2002
@@ -47,15 +47,21 @@
 class CMessagePanel;
 class CMyWindow;
 
+enum g_CommentType { NO_COMMENT, HASH_COMMENT, C_COMMENT, DASH_COMMENT };
+
 extern int g_widgetID;
 extern int g_serverID;
 extern int g_historySize;
+extern int g_limitSelectQueriesNumber;
 extern bool g_isMDI;
 extern bool g_saveWorkspace;
 extern bool g_confirmCritical;
 extern bool g_syntaxHighlight;
 extern bool g_parenthesesMatching;
 extern bool g_completion;
+extern bool g_limitSelectQueries;
+extern bool g_retriveAllRecordsFromTable;
+extern g_CommentType g_commentType;
 extern QFont g_printerFont;
 extern QString g_errorSoundFile;
 extern QString g_informationSoundFile;
@@ -79,6 +85,7 @@
 
 extern const QPixmap getPixmapIcon(const QString &name);
 extern void playSound(const QString &fileName);
+extern QString commentText (const QString &text, const QString &eol = "\n", g_CommentType type = NO_COMMENT );
 extern bool tempFileName(const QString &path, QString &tmp);
 extern QString capitalize(const QString &s);
 extern void freeResources();

--- 1.10/src/CGeneralConfig.cpp	Fri Feb 22 00:47:57 2002
+++ 1.11/src/CGeneralConfig.cpp	Thu Apr 25 18:54:10 2002
@@ -32,6 +32,8 @@
 #include <qfiledialog.h>
 #include <qcolordialog.h>
 #include <qfontdatabase.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
 #include <qmessagebox.h>
 
 #include "CGeneralConfig.h"
@@ -39,109 +41,239 @@
 #include "CConfig.h"
 #include "Config.h"
 
-p_SyntaxHighlight::p_SyntaxHighlight( QWidget* parent,  const char* name, WFlags fl )
-: privateTabConfig(parent, name, fl )
+p_QueryConfig::p_QueryConfig(QWidget* parent,  const char* name, WFlags fl)
+: privateTabConfig(parent, name, fl)
 {
-  if ( !name )
-    setName( "p_SyntaxHighlight" );
-  setCaption( tr( "Syntax Highlighting" ) );
-  p_SyntaxHighlightLayout = new QHBoxLayout( this, 4, 2, "p_SyntaxHighlightLayout"); 
+  if (!name)
+    setName("p_QueryConfig");  
+  setCaption(tr("Queries"));
+  p_QueryConfigLayout = new QGridLayout(this, 1, 1, 4, 2, "p_QueryConfigLayout"); 
+  
+  CommentsBox = new QButtonGroup(this, "CommentsBox");
+  CommentsBox->setTitle(tr("Default Comment Style"));
+  QWhatsThis::add(CommentsBox, tr("This is the commenting style which will be used by default."));
+  CommentsBox->setColumnLayout(0, Qt::Vertical);
+  CommentsBox->layout()->setSpacing(6);
+  CommentsBox->layout()->setMargin(11);
+  CommentsBoxLayout = new QGridLayout(CommentsBox->layout());
+  CommentsBoxLayout->setAlignment(Qt::AlignTop);
+  
+  hashComments = new QRadioButton(CommentsBox, "hashComments");
+  hashComments->setText(tr("Hash [ # Comment ]"));
+  QWhatsThis::add(hashComments, tr("When selected, the Hash commenting style will be used.\n"
+    "\n"
+    "Hash comments look as follows:\n"
+    "\n"
+    "# Commented text"));
+  
+  CommentsBoxLayout->addWidget(hashComments, 0, 0);
+  
+  dashComments = new QRadioButton(CommentsBox, "dashComments");
+  dashComments->setText(tr("Dash [ -- Comment ]"));
+  QWhatsThis::add(dashComments, tr("When selected, the Dash commenting style will be used.\n"
+    "\n"
+    "Dash comments look as follows:\n"
+    "\n"
+    " -- Commented text"));
+  
+  CommentsBoxLayout->addWidget(dashComments, 1, 0);
+  
+  cComments = new QRadioButton(CommentsBox, "cComments");
+  cComments->setText(tr("C-Style [ /* Comment */ ]"));
+  QWhatsThis::add(cComments, tr("When selected, the C-Style commenting style will be used.\n"
+    "\n"
+    "C-Style comments look as follows:\n"
+    "\n"
+    "/* Commented text */"));
+  
+  CommentsBox->insert(hashComments, HASH_COMMENT);
+  CommentsBox->insert(dashComments, DASH_COMMENT);
+  CommentsBox->insert(cComments, C_COMMENT);
+
+  CommentsBoxLayout->addWidget(cComments, 2, 0);
+  
+  p_QueryConfigLayout->addMultiCellWidget(CommentsBox, 2, 2, 0, 2);
+  
+  OpenTablesBox = new QButtonGroup(this, "OpenTablesBox");
+  OpenTablesBox->setTitle(tr("Open Table Options"));
+  QWhatsThis::add(OpenTablesBox, tr("This is the action that will be taken when one double-clicks on a Table in the database tree"));
+  OpenTablesBox->setColumnLayout(0, Qt::Vertical);
+  OpenTablesBox->layout()->setSpacing(6);
+  OpenTablesBox->layout()->setMargin(11);
+  OpenTablesBoxLayout = new QGridLayout(OpenTablesBox->layout());
+  OpenTablesBoxLayout->setAlignment(Qt::AlignTop);
+  
+  onlySqlStatement = new QRadioButton(OpenTablesBox, "onlySqlStatement");
+  onlySqlStatement->setText(tr("Do not execute the query"));
+  QWhatsThis::add(onlySqlStatement, tr("This option will automatically issue a SELECT * FROM Table statement but will not execute the query."));
+  
+  OpenTablesBoxLayout->addWidget(onlySqlStatement, 1, 0);
+  
+  allRecords = new QRadioButton(OpenTablesBox, "allRecords");
+  allRecords->setText(tr("Retrieve all records"));
+  QWhatsThis::add(allRecords, tr("This option will automatically execute a SELECT * FROM Table statement to retreive all the records in a Table."));
+  
+  OpenTablesBoxLayout->addWidget(allRecords, 0, 0);
+  
+  p_QueryConfigLayout->addMultiCellWidget(OpenTablesBox, 1, 1, 0, 2);
+  
+  limitQueries = new QCheckBox(this, "limitQueries");
+  limitQueries->setText(tr("Automatically limit SELECT queries to"));
+  QWhatsThis::add(limitQueries, tr("This option will append the LIMIT directive to SELECT queries if it hasn't been defined already."));
+  
+  p_QueryConfigLayout->addWidget(limitQueries, 0, 0);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+  p_QueryConfigLayout->addItem(spacer, 3, 0);
+  
+  limitSpinBox = new QSpinBox(this, "limitSpinBox");
+  limitSpinBox->setMaxValue(0xFFFF);
+  limitSpinBox->setMinValue(1);
+  QWhatsThis::add(limitSpinBox, tr("This is the maximum number of records that will be retrieved when a SELECT query is executed."));
+  
+  p_QueryConfigLayout->addWidget(limitSpinBox, 0, 1);
+  QSpacerItem* spacer_2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  p_QueryConfigLayout->addItem(spacer_2, 0, 2);
+  
+  // tab order
+  setTabOrder(limitQueries, limitSpinBox);
+  setTabOrder(limitSpinBox, allRecords);
+  setTabOrder(allRecords, onlySqlStatement);
+  setTabOrder(onlySqlStatement, hashComments);
+  setTabOrder(hashComments, dashComments);
+  setTabOrder(dashComments, cComments);
+  init();
+  setDefaultValues();
+}
+
+void p_QueryConfig::setDefaultValues(CConfig *)
+{    
+  limitQueries->setChecked(g_limitSelectQueries);
+  limitSpinBox->setValue(g_limitSelectQueriesNumber);
+  limitSpinBox->setEnabled(g_limitSelectQueries);
+  if (g_retriveAllRecordsFromTable)
+    allRecords->setChecked(true);
+  else
+    onlySqlStatement->setChecked(true);
+  ((QRadioButton *)CommentsBox->find((int) g_commentType))->setChecked(true);
+}
+
+bool p_QueryConfig::save(CConfig *conn)
+{
+  bool ret = conn->writeEntry("Limit Select Queries", booltostr(limitQueries->isChecked()));
+  ret &= conn->writeEntry("Limit Select Queries Number",limitSpinBox->value());
+  ret &= conn->writeEntry("Retrieve All Records From Table", booltostr(allRecords->isChecked()));
+  ret &= conn->writeEntry("Comment Style", CommentsBox->id(CommentsBox->selected()));
+  return ret;
+}
+
+void p_QueryConfig::init()
+{
+  connect(limitQueries, SIGNAL(toggled(bool)), limitSpinBox, SLOT(setEnabled(bool)));  
+}
+
+p_SyntaxHighlight::p_SyntaxHighlight(QWidget* parent,  const char* name, WFlags fl)
+: privateTabConfig(parent, name, fl)
+{
+  if (!name)
+    setName("p_SyntaxHighlight");
+  setCaption(tr("Syntax Highlighting"));
+  p_SyntaxHighlightLayout = new QHBoxLayout(this, 4, 2, "p_SyntaxHighlightLayout"); 
   
-  Sections = new QListBox( this, "Sections" );
+  Sections = new QListBox(this, "Sections");
   Sections->setSelectionMode(QListBox::Extended);
-  QWhatsThis::add( Sections, tr( "Available Sections for the SQL Editor" ) );
-  p_SyntaxHighlightLayout->addWidget( Sections );
+  QWhatsThis::add(Sections, tr("Available Sections for the SQL Editor"));
+  p_SyntaxHighlightLayout->addWidget(Sections);
   
-  Layout12 = new QGridLayout( 0, 1, 1, 0, 6, "Layout12"); 
+  Layout12 = new QGridLayout(0, 1, 1, 0, 6, "Layout12"); 
   
-  Preview = new QLineEdit( this, "Preview" );
-  Preview->setMinimumSize( QSize( 0, 50 ) );
-  Preview->setMargin( 1 );
-  Preview->setText( tr( "Jorge@stripped" ) );
-  QWhatsThis::add( Preview, tr( "Preview of this section." ) );
+  Preview = new QLineEdit(this, "Preview");
+  Preview->setMinimumSize(QSize(0, 50));
+  Preview->setMargin(1);
+  Preview->setText(tr("Jorge@stripped"));
+  QWhatsThis::add(Preview, tr("Preview of this section."));
   
-  Layout12->addMultiCellWidget( Preview, 3, 3, 1, 5 );
+  Layout12->addMultiCellWidget(Preview, 3, 3, 1, 5);
   
-  Underline = new QCheckBox( this, "Underline" );
-  Underline->setText( tr( "Underline" ) );
-  QWhatsThis::add( Underline, tr( "The font for this section will be Underlined." ) );
+  Underline = new QCheckBox(this, "Underline");
+  Underline->setText(tr("Underline"));
+  QWhatsThis::add(Underline, tr("The font for this section will be Underlined."));
   
-  Layout12->addWidget( Underline, 2, 3 );
+  Layout12->addWidget(Underline, 2, 3);
   
-  sizeLabel = new QLabel( this, "sizeLabel" );
-  sizeLabel->setText( tr( "Size" ) );
+  sizeLabel = new QLabel(this, "sizeLabel");
+  sizeLabel->setText(tr("Size"));
   
-  Layout12->addWidget( sizeLabel, 1, 0 );
+  Layout12->addWidget(sizeLabel, 1, 0);
   
-  Size = new QSpinBox( this, "Size" );  
+  Size = new QSpinBox(this, "Size");  
 
-  Size->setMaxValue( 30 );
-  Size->setMinValue( 0 );
-  Size->setValue( 8 );
+  Size->setMaxValue(30);
+  Size->setMinValue(0);
+  Size->setValue(8);
   Size->setSpecialValueText(" ");
-  QWhatsThis::add( Size, tr( "This is the font Size that will be used for this particular section." ) );
+  QWhatsThis::add(Size, tr("This is the font Size that will be used for this particular section."));
   
-  Layout12->addWidget( Size, 1, 1 );
+  Layout12->addWidget(Size, 1, 1);
   
-  Italic = new QCheckBox( this, "Italic" );
-  Italic->setText( tr( "Italic" ) );
-  QWhatsThis::add( Italic, tr( "The font for this section will be Italic." ) );
+  Italic = new QCheckBox(this, "Italic");
+  Italic->setText(tr("Italic"));
+  QWhatsThis::add(Italic, tr("The font for this section will be Italic."));
   
-  Layout12->addMultiCellWidget( Italic, 2, 2, 4, 5 );
+  Layout12->addMultiCellWidget(Italic, 2, 2, 4, 5);
   
-  preveiwLabel = new QLabel( this, "preveiwLabel" );
-  preveiwLabel->setText( tr( "Preview" ) );
+  preveiwLabel = new QLabel(this, "preveiwLabel");
+  preveiwLabel->setText(tr("Preview"));
   
-  Layout12->addWidget( preveiwLabel, 3, 0 );
+  Layout12->addWidget(preveiwLabel, 3, 0);
   
-  Bold = new QCheckBox( this, "Bold" );
-  Bold->setText( tr( "Bold" ) );
-  QWhatsThis::add( Bold, tr( "The font for this section will be Bold." ) );
+  Bold = new QCheckBox(this, "Bold");
+  Bold->setText(tr("Bold"));
+  QWhatsThis::add(Bold, tr("The font for this section will be Bold."));
   
-  Layout12->addMultiCellWidget( Bold, 2, 2, 1, 2 );
+  Layout12->addMultiCellWidget(Bold, 2, 2, 1, 2);
   
-  Font = new QComboBox( false, this, "Font" );
-  QWhatsThis::add( Font, tr( "This is the Font that will be used for this particular section." ) );
+  Font = new QComboBox(false, this, "Font");
+  QWhatsThis::add(Font, tr("This is the Font that will be used for this particular section."));
   
-  Layout12->addMultiCellWidget( Font, 0, 0, 1, 5 );
+  Layout12->addMultiCellWidget(Font, 0, 0, 1, 5);
   
-  Color = new QPushButton( this, "Color" );
-  Color->setMinimumSize( QSize( 19, 19 ) );
-  Color->setMaximumSize( QSize( 19, 19 ) );  
-  Color->setText( tr( "" ) );
-  QWhatsThis::add( Color, tr( "This is the font Color that will be used for this particular section." ) );
+  Color = new QPushButton(this, "Color");
+  Color->setMinimumSize(QSize(19, 19));
+  Color->setMaximumSize(QSize(19, 19));  
+  Color->setText(tr(""));
+  QWhatsThis::add(Color, tr("This is the font Color that will be used for this particular section."));
   
-  Layout12->addWidget( Color, 1, 5 );
+  Layout12->addWidget(Color, 1, 5);
   
-  fontLabel = new QLabel( this, "fontLabel" );
-  fontLabel->setText( tr( "Font" ) );
+  fontLabel = new QLabel(this, "fontLabel");
+  fontLabel->setText(tr("Font"));
   
-  Layout12->addWidget( fontLabel, 0, 0 );
-  QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
-  Layout12->addItem( spacer, 5, 1 );
+  Layout12->addWidget(fontLabel, 0, 0);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+  Layout12->addItem(spacer, 5, 1);
   
-  colorLabel = new QLabel( this, "colorLabel" );
-  colorLabel->setText( tr( "Color" ) );
-  colorLabel->setAlignment( int( QLabel::AlignVCenter ) );
+  colorLabel = new QLabel(this, "colorLabel");
+  colorLabel->setText(tr("Color"));
+  colorLabel->setAlignment(int(QLabel::AlignVCenter));
   
-  Layout12->addWidget( colorLabel, 1, 4 );
+  Layout12->addWidget(colorLabel, 1, 4);
   
-  DefaultPushButton = new QPushButton( this, "DefaultPushButton" );
-  DefaultPushButton->setText( tr( "Restore Defaults" ) );
+  DefaultPushButton = new QPushButton(this, "DefaultPushButton");
+  DefaultPushButton->setText(tr("Restore Defaults"));
   
-  Layout12->addMultiCellWidget( DefaultPushButton, 4, 4, 4, 5 );
-  QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  Layout12->addMultiCell( spacer_2, 4, 4, 2, 3 );
-  p_SyntaxHighlightLayout->addLayout( Layout12 );
+  Layout12->addMultiCellWidget(DefaultPushButton, 4, 4, 4, 5);
+  QSpacerItem* spacer_2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  Layout12->addMultiCell(spacer_2, 4, 4, 2, 3);
+  p_SyntaxHighlightLayout->addLayout(Layout12);
 
-  setTabOrder( Sections, Font );
-  setTabOrder( Font, Size );
-  setTabOrder( Size, Color );
-  setTabOrder( Color, Bold );
-  setTabOrder( Bold, Underline );
-  setTabOrder( Underline, Italic );
-  setTabOrder( Italic, Preview );
-  setTabOrder( Preview, DefaultPushButton );
+  setTabOrder(Sections, Font);
+  setTabOrder(Font, Size);
+  setTabOrder(Size, Color);
+  setTabOrder(Color, Bold);
+  setTabOrder(Bold, Underline);
+  setTabOrder(Underline, Italic);
+  setTabOrder(Italic, Preview);
+  setTabOrder(Preview, DefaultPushButton);
   
   init();
   setDefaultValues();  
@@ -153,7 +285,7 @@
   QStringList families = fdb.families();
   Font->insertStringList(families);
   QIntDictIterator<SqlFormat> it(*g_SqlEditorStyles);
-  for ( ; it.current(); ++it )
+  for (; it.current(); ++it)
   {
     Sections->insertItem(it.current()->displayName, (int) it.current()->ID);
     it.current()->setDefaults();
@@ -166,7 +298,7 @@
 {
   bool ret = true;
   QIntDictIterator<SqlFormat> it(*g_SqlEditorStyles);
-  for ( ; it.current(); ++it )
+  for (; it.current(); ++it)
     ret &= it.current()->saveToCfg(conn);
   return ret;
 }
@@ -307,7 +439,7 @@
 
 void p_SyntaxHighlight::setSectionColor()
 {
-  QColor c = QColorDialog::getColor(Color->paletteBackgroundColor(), this );
+  QColor c = QColorDialog::getColor(Color->paletteBackgroundColor(), this);
   if (c.isValid())
   {
     for (uint i=0; i < Sections->count(); i++)
@@ -350,59 +482,59 @@
   connect(DefaultPushButton, SIGNAL(clicked()), this, SLOT(DefaultPushButtonClicked()));
 }
 
-p_SqlEditor::p_SqlEditor( QWidget* parent,  const char* name, WFlags fl )
-: privateTabConfig(parent, name, fl )
+p_SqlEditor::p_SqlEditor(QWidget* parent,  const char* name, WFlags fl)
+: privateTabConfig(parent, name, fl)
 {
-  if ( !name )
-    setName( "p_SqlEditor" );
+  if (!name)
+    setName("p_SqlEditor");
   
-  setCaption( tr( "Sql Editor" ) );
-  p_SqlEditorLayout = new QGridLayout( this, 1, 1, 4, 2, "p_SqlEditorLayout"); 
+  setCaption(tr("Sql Editor"));
+  p_SqlEditorLayout = new QGridLayout(this, 1, 1, 4, 2, "p_SqlEditorLayout"); 
   
-  Parentheses = new QCheckBox( this, "Parentheses" );
-  Parentheses->setText( tr( "Enable Parentheses Matching" ) );
-  QWhatsThis::add( Parentheses, tr( "When enabled, the SQL Editor will use Parentheses Matching." ) );
+  Parentheses = new QCheckBox(this, "Parentheses");
+  Parentheses->setText(tr("Enable Parentheses Matching"));
+  QWhatsThis::add(Parentheses, tr("When enabled, the SQL Editor will use Parentheses Matching."));
   
-  p_SqlEditorLayout->addMultiCellWidget( Parentheses, 2, 2, 0, 2 );
+  p_SqlEditorLayout->addMultiCellWidget(Parentheses, 2, 2, 0, 2);
   
-  Completion = new QCheckBox( this, "Completion" );
-  Completion->setText( tr( "Enable Completion" ) );
-  QWhatsThis::add( Completion, tr( "When enabled, the SQL Editor will support Completion for SQL Keywords." ) );
+  Completion = new QCheckBox(this, "Completion");
+  Completion->setText(tr("Enable Completion"));
+  QWhatsThis::add(Completion, tr("When enabled, the SQL Editor will support Completion for SQL Keywords."));
   
-  p_SqlEditorLayout->addMultiCellWidget( Completion, 3, 3, 0, 2 );
+  p_SqlEditorLayout->addMultiCellWidget(Completion, 3, 3, 0, 2);
   
-  SyntaxFileLabel = new QLabel( this, "SyntaxFileLabel" );
-  SyntaxFileLabel->setText( tr( "Syntax File" ) );
+  SyntaxFileLabel = new QLabel(this, "SyntaxFileLabel");
+  SyntaxFileLabel->setText(tr("Syntax File"));
   
-  p_SqlEditorLayout->addWidget( SyntaxFileLabel, 0, 0 );
+  p_SqlEditorLayout->addWidget(SyntaxFileLabel, 0, 0);
   
-  SyntaxFile = new QLineEdit( this, "SyntaxFile" );
-  SyntaxFile->setFrameShape( QLineEdit::StyledPanel );
-  SyntaxFile->setFrameShadow( QLineEdit::Sunken );
-  QWhatsThis::add( SyntaxFile, tr( "This is the File that contains the list of keywords that will be highlighted and completed by the SQL Editor." ) );
+  SyntaxFile = new QLineEdit(this, "SyntaxFile");
+  SyntaxFile->setFrameShape(QLineEdit::StyledPanel);
+  SyntaxFile->setFrameShadow(QLineEdit::Sunken);
+  QWhatsThis::add(SyntaxFile, tr("This is the File that contains the list of keywords that will be highlighted and completed by the SQL Editor."));
   
-  p_SqlEditorLayout->addWidget( SyntaxFile, 0, 1 );
+  p_SqlEditorLayout->addWidget(SyntaxFile, 0, 1);
   
-  SyntaxFileBrowse = new QPushButton( this, "SyntaxFileBrowse" );
-  SyntaxFileBrowse->setMinimumSize( QSize( 22, 22 ) );
-  SyntaxFileBrowse->setMaximumSize( QSize( 22, 22 ) );
-  SyntaxFileBrowse->setText( tr( "" ) );
+  SyntaxFileBrowse = new QPushButton(this, "SyntaxFileBrowse");
+  SyntaxFileBrowse->setMinimumSize(QSize(22, 22));
+  SyntaxFileBrowse->setMaximumSize(QSize(22, 22));
+  SyntaxFileBrowse->setText(tr(""));
   SyntaxFileBrowse->setPixmap(getPixmapIcon("openIcon"));
-  QWhatsThis::add( SyntaxFileBrowse, tr( "Select the Folder that contains the Translation Files." ));
+  QWhatsThis::add(SyntaxFileBrowse, tr("Select the Folder that contains the Translation Files."));
   
-  p_SqlEditorLayout->addWidget( SyntaxFileBrowse, 0, 2 );
+  p_SqlEditorLayout->addWidget(SyntaxFileBrowse, 0, 2);
   
-  SyntaxHighlight = new QCheckBox( this, "SyntaxHighlight" );
-  SyntaxHighlight->setText( tr( "Enable SQL Syntax Highlighting" ) );
-  QWhatsThis::add( SyntaxHighlight, tr( "When enabled, the SQL Editor will use Syntax Highlighting for SQL Keywords." ) );
-  
-  p_SqlEditorLayout->addMultiCellWidget( SyntaxHighlight, 1, 1, 0, 2 );
-  QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
-  p_SqlEditorLayout->addItem( spacer, 4, 1 );
-  setTabOrder( SyntaxFile, SyntaxFileBrowse );
-  setTabOrder( SyntaxFileBrowse, SyntaxHighlight );
-  setTabOrder( SyntaxHighlight, Parentheses );
-  setTabOrder( Parentheses, Completion );
+  SyntaxHighlight = new QCheckBox(this, "SyntaxHighlight");
+  SyntaxHighlight->setText(tr("Enable SQL Syntax Highlighting"));
+  QWhatsThis::add(SyntaxHighlight, tr("When enabled, the SQL Editor will use Syntax Highlighting for SQL Keywords."));
+  
+  p_SqlEditorLayout->addMultiCellWidget(SyntaxHighlight, 1, 1, 0, 2);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+  p_SqlEditorLayout->addItem(spacer, 4, 1);
+  setTabOrder(SyntaxFile, SyntaxFileBrowse);
+  setTabOrder(SyntaxFileBrowse, SyntaxHighlight);
+  setTabOrder(SyntaxHighlight, Parentheses);
+  setTabOrder(Parentheses, Completion);
   setDefaultValues();
   init();
 }
@@ -443,151 +575,151 @@
   connect(SyntaxHighlight, SIGNAL(toggled(bool)), Parentheses, SLOT(setEnabled(bool)));
 }
 
-p_GeneralConfig::p_GeneralConfig( QWidget* parent,  const char* name, WFlags fl )
-: privateTabConfig(parent, name, fl ), p_needRestart(false)
+p_GeneralConfig::p_GeneralConfig(QWidget* parent,  const char* name, WFlags fl)
+: privateTabConfig(parent, name, fl), p_needRestart(false)
 {
-  if ( !name )
-    setName( "p_GeneralConfig" );
-  setCaption( tr( "General" ) );
-  p_GeneralConfigLayout = new QGridLayout( this, 1, 1, 4, 2, "p_GeneralConfigLayout"); 
+  if (!name)
+    setName("p_GeneralConfig");
+  setCaption(tr("General"));
+  p_GeneralConfigLayout = new QGridLayout(this, 1, 1, 4, 2, "p_GeneralConfigLayout"); 
   
-  errorSoundFile = new QLineEdit( this, "errorSoundFile" );
-  errorSoundFile->setFrameShape( QLineEdit::StyledPanel );
-  errorSoundFile->setFrameShadow( QLineEdit::Sunken );
-  QWhatsThis::add( errorSoundFile, tr( "This is a WAV file that will be played each time an Error message occures.  If you don't want to play a sound, leave this field empty." ) );
+  errorSoundFile = new QLineEdit(this, "errorSoundFile");
+  errorSoundFile->setFrameShape(QLineEdit::StyledPanel);
+  errorSoundFile->setFrameShadow(QLineEdit::Sunken);
+  QWhatsThis::add(errorSoundFile, tr("This is a WAV file that will be played each time an Error message occures.  If you don't want to play a sound, leave this field empty."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( errorSoundFile, 1, 1, 1, 4 );
+  p_GeneralConfigLayout->addMultiCellWidget(errorSoundFile, 1, 1, 1, 4);
   
-  translationsPath = new QLineEdit( this, "translationsPath" );
-  translationsPath->setFrameShape( QLineEdit::StyledPanel );
-  translationsPath->setFrameShadow( QLineEdit::Sunken );
-  QWhatsThis::add( translationsPath, tr( "This is the Path which will be used by the application to find Language Files." ) );
+  translationsPath = new QLineEdit(this, "translationsPath");
+  translationsPath->setFrameShape(QLineEdit::StyledPanel);
+  translationsPath->setFrameShadow(QLineEdit::Sunken);
+  QWhatsThis::add(translationsPath, tr("This is the Path which will be used by the application to find Language Files."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( translationsPath, 0, 0, 1, 4 );
+  p_GeneralConfigLayout->addMultiCellWidget(translationsPath, 0, 0, 1, 4);
   
-  saveWorkspace = new QCheckBox( this, "saveWorkspace" );
-  saveWorkspace->setText( tr( "Restore last Workspace on startup" ) );
-  QWhatsThis::add( saveWorkspace, tr( "When enabled, the application will restore the last Workspace of the previous execution by automatically opening all windows and connections which where open prior shutdown." ) );
+  saveWorkspace = new QCheckBox(this, "saveWorkspace");
+  saveWorkspace->setText(tr("Restore last Workspace on startup"));
+  QWhatsThis::add(saveWorkspace, tr("When enabled, the application will restore the last Workspace of the previous execution by automatically opening all windows and connections which where open prior shutdown."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( saveWorkspace, 6, 6, 0, 2 );
+  p_GeneralConfigLayout->addMultiCellWidget(saveWorkspace, 6, 6, 0, 2);
   
-  informationSoundFile = new QLineEdit( this, "informationSoundFile" );
-  informationSoundFile->setFrameShape( QLineEdit::StyledPanel );
-  informationSoundFile->setFrameShadow( QLineEdit::Sunken );
-  QWhatsThis::add( informationSoundFile, tr( "This is a WAV file that will be played each time a Information message occures.  If you don't want to play a sound, leave this field empty." ) );
+  informationSoundFile = new QLineEdit(this, "informationSoundFile");
+  informationSoundFile->setFrameShape(QLineEdit::StyledPanel);
+  informationSoundFile->setFrameShadow(QLineEdit::Sunken);
+  QWhatsThis::add(informationSoundFile, tr("This is a WAV file that will be played each time a Information message occures.  If you don't want to play a sound, leave this field empty."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( informationSoundFile, 3, 3, 1, 4 );
+  p_GeneralConfigLayout->addMultiCellWidget(informationSoundFile, 3, 3, 1, 4);
   
-  confirmCritical = new QCheckBox( this, "confirmCritical" );
-  confirmCritical->setText( tr( "Confirm critical opperations" ) );
-  QWhatsThis::add( confirmCritical, tr( "This option will confirm critical opperations done by the client.  Such critical opperations include shutting down the application, shutting down the Server, truncate table, etc ..." ) );
+  confirmCritical = new QCheckBox(this, "confirmCritical");
+  confirmCritical->setText(tr("Confirm critical opperations"));
+  QWhatsThis::add(confirmCritical, tr("This option will confirm critical opperations done by the client.  Such critical opperations include shutting down the application, shutting down the Server, truncate table, etc ..."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( confirmCritical, 7, 7, 0, 1 );
+  p_GeneralConfigLayout->addMultiCellWidget(confirmCritical, 7, 7, 0, 1);
   
-  warningSoundFile = new QLineEdit( this, "warningSoundFile" );
-  warningSoundFile->setFrameShape( QLineEdit::StyledPanel );
-  warningSoundFile->setFrameShadow( QLineEdit::Sunken );
-  QWhatsThis::add( warningSoundFile, tr( "This is a WAV file that will be played each time a Warning message occures.  If you don't want to play a sound, leave this field empty." ) );
+  warningSoundFile = new QLineEdit(this, "warningSoundFile");
+  warningSoundFile->setFrameShape(QLineEdit::StyledPanel);
+  warningSoundFile->setFrameShadow(QLineEdit::Sunken);
+  QWhatsThis::add(warningSoundFile, tr("This is a WAV file that will be played each time a Warning message occures.  If you don't want to play a sound, leave this field empty."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( warningSoundFile, 2, 2, 1, 4 );
-  QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
-  p_GeneralConfigLayout->addItem( spacer, 8, 2 );
+  p_GeneralConfigLayout->addMultiCellWidget(warningSoundFile, 2, 2, 1, 4);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+  p_GeneralConfigLayout->addItem(spacer, 8, 2);
   
-  language = new QComboBox( FALSE, this, "language" );
-  language->setAutoCompletion( TRUE );
-  language->setDuplicatesEnabled( FALSE );
-  QWhatsThis::add( language, tr( "This will change the display Language of the Application.  If changed, one will have to restart the application for changes to take place." ) );
+  language = new QComboBox(FALSE, this, "language");
+  language->setAutoCompletion(TRUE);
+  language->setDuplicatesEnabled(FALSE);
+  QWhatsThis::add(language, tr("This will change the display Language of the Application.  If changed, one will have to restart the application for changes to take place."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( language, 4, 4, 1, 3 );
+  p_GeneralConfigLayout->addMultiCellWidget(language, 4, 4, 1, 3);
   
-  historySize = new QSpinBox( this, "historySize" );
-  historySize->setMaxValue( 1000 );
-  historySize->setValue( 200 );
-  QWhatsThis::add( historySize, tr( "This number specifies how many Queries will be saved by the History Panel in  the Query Windows." ) );
+  historySize = new QSpinBox(this, "historySize");
+  historySize->setMaxValue(1000);
+  historySize->setValue(200);
+  QWhatsThis::add(historySize, tr("This number specifies how many Queries will be saved by the History Panel in  the Query Windows."));
   
-  p_GeneralConfigLayout->addMultiCellWidget( historySize, 5, 5, 1, 2 );
-  QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  p_GeneralConfigLayout->addItem( spacer_2, 5, 3 );
-  QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  p_GeneralConfigLayout->addItem( spacer_3, 4, 4 );
+  p_GeneralConfigLayout->addMultiCellWidget(historySize, 5, 5, 1, 2);
+  QSpacerItem* spacer_2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  p_GeneralConfigLayout->addItem(spacer_2, 5, 3);
+  QSpacerItem* spacer_3 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  p_GeneralConfigLayout->addItem(spacer_3, 4, 4);
   
-  historyNumberLabel = new QLabel( this, "historyNumberLabel" );
-  historyNumberLabel->setText( tr( "History size for Queries" ) );
+  historyNumberLabel = new QLabel(this, "historyNumberLabel");
+  historyNumberLabel->setText(tr("History size for Queries"));
   
-  p_GeneralConfigLayout->addWidget( historyNumberLabel, 5, 0 );
+  p_GeneralConfigLayout->addWidget(historyNumberLabel, 5, 0);
   
-  languageLabel = new QLabel( this, "languageLabel" );
-  languageLabel->setText( tr( "Language" ) );
+  languageLabel = new QLabel(this, "languageLabel");
+  languageLabel->setText(tr("Language"));
   
-  p_GeneralConfigLayout->addWidget( languageLabel, 4, 0 );
+  p_GeneralConfigLayout->addWidget(languageLabel, 4, 0);
   
-  informationSoundLabel = new QLabel( this, "informationSoundLabel" );
-  informationSoundLabel->setText( tr( "Information Sound File" ) );
+  informationSoundLabel = new QLabel(this, "informationSoundLabel");
+  informationSoundLabel->setText(tr("Information Sound File"));
   
-  p_GeneralConfigLayout->addWidget( informationSoundLabel, 3, 0 );
+  p_GeneralConfigLayout->addWidget(informationSoundLabel, 3, 0);
   
-  warningSoundLabel = new QLabel( this, "warningSoundLabel" );
-  warningSoundLabel->setText( tr( "Warning Sound File" ) );
+  warningSoundLabel = new QLabel(this, "warningSoundLabel");
+  warningSoundLabel->setText(tr("Warning Sound File"));
   
-  p_GeneralConfigLayout->addWidget( warningSoundLabel, 2, 0 );
+  p_GeneralConfigLayout->addWidget(warningSoundLabel, 2, 0);
   
-  errorSoundLabel = new QLabel( this, "errorSoundLabel" );
-  errorSoundLabel->setText( tr( "Error Sound File" ) );
+  errorSoundLabel = new QLabel(this, "errorSoundLabel");
+  errorSoundLabel->setText(tr("Error Sound File"));
   
-  p_GeneralConfigLayout->addWidget( errorSoundLabel, 1, 0 );
+  p_GeneralConfigLayout->addWidget(errorSoundLabel, 1, 0);
   
-  translationsPathLabel = new QLabel( this, "translationsPathLabel" );
-  translationsPathLabel->setText( tr( "Translations Path" ) );
+  translationsPathLabel = new QLabel(this, "translationsPathLabel");
+  translationsPathLabel->setText(tr("Translations Path"));
   
-  p_GeneralConfigLayout->addWidget( translationsPathLabel, 0, 0 );
+  p_GeneralConfigLayout->addWidget(translationsPathLabel, 0, 0);
   
-  warningSoundBrowse = new QPushButton( this, "warningSoundBrowse" );
-  warningSoundBrowse->setMinimumSize( QSize( 22, 22 ) );
-  warningSoundBrowse->setMaximumSize( QSize( 22, 22 ) );
-  warningSoundBrowse->setText( tr( "" ) );
+  warningSoundBrowse = new QPushButton(this, "warningSoundBrowse");
+  warningSoundBrowse->setMinimumSize(QSize(22, 22));
+  warningSoundBrowse->setMaximumSize(QSize(22, 22));
+  warningSoundBrowse->setText(tr(""));
   warningSoundBrowse->setPixmap(getPixmapIcon("openIcon"));
-  QWhatsThis::add( warningSoundBrowse, tr( "Click to browse." ) );
+  QWhatsThis::add(warningSoundBrowse, tr("Click to browse."));
   
-  p_GeneralConfigLayout->addWidget( warningSoundBrowse, 2, 5 );
+  p_GeneralConfigLayout->addWidget(warningSoundBrowse, 2, 5);
   
-  informationSoundBrowse = new QPushButton( this, "informationSoundBrowse" );
-  informationSoundBrowse->setMinimumSize( QSize( 22, 22 ) );
-  informationSoundBrowse->setMaximumSize( QSize( 22, 22 ) );
-  informationSoundBrowse->setText( tr( "" ) );
+  informationSoundBrowse = new QPushButton(this, "informationSoundBrowse");
+  informationSoundBrowse->setMinimumSize(QSize(22, 22));
+  informationSoundBrowse->setMaximumSize(QSize(22, 22));
+  informationSoundBrowse->setText(tr(""));
   informationSoundBrowse->setPixmap(getPixmapIcon("openIcon"));
-  QWhatsThis::add( informationSoundBrowse, tr( "Click to browse." ) );
+  QWhatsThis::add(informationSoundBrowse, tr("Click to browse."));
   
-  p_GeneralConfigLayout->addWidget( informationSoundBrowse, 3, 5 );
+  p_GeneralConfigLayout->addWidget(informationSoundBrowse, 3, 5);
   
-  errorSoundBrowse = new QPushButton( this, "errorSoundBrowse" );
-  errorSoundBrowse->setMinimumSize( QSize( 22, 22 ) );
-  errorSoundBrowse->setMaximumSize( QSize( 22, 22 ) );
-  errorSoundBrowse->setText( tr( "" ) );
+  errorSoundBrowse = new QPushButton(this, "errorSoundBrowse");
+  errorSoundBrowse->setMinimumSize(QSize(22, 22));
+  errorSoundBrowse->setMaximumSize(QSize(22, 22));
+  errorSoundBrowse->setText(tr(""));
   errorSoundBrowse->setPixmap(getPixmapIcon("openIcon"));
-  QWhatsThis::add( errorSoundBrowse, tr( "Click to browse." ) );
+  QWhatsThis::add(errorSoundBrowse, tr("Click to browse."));
   
-  p_GeneralConfigLayout->addWidget( errorSoundBrowse, 1, 5 );
+  p_GeneralConfigLayout->addWidget(errorSoundBrowse, 1, 5);
   
-  translationsBrowse = new QPushButton( this, "translationsBrowse" );
-  translationsBrowse->setMinimumSize( QSize( 22, 22 ) );
-  translationsBrowse->setMaximumSize( QSize( 22, 22 ) );
-  translationsBrowse->setText( tr( "" ) );
+  translationsBrowse = new QPushButton(this, "translationsBrowse");
+  translationsBrowse->setMinimumSize(QSize(22, 22));
+  translationsBrowse->setMaximumSize(QSize(22, 22));
+  translationsBrowse->setText(tr(""));
   translationsBrowse->setPixmap(getPixmapIcon("openIcon"));
-  QWhatsThis::add( translationsBrowse, tr( "Click to browse." ) );
+  QWhatsThis::add(translationsBrowse, tr("Click to browse."));
   
-  p_GeneralConfigLayout->addWidget( translationsBrowse, 0, 5 );
+  p_GeneralConfigLayout->addWidget(translationsBrowse, 0, 5);
     
-  setTabOrder( translationsPath, translationsBrowse );
-  setTabOrder( translationsBrowse, errorSoundFile );
-  setTabOrder( errorSoundFile, errorSoundBrowse );
-  setTabOrder( errorSoundBrowse, warningSoundFile );
-  setTabOrder( warningSoundFile, warningSoundBrowse );
-  setTabOrder( warningSoundBrowse, informationSoundFile );
-  setTabOrder( informationSoundFile, informationSoundBrowse );
-  setTabOrder( informationSoundBrowse, language );
-  setTabOrder( language, historySize );
-  setTabOrder( historySize, saveWorkspace );
-  setTabOrder( saveWorkspace, confirmCritical );
+  setTabOrder(translationsPath, translationsBrowse);
+  setTabOrder(translationsBrowse, errorSoundFile);
+  setTabOrder(errorSoundFile, errorSoundBrowse);
+  setTabOrder(errorSoundBrowse, warningSoundFile);
+  setTabOrder(warningSoundFile, warningSoundBrowse);
+  setTabOrder(warningSoundBrowse, informationSoundFile);
+  setTabOrder(informationSoundFile, informationSoundBrowse);
+  setTabOrder(informationSoundBrowse, language);
+  setTabOrder(language, historySize);
+  setTabOrder(historySize, saveWorkspace);
+  setTabOrder(saveWorkspace, confirmCritical);
 
   setDefaultValues();
   init();
@@ -595,14 +727,14 @@
 
 bool p_GeneralConfig::save(CConfig *conn)
 {  
-  bool ret = conn->writeEntry("Translations Path", translationsPath->text().stripWhiteSpace() );
+  bool ret = conn->writeEntry("Translations Path", translationsPath->text().stripWhiteSpace());
   ret &= conn->writeEntry("Language File", language->currentText().stripWhiteSpace());
   ret &= conn->writeEntry("History Size", historySize->value());  
   ret &= conn->writeEntry("Save Workspace", booltostr(saveWorkspace->isChecked()));
   ret &= conn->writeEntry("Confirm Critical", booltostr(confirmCritical->isChecked()));
-  ret &= conn->writeEntry("Error Sound", errorSoundFile->text().stripWhiteSpace() );
-  ret &= conn->writeEntry("Warning Sound", warningSoundFile->text().stripWhiteSpace() );
-  ret &= conn->writeEntry("Information Sound", informationSoundFile->text().stripWhiteSpace() );
+  ret &= conn->writeEntry("Error Sound", errorSoundFile->text().stripWhiteSpace());
+  ret &= conn->writeEntry("Warning Sound", warningSoundFile->text().stripWhiteSpace());
+  ret &= conn->writeEntry("Information Sound", informationSoundFile->text().stripWhiteSpace());
 
   if (*g_TranslationsPath != translationsPath->text().stripWhiteSpace())  
     p_needRestart = true;  
@@ -635,7 +767,7 @@
   language->clear();
   QDir dir = QDir(path, "*.qm");
   dir.setFilter(QDir::Files);
-  dir.setSorting( QDir::Name);
+  dir.setSorting(QDir::Name);
   language->insertItem("English");
   language->insertStringList(dir.entryList());
   if ((dir.count() > 0) && (dir.exists(*g_CurrentLanguage)))
@@ -691,21 +823,22 @@
   connect(errorSoundBrowse, SIGNAL(clicked()), this, SLOT(setErrorFile()));
   connect(warningSoundBrowse, SIGNAL(clicked()), this, SLOT(setWarningFile()));
   connect(informationSoundBrowse, SIGNAL(clicked()), this, SLOT(setInformationFile()));
-  connect(translationsPath, SIGNAL( textChanged(const QString &)), this, SLOT(refreshLanguageCombo(const QString &)));
+  connect(translationsPath, SIGNAL(textChanged(const QString &)), this, SLOT(refreshLanguageCombo(const QString &)));
 }
 
 CGeneralConfig::CGeneralConfig(QWidget* parent,  const char* name)
 :CConfigDialog(parent, name)
 {
-  if ( !name )
-    setName( "CGeneralConfig" );    
+  if (!name)
+    setName("CGeneralConfig");    
   setMinimumHeight(263);  
-  setCaption( QString(CODENAME) + " - " + tr("General Configuration Dialog"));
+  setCaption(QString(CODENAME) + " - " + tr("General Configuration Dialog"));
   General = new p_GeneralConfig(Tab);
   insertTab(General);
+  insertTab(new p_QueryConfig(Tab));
   insertTab(new p_SqlEditor(Tab));
   insertTab(new p_SyntaxHighlight(Tab));
-  okPushButton->setText(tr( "&Apply"));
+  okPushButton->setText(tr("&Apply"));
   QWhatsThis::add(okPushButton, tr("Click to Apply changes."));
   myResize(421, 263);
 }
@@ -718,43 +851,43 @@
 {
   if (style== "Platinum")
   {
-    QPalette p( QColor( 239, 239, 239 ) );
+    QPalette p(QColor(239, 239, 239));
     qApp->setPalette(p, true);
   }
   else
     if (style == "CDE")
     {
-      QPalette p( QColor( 75, 123, 130 ) );
-      p.setColor( QPalette::Active, QColorGroup::Base, QColor( 55, 77, 78 ) );
-      p.setColor( QPalette::Inactive, QColorGroup::Base, QColor( 55, 77, 78 ) );
-      p.setColor( QPalette::Disabled, QColorGroup::Base, QColor( 55, 77, 78 ) );
-      p.setColor( QPalette::Active, QColorGroup::Highlight, Qt::white );
-      p.setColor( QPalette::Active, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) );
-      p.setColor( QPalette::Inactive, QColorGroup::Highlight, Qt::white );
-      p.setColor( QPalette::Inactive, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) );
-      p.setColor( QPalette::Disabled, QColorGroup::Highlight, Qt::white );
-      p.setColor( QPalette::Disabled, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) );
-      p.setColor( QPalette::Active, QColorGroup::Foreground, Qt::white );
-      p.setColor( QPalette::Active, QColorGroup::Text, Qt::white );
-      p.setColor( QPalette::Active, QColorGroup::ButtonText, Qt::white );
-      p.setColor( QPalette::Inactive, QColorGroup::Foreground, Qt::white );
-      p.setColor( QPalette::Inactive, QColorGroup::Text, Qt::white );
-      p.setColor( QPalette::Inactive, QColorGroup::ButtonText, Qt::white );
-      p.setColor( QPalette::Disabled, QColorGroup::Foreground, Qt::lightGray );
-      p.setColor( QPalette::Disabled, QColorGroup::Text, Qt::lightGray );
-      p.setColor( QPalette::Disabled, QColorGroup::ButtonText, Qt::lightGray );
-      qApp->setPalette( p, true);
+      QPalette p(QColor(75, 123, 130));
+      p.setColor(QPalette::Active, QColorGroup::Base, QColor(55, 77, 78));
+      p.setColor(QPalette::Inactive, QColorGroup::Base, QColor(55, 77, 78));
+      p.setColor(QPalette::Disabled, QColorGroup::Base, QColor(55, 77, 78));
+      p.setColor(QPalette::Active, QColorGroup::Highlight, Qt::white);
+      p.setColor(QPalette::Active, QColorGroup::HighlightedText, QColor(55, 77, 78));
+      p.setColor(QPalette::Inactive, QColorGroup::Highlight, Qt::white);
+      p.setColor(QPalette::Inactive, QColorGroup::HighlightedText, QColor(55, 77, 78));
+      p.setColor(QPalette::Disabled, QColorGroup::Highlight, Qt::white);
+      p.setColor(QPalette::Disabled, QColorGroup::HighlightedText, QColor(55, 77, 78));
+      p.setColor(QPalette::Active, QColorGroup::Foreground, Qt::white);
+      p.setColor(QPalette::Active, QColorGroup::Text, Qt::white);
+      p.setColor(QPalette::Active, QColorGroup::ButtonText, Qt::white);
+      p.setColor(QPalette::Inactive, QColorGroup::Foreground, Qt::white);
+      p.setColor(QPalette::Inactive, QColorGroup::Text, Qt::white);
+      p.setColor(QPalette::Inactive, QColorGroup::ButtonText, Qt::white);
+      p.setColor(QPalette::Disabled, QColorGroup::Foreground, Qt::lightGray);
+      p.setColor(QPalette::Disabled, QColorGroup::Text, Qt::lightGray);
+      p.setColor(QPalette::Disabled, QColorGroup::ButtonText, Qt::lightGray);
+      qApp->setPalette(p, true);
     }
     else
       if (style == "Motif")
       {
-        QPalette p( QColor( 192, 192, 192 ) );
-        qApp->setPalette( p, true);
+        QPalette p(QColor(192, 192, 192));
+        qApp->setPalette(p, true);
       }
       else
         if (style == "MotifPlus")
         {
-          QPalette p( QColor( 192, 192, 192 ) );
+          QPalette p(QColor(192, 192, 192));
 
           qApp->setPalette(p, true);
         }
@@ -848,7 +981,12 @@
   g_informationSoundFile = cfg->readStringEntry("Information Sound", QString::null);
   g_completion = strtobool(cfg->readStringEntry("Completion", "true"));
   g_syntaxHighlight = strtobool(cfg->readStringEntry("Syntax Highlighting", "true"));
-  g_parenthesesMatching = strtobool(cfg->readStringEntry("Parentheses Matching", "true"));  
+  g_parenthesesMatching = strtobool(cfg->readStringEntry("Parentheses Matching", "true"));
+  g_limitSelectQueries = strtobool(cfg->readStringEntry("Limit Select Queries", "true"));
+  g_limitSelectQueriesNumber = cfg->readNumberEntry("Limit Select Queries Number", 1000);
+  g_retriveAllRecordsFromTable = strtobool(cfg->readStringEntry("Retrieve All Records From Table", "true"));
+  g_commentType = (g_CommentType) cfg->readNumberEntry("Comment Style", int(HASH_COMMENT));
+
   qApp->setStyle(*g_CurrentStyle);
   setStylePalette(*g_CurrentStyle);  
   PrepareSqlEditor(cfg);

--- 1.5/src/CListViewProperties.cpp	Wed Feb 27 19:00:56 2002
+++ 1.6/src/CListViewProperties.cpp	Thu Apr 25 18:55:25 2002
@@ -78,11 +78,11 @@
   QString ret = QString::null;
   if (hasSaveTitle)
   {
-    ret = "# " + saveTitle + mysql->getLineTerminator(true);
-    ret += "# " + tr("Connection") + ": " + mysql->getConnectionName() + mysql->getLineTerminator(true);
-    ret += "# " + tr("Host") + ": " + mysql->getHostName() + mysql->getLineTerminator(true);
-    ret += "# " + tr("Saved") + ": " + QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") + mysql->getLineTerminator(true);
-    ret += "#" + mysql->getLineTerminator(true);
+    ret = saveTitle + mysql->getLineTerminator(true);
+    ret += tr("Connection") + ": " + mysql->getConnectionName() + mysql->getLineTerminator(true);
+    ret += tr("Host") + ": " + mysql->getHostName() + mysql->getLineTerminator(true);
+    ret += tr("Saved") + ": " + QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") + mysql->getLineTerminator(true);    
+    ret = commentText(ret, mysql->getLineTerminator(true)) + mysql->getLineTerminator(true);
   }
   return ret;
 }

--- 1.12/src/CMySQLConnection.cpp	Thu Apr 18 22:49:37 2002
+++ 1.13/src/CMySQLConnection.cpp	Thu Apr 25 18:55:21 2002
@@ -249,6 +249,19 @@
     return false;
 }
 
+QString CMySQLConnection::getRealDatabaseName()
+{
+   if (!m_isConnected)
+    return QString::null;  
+  QString ret = QString::null;
+  CMySQLQuery *qry = new CMySQLQuery(this);  
+  if (qry->exec("SELECT database()", false))
+    if (qry->next(false, true))
+      ret = qry->Row(0);
+  delete qry;
+  return ret;
+}
+
 QString CMySQLConnection::doEscape(const QString &str)
 {  
   QString tmp = str;

--- 1.17/src/CMySQLQuery.cpp	Thu Apr 18 12:46:35 2002
+++ 1.18/src/CMySQLQuery.cpp	Thu Apr 25 18:54:19 2002
@@ -44,24 +44,56 @@
 bool CMySQLQuery::isSelectQuery(const QString &q) const
 {
   if (q.isEmpty() && m_Query.isEmpty())
-    return false;
-  return (getQueryType(!q.isEmpty() ? q : m_Query) == "select");   
+    return false;  
+  return (stripQuery(!q.isEmpty() ? q : m_Query, GET_QUERY_TYPE).lower() == "select");
 }
 
-QString CMySQLQuery::getQueryType(const QString &q)
+QString CMySQLQuery::stripQuery(const QString &q, stripQueryType type)
 {
   if (q.isEmpty())
-    return QString::null;
-  QString qry = q.stripWhiteSpace();  
-  QString tmp = QString::null;  
-  bool firstletter = false;
+    return QString::null;  
+  bool firstletter = false;    
+  QString ret = QString::null;  
+  QString qry = QString::null;
+  
+  if (type != GET_QUERY_TYPE) //Strip all text enclosed by quotes
+  {
+    bool isquoted = false;
+    QChar startquote = 0;
+    
+    for (uint i = 0; i < q.length(); i++)
+    {
+      QChar c = q.at(i);
+      if (!isquoted && ( (c == '\"') || (c == '\'') ) )
+      {
+        isquoted = true;
+        startquote = c;
+      }
+      else
+        if (isquoted && ( startquote == c ))
+        {
+          isquoted = (q.at(i - 1) == '\\');
+          if (!isquoted)          
+            c = q.at(i + 1);
+        }
+        if (!isquoted && !c.isNull())
+          qry += c;
+    }
+    if (qry.isEmpty())
+      return QString::null;
+    qry = qry.stripWhiteSpace();
+  }
+  else
+    qry = q.stripWhiteSpace();
+
   for (uint i = 0; i < qry.length(); i++)
   {
-    QChar c = qry.at(i);    
+    QChar c = qry.at(i);
     if ((c == '#') || ((c == ' ') && (qry.at(i+1) == '-') && (qry.at(i+2) == '-')))  //Line comments
     {
-      for (uint a = i; a < qry.length(); a++)
-        if (qry.at(a) == '\n')
+      uint len = qry.length();
+      for (uint a = i; a < len; a++)
+        if ((qry.at(a) == '\n') || (a == len -1))
         {
           i = a;
           break;
@@ -71,25 +103,40 @@
       if ((c == '/') && (qry.at(i+1) == '*'))  //C Style comments
       {
         for (uint b = i; b < qry.length(); b++)
-        if ((qry.at(b) == '*') && (qry.at(b+1) == '/'))
-        {
-          i = b + 1;
-          break;
-        }
+          if ((qry.at(b) == '*') && (qry.at(b+1) == '/'))
+          {
+            i = b + 1;
+            break;
+          }
       }
       else
       {
-        if (tmp.isEmpty() && c.isLetter())
-          firstletter = true;
-        if (firstletter)
+        bool abort = false;
+        switch (type)
         {
-          tmp += c;
-          if (c.isSpace())
-            break;
+        case STRIP_COMMENTS:
+          if (!c.isNull())
+            ret += c;
+          break;
+        case GET_QUERY_TYPE:
+          {
+            if (ret.isEmpty() && c.isLetter())
+              firstletter = true;
+            if (firstletter)
+              if (!c.isNull())
+              {
+                ret += c;
+                if (c.isSpace())
+                  abort = true;
+              }
+          }
+          break;
         }
-      }    
+        if (abort)
+          break;
+      }  
   }
-  return tmp.stripWhiteSpace().lower();  
+  return ret.stripWhiteSpace();
 }
 
 bool CMySQLQuery::isNull()

--- 1.24/src/CQueryWindow.cpp	Thu Apr 18 12:11:24 2002
+++ 1.25/src/CQueryWindow.cpp	Thu Apr 25 18:53:26 2002
@@ -35,13 +35,7 @@
 : CMyWindow( parent, "CQueryWindow", WDestructiveClose, !g_isMDI, true), serverID(serverid)
 {  
   createForm(m, querytype, table, display);
-  QString c = QString( (mysql->getDatabaseName().isEmpty() && (m_queryType == SQL_QUERY)) ? tr("Query in")
-		          : ((m_queryType == SQL_QUERY) ? tr("Query in Database") + " '" + mysql->getDatabaseName() + "'"
-		          : (tr("Data in Table") + ": '" + table + "'" + (!mysql->getDatabaseName().isEmpty() ? 
-				      " " + tr("in") + " '" + mysql->getDatabaseName() + "'"
-				      : QString::null))) );
-  c += " [" + mysql->getConnectionName() + "]";  
-  setCaption(tr(c));
+  setWindowCaption();
   if (!m_defaultTable.isEmpty())
   {
     QString Sql = "SELECT *\nFROM " + mysql->Quote(m_defaultTable);
@@ -51,6 +45,24 @@
   }  
 }
 
+void CQueryWindow::setWindowCaption()
+{
+  QString c;
+  if (mysql->getDatabaseName().isEmpty() && (m_queryType == SQL_QUERY))
+    c = tr("Query in");
+  else
+    if (m_queryType == SQL_QUERY)
+      c = tr("Query in Database") + " '" + mysql->getDatabaseName() + "'";
+    else
+    {
+      c = tr("Data in Table") + ": '" + m_defaultTable + "'";
+      if (!mysql->getDatabaseName().isEmpty())
+        c += " " + tr("in") + " '" + mysql->getDatabaseName() + "'";
+    }
+  c += " [" + mysql->getConnectionName() + "]";  
+  setCaption(c);
+}
+
 void CQueryWindow::createForm(CMySQLConnection *m, int querytype, const QString & table, unsigned short display)
 {  
   canClose = true;
@@ -384,6 +396,35 @@
   return q;
 }
 
+void CQueryWindow::finishedExecuteQuery(const QString &qryType)
+{  
+  if (qryType == "use")
+  {
+    if (mysql->setDatabaseName(mysql->getRealDatabaseName()))
+      m_queryType = SQL_QUERY;
+  }
+  else
+    if (qryType == "select")
+    {
+      QStringList fromList;
+      if (CMySQLQuery::ColumnQuery(fromList, mysql, "EXPLAIN " + sqlView->text(), 0, false, false))
+      {
+        if (fromList.count() == 1)
+        {
+          QStringList::Iterator t = fromList.begin();
+          if (!(*t).isEmpty())
+          {
+            m_defaultTable = *t;
+            m_queryType = SQL_ALL_ROWS;
+          }
+        }
+        else
+          m_defaultTable = QString::null;
+      }      
+    }
+  setWindowCaption();
+}
+
 void CQueryWindow::ExecuteQuery()
 {  
   if (mysql->isConnected())
@@ -392,12 +433,22 @@
     showGridPanel(true);    
     HistoryPanel->History(qry); 
     QString q = parseQuery(qry);
+    QString queryType;
     while (!q.isNull())
     {
-      results->setMyReadOnly(!(CMySQLQuery::getQueryType(q) == "select"));
+      queryType = CMySQLQuery::stripQuery(q, CMySQLQuery::GET_QUERY_TYPE).lower();      
+      results->setMyReadOnly(!(queryType == "select"));  //THIS HAS A BUG ... SELECT database() will be readable.  This must also be checked if EXPLAIN returns 1 table and the table-name != "No Tables Used"
+      if (g_limitSelectQueries && (g_limitSelectQueriesNumber >= 1) && (queryType == "select"))
+      {
+        QString tmp = CMySQLQuery::stripQuery(q);
+        if (tmp.find("limit", 0, false) == -1)   //Does the query already have a limit ?
+          if (tmp.find("from", 0, false) != -1)  //The query must have FROM for LIMIT to work ..
+            q += "\nLIMIT " + QString::number(g_limitSelectQueriesNumber);
+      }
       results->exec(q.stripWhiteSpace());
       q = parseQuery(qry);
-    }    
+    }
+    finishedExecuteQuery(queryType);
   }
 }
 

--- 1.32/src/CSqlTable.cpp	Thu Apr 18 22:47:33 2002
+++ 1.33/src/CSqlTable.cpp	Thu Apr 25 18:54:46 2002
@@ -379,11 +379,11 @@
   QString ret = QString::null;
   if (hasSaveTitle)
   {
-    ret = "# " + saveTitle + getDatabaseConnection()->getLineTerminator(true);
-    ret += "# " + tr("Connection") + ": " + getDatabaseConnection()->getConnectionName() + getDatabaseConnection()->getLineTerminator(true);
-    ret += "# " + tr("Host") + ": " + getDatabaseConnection()->getHostName() + getDatabaseConnection()->getLineTerminator(true);
-    ret += "# " + tr("Saved") + ": " + QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") + getDatabaseConnection()->getLineTerminator(true);
-    ret += "#" + getDatabaseConnection()->getLineTerminator(true);
+    ret = saveTitle + getDatabaseConnection()->getLineTerminator(true);
+    ret += tr("Connection") + ": " + getDatabaseConnection()->getConnectionName() + getDatabaseConnection()->getLineTerminator(true);
+    ret += tr("Host") + ": " + getDatabaseConnection()->getHostName() + getDatabaseConnection()->getLineTerminator(true);
+    ret += tr("Saved") + ": " + QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") + getDatabaseConnection()->getLineTerminator(true);    
+    ret = commentText(ret, getDatabaseConnection()->getLineTerminator(true)) + getDatabaseConnection()->getLineTerminator(true);
   }
   return ret;
 }
@@ -457,9 +457,11 @@
   emit executing(true);
   QTextStream ts( &file );  
   ts << getSaveTitle();
-  ts << "# " << tr("Query") << ":" << getDatabaseConnection()->getLineTerminator(true);
-  ts << "# " << m_Query.replace(QRegExp("\n"), getDatabaseConnection()->getLineTerminator(true) + "# ");
-  ts << getDatabaseConnection()->getLineTerminator(true) << "#" << getDatabaseConnection()->getLineTerminator(true);
+  QString tmp = tr("Query") + ":" + getDatabaseConnection()->getLineTerminator(true);
+  tmp += m_Query.replace(QRegExp("\n"), getDatabaseConnection()->getLineTerminator(true));
+  tmp += getDatabaseConnection()->getLineTerminator(true);
+  ts << commentText(tmp, getDatabaseConnection()->getLineTerminator(true)) << getDatabaseConnection()->getLineTerminator(true);
+
   QString line = QString::null;    
   Query->dataSeek(0);
   setCursor (Qt::waitCursor);

--- 1.11/src/CTableSpecific.cpp	Mon Feb 18 15:58:27 2002
+++ 1.12/src/CTableSpecific.cpp	Thu Apr 25 18:48:48 2002
@@ -144,17 +144,18 @@
     // TODO: fix magic numbers
     limit = QInputDialog::getInteger(
       QObject::tr("Number of Rows"),
-      QObject::tr("Maximum number of Rows to fetch") + ":",1000,0, 2147483600, 1, &ok, 0);							
+      QObject::tr("Maximum number of Rows to fetch") + ":",g_limitSelectQueriesNumber,0, 2147483600, 1, &ok, 0);							
     if (!ok)
       return;		
   }
-  int flags = ((q != SQL_QUERY) ? RESULTS_PANEL : SQL_PANEL);  
+  int flags = ((q != SQL_QUERY) ? (g_retriveAllRecordsFromTable ? RESULTS_PANEL : SQL_PANEL | RESULTS_PANEL)
+    : SQL_PANEL);  
   CQueryWindow *w = new CQueryWindow(g_WorkSpace, m, q, tableName, limit, flags, serverid);
   Q_CHECK_PTR(w);
   w->setFocus();
   w->raise();  
   myShowWindow(w);
-  if (q != SQL_QUERY)
+  if ((q != SQL_QUERY) && g_retriveAllRecordsFromTable)
     w->ExecuteQuery();  
 }
 

--- 1.8/src/CTableTools.cpp	Wed Feb 27 19:00:52 2002
+++ 1.9/src/CTableTools.cpp	Thu Apr 25 18:53:43 2002
@@ -274,10 +274,9 @@
             QString qry = "SHOW CREATE TABLE " + mysql->Quote(*i);
             if (query.exec(qry, false))
             {
-              sql += "# Host: " + mysql->getHostName() + "\n" +
-                "# Database: " + mysql->getDatabaseName() + "\n" +
-                "# Table: '" + (*i) + "'\n" +
-                "#";
+              sql += commentText("Host: " + mysql->getHostName() + "\n" +
+                "Database: " + mysql->getDatabaseName() + "\n" +
+                "Table: '" + (*i) + "'\n");
               query.next();
               sql += "\n" + query.Row(1);
             }

--- 1.10/src/Globals.cpp	Fri Feb 22 00:47:58 2002
+++ 1.11/src/Globals.cpp	Thu Apr 25 18:54:57 2002
@@ -25,6 +25,7 @@
 #include <qsound.h>
 #include <qapplication.h>
 #include <qmessagebox.h>
+#include <qregexp.h>
 
 #include "CMessageWindow.h"
 #include "CHistoryView.h"
@@ -33,12 +34,16 @@
 int g_widgetID = 1;
 int g_serverID = 0;  //used for updating the servers list
 int g_historySize = 0;
+int g_limitSelectQueriesNumber = 1000;
 bool g_isMDI = true;
 bool g_saveWorkspace = true;
 bool g_confirmCritical = true;
 bool g_syntaxHighlight = true;
 bool g_parenthesesMatching = true;
 bool g_completion = true;
+bool g_limitSelectQueries = true;
+bool g_retriveAllRecordsFromTable = true;
+g_CommentType g_commentType = HASH_COMMENT;
 QFont g_printerFont;
 QString g_CONNECTION_PATH = QString(CONNECTIONS_PATH);
 QString g_CONFIG_FILE = QString(CODENAME) + ".cfg";
@@ -83,6 +88,26 @@
       wnd->show();
       break;
   }
+}
+
+QString commentText(const QString &text, const QString &eol, g_CommentType type)
+{
+  g_CommentType commentType = (type != NO_COMMENT) ? type : g_commentType;
+  QString ret(text);
+  switch (commentType) {
+  case C_COMMENT:
+    ret = "/*" + eol + ret + eol + "*/";
+    break;
+
+  case HASH_COMMENT:
+    ret = "# " + ret.replace(QRegExp(eol), eol + "# ");
+    break;
+
+  case DASH_COMMENT:
+    ret = " -- " + ret.replace(QRegExp(eol), eol + " -- ");
+    break;
+  }  
+  return ret;
 }
 
 void playSound(const QString &fileName)
Thread
bk commit - MyCCjorge26 Apr