FRAFMDatabaseFactory.m revision 721bb987c406979bcfe705fa1ca8d54497d40fcb
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster/*
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * The contents of this file are subject to the terms of the Common Development and
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * Distribution License (the License). You may not use this file except in compliance with the
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * License.
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster *
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * specific language governing permission and limitations under the License.
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster *
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * When distributing Covered Software, include this CDDL Header Notice in each file and include
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * Header, with the fields enclosed by brackets [] replaced by your own identifying
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * information: "Portions copyright [year] [name of copyright owner]".
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster *
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster * Copyright 2016 ForgeRock AS.
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster */
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster#import "FMDatabase.h"
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster#import "FRAFMDatabaseFactory.h"
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster#import "FRAError.h"
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster@implementation FRAFMDatabaseFactory : NSObject
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster-(FMDatabase *)createDatabaseFor:(NSString *)path withError:(NSError *__autoreleasing *)error {
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster FMDatabase *database = [FMDatabase databaseWithPath:path];
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster if (database == nil) {
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster [FRAError createErrorForFilePath:path withReason:@"Could not open database" withError:error];
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster }
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster return database;
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster}
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster
fb98811412f1a61efdc30b38091bf4708148a806Allan Foster@end