Added:
trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.cpp
trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.h
Modified:
trunk/Driver/Setup/Library/Library.pro
trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.cpp
trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.h
trunk/SDK/Installer/Library/installer.c
trunk/SDK/Installer/include/installer.h
trunk/SDK/MYSQLPlus/Library/MConnection.cpp
trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp
trunk/SDK/MYSQLPlus/Library/MResultRes.cpp
trunk/SDK/MYSQLPlus/Library/MStatement.cpp
trunk/SDK/MYSQLPlus/include/MConnection.h
Log:
added datasource as a public member of MConnection
added new tab for DSN config for up-and-coming options
added option to buffer results using mysql_store_result()
fixed getinfo to determine SQL_MAX_CONCURRENT_ACTIVITIES based on buffer strategy
fixed handling of result data when using BUFFERED_MYSQL_CLIENT
Modified: trunk/Driver/Setup/Library/Library.pro
===================================================================
--- trunk/Driver/Setup/Library/Library.pro 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/Driver/Setup/Library/Library.pro 2007-05-31 19:04:02 UTC (rev 948)
@@ -50,11 +50,13 @@
HEADERS = \
MYODBCSetup.h \
MYODBCSetupDataSourceDialog.h \
- MYODBCSetupDataSourceTab1.h
+ MYODBCSetupDataSourceTab1.h \
+ MYODBCSetupDataSourceTab2.h
SOURCES = \
ConfigDSN.cpp \
ConfigDSNW.c \
MYODBCSetupDataSourceConfig.cpp \
MYODBCSetupDataSourceDialog.cpp \
- MYODBCSetupDataSourceTab1.cpp
+ MYODBCSetupDataSourceTab1.cpp \
+ MYODBCSetupDataSourceTab2.cpp
Modified: trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.cpp
===================================================================
--- trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.cpp 2007-05-31 17:24:37 UTC
(rev 947)
+++ trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.cpp 2007-05-31 19:04:02 UTC
(rev 948)
@@ -92,6 +92,8 @@
ds_set_strattr(&ds->pwd, ptab1->getPassword().toStdWString().c_str());
ds_set_strattr(&ds->database, ptab1->getDatabase().toStdWString().c_str());
ds->port = ptab1->getPort().toInt();
+ // get the values from tab2
+ ptab2->getProps(ds);
// exit
done( QDialog::Accepted );
@@ -151,6 +153,8 @@
// tabs
ptab1 = new MYODBCSetupDataSourceTab1( ptabwidget );
ptabwidget->addTab( ptab1, "Login" );
+ ptab2 = new MYODBCSetupDataSourceTab2( ptabwidget, pDataSource );
+ ptabwidget->addTab( ptab2, "Options (1)" );
// buttons near bottom
playoutButtons = new QHBoxLayout;
Modified: trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.h
===================================================================
--- trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.h 2007-05-31 17:24:37 UTC (rev
947)
+++ trunk/Driver/Setup/Library/MYODBCSetupDataSourceDialog.h 2007-05-31 19:04:02 UTC (rev
948)
@@ -30,6 +30,7 @@
#define MYODBCSETUPDATASOURCEDIALOG_H
#include "MYODBCSetupDataSourceTab1.h"
+#include "MYODBCSetupDataSourceTab2.h"
#include "MYODBCSetup.h"
class MYODBCSetupDataSourceDialog : public QDialog
@@ -62,6 +63,7 @@
// these are in the ptabwidget
MYODBCSetupDataSourceTab1 * ptab1;
+ MYODBCSetupDataSourceTab2 * ptab2;
// these are in playoutButtons
QPushButton * ppushbuttonOk;
Added: trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.cpp
===================================================================
--- trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.cpp 2007-05-31 17:24:37 UTC (rev
947)
+++ trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.cpp 2007-05-31 19:04:02 UTC (rev
948)
@@ -0,0 +1,84 @@
+/*!
+ \file MYODBCSetupDataSourceTab2.cpp
+ \author Jess Balint <jbalint@stripped>
+ Copyright (C) MySQL AB 2004-2007, Released under GPL.
+ \version Connector/ODBC v5
+ \date 2007
+
+ \license Copyright (C) 2004-2007 MySQL AB
+
+ 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 "MYODBCSetupDataSourceTab2.h"
+
+/*
+ * Setup the data source tab.
+ */
+MYODBCSetupDataSourceTab2::MYODBCSetupDataSourceTab2(
+ QWidget *parent, DataSource *ds)
+ : QWidget(parent)
+{
+ bufferResults = new QCheckBox(this);
+
+ /* init from datasource */
+ if(ds->optbufresults)
+ bufferResults->setCheckState(Qt::Checked);
+
+ setupGui();
+}
+
+/*
+ * Do all gui layout and init.
+ */
+void MYODBCSetupDataSourceTab2::setupGui()
+{
+ QGridLayout * playoutFields = new QGridLayout;
+
+ setLayout( playoutFields );
+ playoutFields->setMargin( 20 );
+ playoutFields->setSpacing( 5 );
+
+ int nRow = 0;
+ int nColLabel = 1;
+ int nColField = 3;
+
+ QString tooltipTemplate = "<P><B>%1</B><HR>
<P>%2<P>";
+
+ playoutFields->addWidget(new QLabel("Buffer all query results", this), nRow,
nColLabel, Qt::AlignTop);
+ playoutFields->addWidget(bufferResults, nRow, nColField, Qt::AlignTop);
+ bufferResults->setToolTip(tooltipTemplate.arg("Buffer Results")
+ .arg("Buffer all query results. This uses mysql_store_result() "
+ "and allows multiple active result sets. ADO won't open "
+ "additional connections and "
+ "SQL_MAX_CONCURRENT_ACTIVITIES = 0 (unlimited)."));
+ nRow++;
+}
+
+/*
+ * Transfer the property values back to the data source object.
+ */
+void MYODBCSetupDataSourceTab2::getProps(DataSource *ds)
+{
+ if(bufferResults->checkState() == Qt::Checked)
+ ds->optbufresults = 1;
+ else
+ ds->optbufresults = 0;
+}
+
Added: trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.h
===================================================================
--- trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.h 2007-05-31 17:24:37 UTC (rev
947)
+++ trunk/Driver/Setup/Library/MYODBCSetupDataSourceTab2.h 2007-05-31 19:04:02 UTC (rev
948)
@@ -0,0 +1,63 @@
+/*!
+ \file MYODBCSetupDataSourceTab2.h
+ \author Jess Balint <jbalint@stripped>
+ Copyright (C) MySQL AB 2004-2007, Released under GPL.
+ \version Connector/ODBC v5
+ \date 2007
+
+ \license Copyright (C) 2004-2007 MySQL AB
+
+ 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
+*/
+
+#ifndef MYODBCSETUPDATASOURCETAB2_H
+#define MYODBCSETUPDATASOURCETAB2_H
+
+#include <QObject>
+#include <QWidget>
+#include <QCheckBox>
+#include <QGridLayout>
+#include <QLabel>
+
+#include <installer.h>
+
+/*
+ * The second tab in the config.
+ *
+ * Once we have more options and they are logically grouped,
+ * this should have a name with more meaning. And tab1 should
+ * be "Login", "Main" or something...
+ */
+class MYODBCSetupDataSourceTab2 : public QWidget
+{
+ Q_OBJECT
+
+public:
+ MYODBCSetupDataSourceTab2(QWidget *parent, DataSource *ds);
+
+ void getProps(DataSource *ds);
+
+private:
+ void setupGui();
+
+ QCheckBox *bufferResults;
+};
+
+#endif /* MYODBCSETUPDATASOURCETAB2_H */
+
Modified: trunk/SDK/Installer/Library/installer.c
===================================================================
--- trunk/SDK/Installer/Library/installer.c 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/SDK/Installer/Library/installer.c 2007-05-31 19:04:02 UTC (rev 948)
@@ -29,6 +29,11 @@
*/
/*
* Installer wrapper implementations.
+ *
+ * How to add a data-source option:
+ * Search for DS_PARAM, and follow the code around it
+ * Add an extra field to the DataSource struct (installer.h)
+ * Add a default value in ds_new()
*/
#include "installer.h"
@@ -37,19 +42,19 @@
#else
static int wcscasecmp(const SQLWCHAR *s1, const SQLWCHAR *s2)
{
- SQLWCHAR c1, c2;
- while(*s1 && *s2)
- {
- c1 = *s1; c2 = *s2;
- if(c1 >= 'a') c1 -= ('a' - 'A');
- if(c2 >= 'a') c2 -= ('a' - 'A');
- if(c1 != c2)
- return 1;
- s1++; s2++;
- }
+ SQLWCHAR c1, c2;
+ while(*s1 && *s2)
+ {
+ c1 = *s1; c2 = *s2;
+ if(c1 >= 'a') c1 -= ('a' - 'A');
+ if(c2 >= 'a') c2 -= ('a' - 'A');
+ if(c1 != c2)
+ return 1;
+ s1++; s2++;
+ }
- /* one will be null, so both must be */
- return *s1 != *s2;
+ /* one will be null, so both must be */
+ return *s1 != *s2;
}
#endif
@@ -256,6 +261,9 @@
ds->socket = NULL;
ds->initstmt = NULL;
+ /* options */
+ ds->optbufresults = 0;
+
return ds;
}
@@ -344,6 +352,9 @@
*strdest = &ds->initstmt;
else if(!wcscasecmp(L"PORT", param))
*intdest = &ds->port;
+ else if(!wcscasecmp(L"OPTBUFRESULTS", param))
+ *intdest = &ds->optbufresults;
+ /* DS_PARAM */
}
/*
@@ -496,7 +507,8 @@
/* TODO centralize all this */
const SQLWCHAR *params[] = {L"DSN", L"DRIVER", L"DESCRIPTION",
L"SERVER", L"UID", L"PWD", L"DATABASE", L"SOCKET",
- L"INITSTMT", L"PORT"};
+ L"INITSTMT", L"PORT", L"OPTBUFRESULTS"};
+ /* DS_PARAM */
int paramcnt = sizeof(params) / sizeof(SQLWCHAR *);
int i;
SQLWCHAR **strval;
@@ -587,6 +599,10 @@
if(ds_add_intprop(ds->name, L"PORT" , ds->port )) goto error;
+ /* Options */
+ if(ds_add_intprop(ds->name, L"OPTBUFRESULTS", ds->optbufresults)) goto error;
+ /* DS_PARAM */
+
return 0;
error:
Modified: trunk/SDK/Installer/include/installer.h
===================================================================
--- trunk/SDK/Installer/include/installer.h 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/SDK/Installer/include/installer.h 2007-05-31 19:04:02 UTC (rev 948)
@@ -84,6 +84,8 @@
int port;
SQLWCHAR *socket;
SQLWCHAR *initstmt;
+ /* Options */
+ int optbufresults;
} DataSource;
DataSource *ds_new();
Modified: trunk/SDK/MYSQLPlus/Library/MConnection.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2007-05-31 19:04:02 UTC (rev 948)
@@ -1422,6 +1422,9 @@
DBUG_ENTER("MConnection::doConnectInternal");
+ /* Save the data source internally */
+ datasource = pDataSource;
+
/* convert SQLWCHAR to UTF8 for MySQL API */
server = MYODBCCString::wcstoutf8(pDataSource->server , "");
uid = MYODBCCString::wcstoutf8(pDataSource->uid , "");
Modified: trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp 2007-05-31 19:04:02 UTC (rev 948)
@@ -1032,7 +1032,12 @@
*pnStringLengthBytes = sizeof(SQLUSMALLINT);
break;
case SQL_MAX_CONCURRENT_ACTIVITIES:
- *pnSQLUSMALLINT = pInfo->getInfoMaxConcurrentActivities();
+ if(datasource && datasource->optbufresults)
+ /* no limit - mysql_store_result() */
+ *pnSQLUSMALLINT = 0;
+ else
+ /* limit 1 - mysql_use_result() */
+ *pnSQLUSMALLINT = 1;
*pnStringLengthBytes = sizeof(SQLUSMALLINT);
break;
case SQL_MAX_CURSOR_NAME_LEN:
@@ -2895,21 +2900,6 @@
DBUG_RETURN(0L);
}
-SQLUSMALLINT MConnectionInfo::getInfoMaxConcurrentActivities()
-{
- DBUG_ENTER("MConnectionInfo::getInfoMaxConcurrentActivities");
-
- /*!
- \todo
-
- We need to be smarter about this. There are certian circumstances where we
- can support unlimited (for example if we store all results for the connection).
- But for now lets just support a single activity per connection.
- */
- DBUG_RETURN(1L);
-// DBUG_RETURN(0L);
-}
-
SQLUSMALLINT MConnectionInfo::getInfoMaxCursorNameLen()
{
DBUG_ENTER("MConnectionInfo::getInfoMaxCursorNameLen");
Modified: trunk/SDK/MYSQLPlus/Library/MResultRes.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResultRes.cpp 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/SDK/MYSQLPlus/Library/MResultRes.cpp 2007-05-31 19:04:02 UTC (rev 948)
@@ -845,6 +845,7 @@
break;
case BUFFERED_MYSQL_CLIENT:
+ /* TODO check mysql_data_seek row num param */
if (nRow > 0)
{
if ((qulonglong) nRow < getResultSetRows())
@@ -895,6 +896,7 @@
break;
case BUFFERED_MYSQL_CLIENT:
+ /* TODO check mysql_data_seek row num param */
if (getRowSetSize() > getResultSetRows())
{
if (getResultSetRows())
@@ -952,9 +954,9 @@
if (isBeforeStart())
DBUG_RETURN(doFirst_());
- if (getResultSetRow() + getRowSetSize() < getResultSetRows())
+ if (getResultSetRow() + getRowSetSize() - 1 < getResultSetRows())
{
- mysql_data_seek(pRes, getResultSetRow() + getRowSetSize());
+ mysql_data_seek(pRes, getResultSetRow() + getRowSetSize() - 1);
nReturn1 = getRowSetData();
}
break;
@@ -993,6 +995,7 @@
case BUFFERED_MYSQL_CLIENT:
if (getResultSetRows())
{
+ /* TODO check mysql_data_seek row num param */
if (getResultSetRow() > getRowSetSize())
mysql_data_seek(pRes, getResultSetRow() - getRowSetSize());
else
@@ -1053,6 +1056,7 @@
case BUFFERED_MYSQL_CLIENT:
if (getResultSetRow() + nRows > 0 && getResultSetRow() + nRows
<= getResultSetRows())
{
+ /* TODO check mysql_data_seek row num param */
mysql_data_seek(pRes, getResultSetRow() + nRows);
nReturn1 = getRowSetData();
}
Modified: trunk/SDK/MYSQLPlus/Library/MStatement.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2007-05-31 19:04:02 UTC (rev 948)
@@ -3032,6 +3032,10 @@
/* Prepare for first MCommand... */
pCommand = pCommands->getCommandCurrent();
nReturn = pCommand->getResult()->doPrepare();
+
+ if(getConnection()->datasource->optbufresults)
+ pCommand->getResult()->setBuffered(MResult::BUFFERED_MYSQL_CLIENT);
+
if (!SQL_SUCCEEDED(nReturn))
goto doPrepareExit1;
Modified: trunk/SDK/MYSQLPlus/include/MConnection.h
===================================================================
--- trunk/SDK/MYSQLPlus/include/MConnection.h 2007-05-31 17:24:37 UTC (rev 947)
+++ trunk/SDK/MYSQLPlus/include/MConnection.h 2007-05-31 19:04:02 UTC (rev 948)
@@ -111,6 +111,7 @@
void doRemoveStatement(MStatement *stmt);
MConnectionInfo *info() {return pInfo; };
+ DataSource *datasource; /* The data source currently connected to */
protected:
/* setters */
@@ -461,7 +462,6 @@
SQLUSMALLINT getInfoMaxColumnsInOrderBy();
SQLUSMALLINT getInfoMaxColumnsInSelect();
SQLUSMALLINT getInfoMaxColumnsInTable();
- SQLUSMALLINT getInfoMaxConcurrentActivities();
SQLUSMALLINT getInfoMaxCursorNameLen();
SQLUINTEGER getInfoMaxDriverConnections();
SQLUSMALLINT getInfoMaxIdentifierLen();
| Thread |
|---|
| • Connector/ODBC 5 commit: r948 - in trunk: Driver/Setup/Library SDK/Installer/Library SDK/Installer/include SDK/MYSQLPlus/Library SDK/MYSQLPlus/include | jbalint | 31 May |