Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/sql/drivers/ibase/qsql_ibase.cpp

    r2 r561  
    22**
    33** 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])
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5656#include <math.h>
    5757#include <qdebug.h>
     58
    5859
    5960QT_BEGIN_NAMESPACE
     
    6768enum { QIBaseChunkSize = SHRT_MAX / 2 };
    6869
    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
     71static bool getIBaseError(QString& msg, const ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc)
     72#else
     73static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc)
     74#endif
    7175{
    7276    if (status[0] != 1 || status[1] <= 0)
     
    7680    sqlcode = isc_sqlcode(status);
    7781    char buf[512];
     82
     83
     84
    7885    while(isc_interprete(buf, &status)) {
     86
    7987        if(!msg.isEmpty())
    8088            msg += QLatin1String(" - ");
     
    9098{
    9199    sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(1));
     100
    92101    sqlda->sqln = 1;
    93102    sqlda->sqld = 0;
     
    99108static void enlargeDA(XSQLDA *&sqlda, int n)
    100109{
    101     free(sqlda);
     110    if (sqlda != (XSQLDA*)0)
     111        free(sqlda);
    102112    sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(n));
     113
    103114    sqlda->sqln = n;
    104115    sqlda->version = SQLDA_CURRENT_VERSION;
     
    119130        case SQL_TEXT:
    120131        case SQL_BLOB:
    121             sqlda->sqlvar[i].sqldata = (char*)malloc(sqlda->sqlvar[i].sqllen);
     132            sqlda->sqlvar[i].sqldata = ;
    122133            break;
    123134        case SQL_ARRAY:
    124             sqlda->sqlvar[i].sqldata = (char*)malloc(sizeof(ISC_QUAD));
     135            sqlda->sqlvar[i].sqldata = ;
    125136            memset(sqlda->sqlvar[i].sqldata, 0, sizeof(ISC_QUAD));
    126137            break;
    127138        case SQL_VARYING:
    128             sqlda->sqlvar[i].sqldata = (char*)malloc(sqlda->sqlvar[i].sqllen + sizeof(short));
     139            sqlda->sqlvar[i].sqldata = ;
    129140            break;
    130141        default:
     
    134145        }
    135146        if (sqlda->sqlvar[i].sqltype & 1) {
    136             sqlda->sqlvar[i].sqlind = (short*)malloc(sizeof(short));
     147            sqlda->sqlvar[i].sqlind = ;
    137148            *(sqlda->sqlvar[i].sqlind) = 0;
    138149        } else {
     
    147158        return;
    148159    for (int i = 0; i < sqlda->sqld; ++i) {
    149         free(sqlda->sqlvar[i].sqlind);
    150         free(sqlda->sqlvar[i].sqldata);
     160        ;
     161        ;
    151162    }
    152163    free(sqlda);
     
    293304    ISC_LONG bufferLength;
    294305    ISC_LONG eventId;
    295    
     306
    296307    enum QIBaseSubscriptionState { Starting, Subscribed, Finished };
    297308    QIBaseSubscriptionState subscriptionState;
     
    444455    ba.resize(read);
    445456
    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",
    448459                                                "Unable to read BLOB"),
    449460                                                QSqlError::StatementError));
     
    512523                    else
    513524                        valList.append(QString::fromUtf8(buffer, o));
    514                    
     525
    515526                    buffer += strLen;
    516527                }
     
    577588    int arraySize = 1, subArraySize;
    578589    short dimensions = desc.array_desc_dimensions;
    579     short *numElements = new short[dimensions];
     590    ;
    580591
    581592    for(int i = 0; i < dimensions; ++i) {
     
    606617        return list;
    607618
    608     readArrayBuffer(list, ba.data(), 0, numElements, &desc, tc);
    609 
    610     delete[] numElements;
     619    readArrayBuffer(list, ba.data(), 0, numElements.data(), &desc, tc);
    611620
    612621    return QVariant(list);