Example #1
0
QDebug operator<<(QDebug dbg, const QSqlField &f)
{
    dbg.nospace() << "QSqlField(" << f.name() << ", " << QMetaType::typeName(f.type());
    if (f.length() >= 0)
        dbg.nospace() << ", length: " << f.length();
    if (f.precision() >= 0)
        dbg.nospace() << ", precision: " << f.precision();
    if (f.requiredStatus() != QSqlField::Unknown)
        dbg.nospace() << ", required: "
                      << (f.requiredStatus() == QSqlField::Required ? "yes" : "no");
    dbg.nospace() << ", generated: " << (f.isGenerated() ? "yes" : "no");
    if (f.typeID() >= 0)
        dbg.nospace() << ", typeID: " << f.typeID();
    if (!f.defaultValue().isNull())
        dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"';
    dbg.nospace() << ')';
    return dbg.space();
}
Example #2
0
QDebug operator<<(QDebug dbg, const QSqlField &f)
{
#ifndef Q_BROKEN_DEBUG_STREAM
    dbg.nospace() << "QSqlField(" << f.name() << ", " << QVariant::typeToName(f.type());
    if (f.length() >= 0)
        dbg.nospace() << ", length: " << f.length();
    if (f.precision() >= 0)
        dbg.nospace() << ", precision: " << f.precision();
    if (f.requiredStatus() != QSqlField::Unknown)
        dbg.nospace() << ", required: "
                      << (f.requiredStatus() == QSqlField::Required ? "yes" : "no");
    dbg.nospace() << ", generated: " << (f.isGenerated() ? "yes" : "no");
    if (f.typeID() >= 0)
        dbg.nospace() << ", typeID: " << f.typeID();
    if (!f.defaultValue().isNull())
        dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"';
    dbg.nospace() << ')';
    return dbg.space();
#else
    qWarning("This compiler doesn't support streaming QSqlField to QDebug");
    return dbg;
    Q_UNUSED(f);
#endif
}