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/tds/qsql_tds.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**
     
    165165extern "C" {
    166166static int CS_PUBLIC qTdsMsgHandler (DBPROCESS* dbproc,
    167                             DBINT /*msgno*/,
     167                            DBINT ,
    168168                            int msgstate,
    169169                            int severity,
    170170                            char* msgtext,
    171                             char* /*srvname*/,
     171                            char* ,
    172172                            char* /*procname*/,
    173                             int /*line*/)
     173                            int )
    174174{
    175175    QTDSResultPrivate* p = errs()->value(dbproc);
     
    182182
    183183    if (severity > 0) {
    184         QString errMsg = QString(QLatin1String("%1 (%2)")).arg(QString::fromAscii(msgtext)).arg(
    185                                     msgstate);
     184        QString errMsg = QString::fromLatin1("%1 (Msg %2, Level %3, State %4, Server %5, Line %6)")
     185                         .arg(QString::fromAscii(msgtext))
     186                         .arg(msgno)
     187                         .arg(severity)
     188                         .arg(msgstate)
     189                         .arg(QString::fromAscii(srvname))
     190                         .arg(line);
    186191        p->addErrorMsg(errMsg);
     192
     193
     194
     195
     196
     197
    187198    }
    188199
     
    212223
    213224
    214     QString errMsg = QString(QLatin1String("%1 %2\n")).arg(QString::fromAscii(dberrstr)).arg(
    215                                 QString::fromAscii(oserrstr));
     225    QString errMsg = QString(dberrstr)).arg(
     226                                Q(oserrstr));
    216227    errMsg += p->getErrorMsgs();
    217228    p->lastError = qMakeError(errMsg, QSqlError::UnknownError, dberr);
     
    294305    // insert d in error handler dict
    295306    errs()->insert(d->dbproc, d);
     307
     308
    296309}
    297310
     
    368381                    values[idx] = QVariant(QVariant::String);
    369382                else
    370                     values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i * 2));
     383                    values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i * 2));
    371384                break;
    372385            case QVariant::ByteArray: {
     
    699712    QSqlQuery t(createResult());
    700713    t.setForwardOnly(true);
     714
     715
     716
     717
     718
    701719    QString stmt (QLatin1String("select name, type, length, prec from syscolumns "
    702720                   "where id = (select id from sysobjects where name = '%1')"));
    703     t.exec(stmt.arg(tablename));
     721    t.exec(stmt.arg(table));
    704722    while (t.next()) {
    705723        QSqlField f(t.value(0).toString().simplified(), qDecodeTDSType(t.value(1).toInt()));
     
    748766    else if (field.type() == QVariant::DateTime) {
    749767        if (field.value().toDateTime().isValid()){
    750             r = field.value().toDateTime().toString(QLatin1String("'yyyyMMdd hh:mm:ss'"));
     768            r = field.value().toDateTime().toString(QLatin1String("yyyyMMdd hh:mm:ss"));
     769            r.prepend(QLatin1String("'"));
     770            r.append(QLatin1String("'"));
    751771        } else
    752772            r = QLatin1String("NULL");
     
    771791    QSqlRecord rec = record(tablename);
    772792
    773     QSqlIndex idx(tablename);
    774     if ((!isOpen()) || (tablename.isEmpty()))
     793    QString table = tablename;
     794    if (isIdentifierEscaped(table, QSqlDriver::TableName))
     795        table = stripDelimiters(table, QSqlDriver::TableName);
     796
     797    QSqlIndex idx(table);
     798    if ((!isOpen()) || (table.isEmpty()))
    775799        return QSqlIndex();
    776800
    777801    QSqlQuery t(createResult());
    778802    t.setForwardOnly(true);
    779     t.exec(QString::fromLatin1("sp_helpindex '%1'").arg(tablename));
     803    t.exec(QString::fromLatin1("sp_helpindex '%1'").arg(table));
    780804    if (t.next()) {
    781805        QStringList fNames = t.value(2).toString().simplified().split(QLatin1Char(','));
     
    795819}
    796820
     821
     822
     823
     824
     825
     826
     827
     828
     829
     830
     831
    797832QT_END_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.