Changeset 561 for trunk/src/sql/drivers/ibase/qsql_ibase.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/sql/drivers/ibase/qsql_ibase.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 56 56 #include <math.h> 57 57 #include <qdebug.h> 58 58 59 59 60 QT_BEGIN_NAMESPACE … … 67 68 enum { QIBaseChunkSize = SHRT_MAX / 2 }; 68 69 69 static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, 70 QTextCodec *tc) 70 #if defined(FB_API_VER) && FB_API_VER >= 20 71 static bool getIBaseError(QString& msg, const ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc) 72 #else 73 static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc) 74 #endif 71 75 { 72 76 if (status[0] != 1 || status[1] <= 0) … … 76 80 sqlcode = isc_sqlcode(status); 77 81 char buf[512]; 82 83 84 78 85 while(isc_interprete(buf, &status)) { 86 79 87 if(!msg.isEmpty()) 80 88 msg += QLatin1String(" - "); … … 90 98 { 91 99 sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(1)); 100 92 101 sqlda->sqln = 1; 93 102 sqlda->sqld = 0; … … 99 108 static void enlargeDA(XSQLDA *&sqlda, int n) 100 109 { 101 free(sqlda); 110 if (sqlda != (XSQLDA*)0) 111 free(sqlda); 102 112 sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(n)); 113 103 114 sqlda->sqln = n; 104 115 sqlda->version = SQLDA_CURRENT_VERSION; … … 119 130 case SQL_TEXT: 120 131 case SQL_BLOB: 121 sqlda->sqlvar[i].sqldata = (char*)malloc(sqlda->sqlvar[i].sqllen);132 sqlda->sqlvar[i].sqldata = ; 122 133 break; 123 134 case SQL_ARRAY: 124 sqlda->sqlvar[i].sqldata = (char*)malloc(sizeof(ISC_QUAD));135 sqlda->sqlvar[i].sqldata = ; 125 136 memset(sqlda->sqlvar[i].sqldata, 0, sizeof(ISC_QUAD)); 126 137 break; 127 138 case SQL_VARYING: 128 sqlda->sqlvar[i].sqldata = (char*)malloc(sqlda->sqlvar[i].sqllen + sizeof(short));139 sqlda->sqlvar[i].sqldata = ; 129 140 break; 130 141 default: … … 134 145 } 135 146 if (sqlda->sqlvar[i].sqltype & 1) { 136 sqlda->sqlvar[i].sqlind = (short*)malloc(sizeof(short));147 sqlda->sqlvar[i].sqlind = ; 137 148 *(sqlda->sqlvar[i].sqlind) = 0; 138 149 } else { … … 147 158 return; 148 159 for (int i = 0; i < sqlda->sqld; ++i) { 149 free(sqlda->sqlvar[i].sqlind);150 free(sqlda->sqlvar[i].sqldata);160 ; 161 ; 151 162 } 152 163 free(sqlda); … … 293 304 ISC_LONG bufferLength; 294 305 ISC_LONG eventId; 295 306 296 307 enum QIBaseSubscriptionState { Starting, Subscribed, Finished }; 297 308 QIBaseSubscriptionState subscriptionState; … … 444 455 ba.resize(read); 445 456 446 bool isErr = (status[1] == isc_segstr_eof ? false : 447 isError(QT_TRANSLATE_NOOP("QIBaseResult", 457 bool isErr = (status[1] == isc_segstr_eof ? false : 458 isError(QT_TRANSLATE_NOOP("QIBaseResult", 448 459 "Unable to read BLOB"), 449 460 QSqlError::StatementError)); … … 512 523 else 513 524 valList.append(QString::fromUtf8(buffer, o)); 514 525 515 526 buffer += strLen; 516 527 } … … 577 588 int arraySize = 1, subArraySize; 578 589 short dimensions = desc.array_desc_dimensions; 579 short *numElements = new short[dimensions];590 ; 580 591 581 592 for(int i = 0; i < dimensions; ++i) { … … 606 617 return list; 607 618 608 readArrayBuffer(list, ba.data(), 0, numElements, &desc, tc); 609 610 delete[] numElements; 619 readArrayBuffer(list, ba.data(), 0, numElements.data(), &desc, tc); 611 620 612 621 return QVariant(list); …