当前位置: 首页>>代码示例>>C++>>正文


C++ TSqlORMapper类代码示例

本文整理汇总了C++中TSqlORMapper的典型用法代码示例。如果您正苦于以下问题:C++ TSqlORMapper类的具体用法?C++ TSqlORMapper怎么用?C++ TSqlORMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TSqlORMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gc

int TSessionSqlObjectStore::gc(const QDateTime &expire)
{
    TSqlORMapper<TSessionObject> mapper;
    TCriteria cri(TSessionObject::UpdatedAt, TSql::LessThan, expire);
    int cnt = mapper.removeAll(cri);
    return cnt;
}
开发者ID:AbhimanyuAryan,项目名称:treefrog-framework,代码行数:7,代码来源:tsessionsqlobjectstore.cpp

示例2: store

bool TSessionSqlObjectStore::store(TSession &session)
{
    TSqlORMapper<TSessionObject> mapper;
    TCriteria cri(TSessionObject::Id, TSql::Equal, session.id());
    TSessionObject so = mapper.findFirst(cri);

#ifndef TF_NO_DEBUG
    {
        QByteArray badummy;
        QDataStream dsdmy(&badummy, QIODevice::ReadWrite);
        dsdmy << *static_cast<const QVariantMap *>(&session);

        TSession dummy;
        dsdmy.device()->seek(0);
        dsdmy >> *static_cast<QVariantMap *>(&dummy);
        if (dsdmy.status() != QDataStream::Ok) {
            tSystemError("Failed to store a session into the cookie store. Must set objects that can be serialized.");
        }
    }
#endif

    QDataStream ds(&so.data, QIODevice::WriteOnly);
    ds << *static_cast<const QVariantMap *>(&session);

    if (ds.status() != QDataStream::Ok) {
        tSystemError("Failed to store session. Must set objects that can be serialized.");
        return false;
    }

    if (so.isNull()) {
        so.id = session.id();
        return so.create();
    }
    return so.update();
}
开发者ID:skipbit,项目名称:treefrog-framework,代码行数:35,代码来源:tsessionsqlobjectstore.cpp

示例3: remove

bool TSessionSqlObjectStore::remove(const QDateTime &garbageExpiration)
{
    TSqlORMapper<TSessionObject> mapper;
    TCriteria cri(TSessionObject::UpdatedAt, TSql::LessThan, garbageExpiration);
    int cnt = mapper.removeAll(cri);
    return (cnt >= 0);
}
开发者ID:Keloran,项目名称:treefrog-framework,代码行数:7,代码来源:tsessionsqlobjectstore.cpp

示例4: get

RefPackingDef RefPackingDef::get(const QString &createdBy, const QString &updatedBy)
{
    TCriteria cri;
    cri.add(RefPackingDefObject::CreatedBy, createdBy);
    cri.add(RefPackingDefObject::UpdatedBy, updatedBy);
    TSqlORMapper<RefPackingDefObject> mapper;
    return RefPackingDef(mapper.findFirst(cri));
}
开发者ID:hks2002,项目名称:AM,代码行数:8,代码来源:refpackingdef.cpp

示例5: get

Vehicles Vehicles::get(int id, int lockRevision)
{
    TSqlORMapper<VehiclesObject> mapper;
    TCriteria cri;
    cri.add(VehiclesObject::Id, id);
    cri.add(VehiclesObject::LockRevision, lockRevision);
    return Vehicles(mapper.findFirst(cri));
}
开发者ID:czjin,项目名称:bbpark,代码行数:8,代码来源:vehicles.cpp

示例6: get

ParkAttendants ParkAttendants::get(int id, int lockRevision)
{
    TSqlORMapper<ParkAttendantsObject> mapper;
    TCriteria cri;
    cri.add(ParkAttendantsObject::Id, id);
    cri.add(ParkAttendantsObject::LockRevision, lockRevision);
    return ParkAttendants(mapper.findFirst(cri));
}
开发者ID:czjin,项目名称:bbpark,代码行数:8,代码来源:parkattendants.cpp

示例7: get

ChatLog ChatLog::get(int id, int lockRevision)
{
    TSqlORMapper<ChatLogObject> mapper;
    TCriteria cri;
    cri.add(ChatLogObject::Id, id);
    cri.add(ChatLogObject::LockRevision, lockRevision);
    return ChatLog(mapper.findFirst(cri));
}
开发者ID:treefrogframework,项目名称:chatapp,代码行数:8,代码来源:chatlog.cpp

示例8: get

UserVehicle UserVehicle::get(int id, int lockRevision)
{
    TSqlORMapper<UserVehicleObject> mapper;
    TCriteria cri;
    cri.add(UserVehicleObject::Id, id);
    cri.add(UserVehicleObject::LockRevision, lockRevision);
    return UserVehicle(mapper.findFirst(cri));
}
开发者ID:czjin,项目名称:bbpark,代码行数:8,代码来源:uservehicle.cpp

示例9: getAllJson

QJsonArray AccountsRecharge::getAllJson()
{
    QJsonArray array;
    TSqlORMapper<AccountsRechargeObject> mapper;

    if (mapper.find() > 0) {
        for (TSqlORMapperIterator<AccountsRechargeObject> i(mapper); i.hasNext(); ) {
            array.append(QJsonValue(QJsonObject::fromVariantMap(AccountsRecharge(i.next()).toVariantMap())));
        }
    }
    return array;
}
开发者ID:czjin,项目名称:bbpark,代码行数:12,代码来源:accountsrecharge.cpp

示例10: getAllJson

QJsonArray ParkAttendants::getAllJson()
{
    QJsonArray array;
    TSqlORMapper<ParkAttendantsObject> mapper;

    if (mapper.find() > 0) {
        for (TSqlORMapperIterator<ParkAttendantsObject> i(mapper); i.hasNext(); ) {
            array.append(QJsonValue(QJsonObject::fromVariantMap(ParkAttendants(i.next()).toVariantMap())));
        }
    }
    return array;
}
开发者ID:czjin,项目名称:bbpark,代码行数:12,代码来源:parkattendants.cpp

示例11: getAllJson

QJsonArray UserVehicle::getAllJson()
{
    QJsonArray array;
    TSqlORMapper<UserVehicleObject> mapper;

    if (mapper.find() > 0) {
        for (TSqlORMapperIterator<UserVehicleObject> i(mapper); i.hasNext(); ) {
            array.append(QJsonValue(QJsonObject::fromVariantMap(UserVehicle(i.next()).toVariantMap())));
        }
    }
    return array;
}
开发者ID:czjin,项目名称:bbpark,代码行数:12,代码来源:uservehicle.cpp

示例12: count

void ChatLog::removeOldLogs(int remainingCount)
{
    int del = count() - remainingCount;
    if (del > 0) {
        TSqlORMapper<ChatLogObject> mapper;
        mapper.setSortOrder(ChatLogObject::Id, Tf::DescendingOrder);
        auto log = mapper.findFirst();
        int maxId = log.id;

        TCriteria ctr(ChatLogObject::Id, TSql::LessEqual, maxId - remainingCount);
        mapper.removeAll(ctr);
    }
}
开发者ID:treefrogframework,项目名称:chatapp,代码行数:13,代码来源:chatlog.cpp

示例13: store

bool TSessionSqlObjectStore::store(TSession &session)
{
    TSqlORMapper<TSessionObject> mapper;
    TCriteria cri(TSessionObject::Id, TSql::Equal, session.id());
    TSessionObject so = mapper.findFirst(cri);

    QDataStream ds(&so.data, QIODevice::WriteOnly);
    ds << *static_cast<const QVariantHash *>(&session);

    if (so.isEmpty()) {
        so.id = session.id();
        return so.create();
    }
    return so.update();
}
开发者ID:Keloran,项目名称:treefrog-framework,代码行数:15,代码来源:tsessionsqlobjectstore.cpp

示例14: find

TSession TSessionSqlObjectStore::find(const QByteArray &id, const QDateTime &modified)
{
    TSqlORMapper<TSessionObject> mapper;
    TCriteria cri;
    cri.add(TSessionObject::Id, TSql::Equal, id);
    cri.add(TSessionObject::UpdatedAt, TSql::GreaterEqual, modified);

    TSessionObject sess = mapper.findFirst(cri);
    if (sess.isEmpty())
        return TSession();
    
    TSession result(id);
    QDataStream ds(&sess.data, QIODevice::ReadOnly);
    ds >> *static_cast<QVariantHash *>(&result);
    return result;  
}
开发者ID:Keloran,项目名称:treefrog-framework,代码行数:16,代码来源:tsessionsqlobjectstore.cpp

示例15: find

TSession TSessionSqlObjectStore::find(const QByteArray &id)
{
    QDateTime modified = QDateTime::currentDateTime().addSecs(-lifeTimeSecs());
    TSqlORMapper<TSessionObject> mapper;
    TCriteria cri;
    cri.add(TSessionObject::Id, TSql::Equal, id);
    cri.add(TSessionObject::UpdatedAt, TSql::GreaterEqual, modified);

    TSessionObject so = mapper.findFirst(cri);
    if (so.isNull()) {
        return TSession();
    }

    TSession session(id);
    QDataStream ds(&so.data, QIODevice::ReadOnly);
    ds >> *static_cast<QVariantMap *>(&session);

    if (ds.status() != QDataStream::Ok) {
        tSystemError("Failed to load a session from the sqlobject store.");
    }
    return session;
}
开发者ID:skipbit,项目名称:treefrog-framework,代码行数:22,代码来源:tsessionsqlobjectstore.cpp


注:本文中的TSqlORMapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。