Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/sql/drivers/psql/qsql_psql.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    5555#include <qmutex.h>
    5656
    57 
    5857#include <libpq-fe.h>
    5958#include <pg_config.h>
     
    620619}
    621620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
    622665static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection)
    623666{
     
    627670    if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) {
    628671        QString val = QString::fromAscii(PQgetvalue(result, 0, 0));
     672
    629673        QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)"));
    630674        rx.setMinimal(true); // enforce non-greedy RegExp
     675
    631676        if (rx.indexIn(val) != -1) {
    632677            int vMaj = rx.cap(1).toInt();
    633678            int vMin = rx.cap(2).toInt();
    634 
    635             switch (vMaj) {
    636             case 7:
    637                 switch (vMin) {
    638                 case 0:
    639                     serverVersion = QPSQLDriver::Version7;
    640                     break;
    641                 case 1:
    642                 case 2:
    643                     serverVersion = QPSQLDriver::Version71;
    644                     break;
    645                 default:
    646                     serverVersion = QPSQLDriver::Version73;
    647                     break;
    648                 }
    649                 break;
    650             case 8:
    651                 switch (vMin) {
    652                 case 0:
    653                     serverVersion = QPSQLDriver::Version8;
    654                     break;
    655                 case 1:
    656                     serverVersion = QPSQLDriver::Version81;
    657                     break;
    658                 case 2:
    659                 default:
    660                     serverVersion = QPSQLDriver::Version82;
    661                     break;
    662                 }
    663                 break;
    664             default:
    665                 break;
     679            serverVersion = qMakePSQLVersion(vMaj, vMin);
     680#ifdef PG_MAJORVERSION
     681            if (rx.indexIn(QLatin1String(PG_MAJORVERSION)) != -1) {
     682                vMaj = rx.cap(1).toInt();
     683                vMin = rx.cap(2).toInt();
    666684            }
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
    667699        }
    668700    }
    669701    PQclear(result);
    670702
    671     if (serverVersion < QPSQLDriver::Version71)
     703    //keep the old behavior unchanged
     704    if (serverVersion == QPSQLDriver::VersionUnknown)
     705        serverVersion = QPSQLDriver::Version6;
     706
     707    if (serverVersion < QPSQLDriver::Version71) {
    672708        qWarning("This version of PostgreSQL is not supported and may not work.");
     709
    673710
    674711    return serverVersion;
     
    853890    if (d->pro == QPSQLDriver::Version8 ||
    854891        d->pro == QPSQLDriver::Version81 ||
    855         d->pro == QPSQLDriver::Version82) {
     892        d->pro == QPSQLDriver::Version82 ||
     893        d->pro == QPSQLDriver::Version83 ||
     894        d->pro == QPSQLDriver::Version84 ||
     895        d->pro == QPSQLDriver::Version9) {
    856896        transaction_failed = qstrcmp(PQcmdStatus(res), "ROLLBACK") == 0;
    857897    }
     
    9641004    case QPSQLDriver::Version81:
    9651005    case QPSQLDriver::Version82:
     1006
     1007
     1008
    9661009        stmt = QLatin1String("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
    9671010                "pg_class.relname "
     
    10471090    case QPSQLDriver::Version81:
    10481091    case QPSQLDriver::Version82:
     1092
     1093
     1094
    10491095        stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
    10501096                "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
  • trunk/src/sql/drivers/psql/qsql_psql.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    9898public:
    9999    enum Protocol {
     100
    100101        Version6 = 6,
    101102        Version7 = 7,
     
    105106        Version8 = 11,
    106107        Version81 = 12,
    107         Version82 = 13
     108        Version82 = 13,
     109        Version83 = 14,
     110        Version84 = 15,
     111        Version9 = 16,
    108112    };
    109113
Note: See TracChangeset for help on using the changeset viewer.