Skip to content

从1.x版本升级到2.x后,如何获取columName?? #1543

@LynGao

Description

@LynGao

有旧版本的代码,如何适配到2.x的版本。研究了很久,结果还是不行。

    WCDB::JoinClause join = WCDB::JoinClause("MessageT").join("GroupT",WCDB::JoinClause::Type::Left).on(MessageT.sId == GroupT.teamId);
    WCTResultList resultList = {MessageT.AllProperties.inTable(@"MessageT"),GroupT.name};
    WCTOrderByList orderBy = MessageT.timestamp.order(isDesc ? WCTOrderedDescending : WCTOrderedAscending);
    WCDB::StatementSelect select = WCDB::StatementSelect().select(resultList).from(join).where(wctCondition).orderBy(orderBy).limit(limit);
    WCTStatement *statement = [self.database prepare:select];

     while (statement && [statement step]) {
        NSLog(@"satetement:%@",statement);
        NSMutableDictionary *mutDic = [[NSMutableDictionary alloc] init];


        int columnCount = [statement getColumnCount];
        static const char * k_name = "fGroupName";
        for (int i = 0; i<columnCount; i++) {
            NSString *columName = [statement getColumnNameAtIndex:i];
            WCTValue *value = [statement getValueAtIndex:i];
            NSLog("collumName = %@",columName);
        }
     }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions