Changeset 846 for trunk/src/sql/drivers/psql
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/sql/drivers/psql/qsql_psql.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 55 55 #include <qmutex.h> 56 56 57 58 57 #include <libpq-fe.h> 59 58 #include <pg_config.h> … … 620 619 } 621 620 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 622 665 static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection) 623 666 { … … 627 670 if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) { 628 671 QString val = QString::fromAscii(PQgetvalue(result, 0, 0)); 672 629 673 QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)")); 630 674 rx.setMinimal(true); // enforce non-greedy RegExp 675 631 676 if (rx.indexIn(val) != -1) { 632 677 int vMaj = rx.cap(1).toInt(); 633 678 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(); 666 684 } 685 686 687 688 689 690 691 692 693 694 695 696 697 698 667 699 } 668 700 } 669 701 PQclear(result); 670 702 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) { 672 708 qWarning("This version of PostgreSQL is not supported and may not work."); 709 673 710 674 711 return serverVersion; … … 853 890 if (d->pro == QPSQLDriver::Version8 || 854 891 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) { 856 896 transaction_failed = qstrcmp(PQcmdStatus(res), "ROLLBACK") == 0; 857 897 } … … 964 1004 case QPSQLDriver::Version81: 965 1005 case QPSQLDriver::Version82: 1006 1007 1008 966 1009 stmt = QLatin1String("SELECT pg_attribute.attname, pg_attribute.atttypid::int, " 967 1010 "pg_class.relname " … … 1047 1090 case QPSQLDriver::Version81: 1048 1091 case QPSQLDriver::Version82: 1092 1093 1094 1049 1095 stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, " 1050 1096 "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, " -
trunk/src/sql/drivers/psql/qsql_psql.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 98 98 public: 99 99 enum Protocol { 100 100 101 Version6 = 6, 101 102 Version7 = 7, … … 105 106 Version8 = 11, 106 107 Version81 = 12, 107 Version82 = 13 108 Version82 = 13, 109 Version83 = 14, 110 Version84 = 15, 111 Version9 = 16, 108 112 }; 109 113
Note:
See TracChangeset
for help on using the changeset viewer.