//
//  DBQuery.h
//  EAMiPad
//
//  Created by temp on 3/15/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GridData.h"
#import "GridField.h"

@interface DBQuery : NSObject

@property (nonatomic        )   BOOL                     isLogin;
@property (nonatomic        )   BOOL                     isBypassFlex;
@property (nonatomic        )   BOOL                     bypassAudit;
@property (nonatomic        )   BOOL                     isSyncCommand;  //This flag is added to skip logging PK violiation

- (BOOL)rollback;
- (BOOL)commit;
- (void)closeConnection;
- (void)closeGeoDBConnection;
- (BOOL)beginTransaction;
- (BOOL)executeNonQuery:(NSString *)query withError:(NSError **)error;
- (BOOL)executeNonQuery:(NSString *)query withArgumentsInArray:(NSArray *)args withError:(NSError **)error;
- (BOOL)executeNonQueryWithOutAudit:(NSString *)query withError:(NSError **)error;
- (BOOL)executeNonQueryWithOutAudit:(NSString *)query withArgumentsInArray:(NSArray *)args withError:(NSError **)error;
- (GridData *)getData:(NSString *)query withError:(NSError **)error;
- (GridData *)getData:(NSString *)query withLimitRows:(BOOL )limitRows withError:(NSError **)error;
- (GridData *)getData:(NSString *)query
     withNumberofRows:(long)rows
  withCurrentPosition:(long)currentPosition
            withError:(NSError **)error;
- (GridData *)getData:(NSString *)query withArgumentsInArray:(NSArray *)args withError:(NSError **)error;
-(GridData *)getGeoDBData:(NSString *)query withError:(NSError **)error geoDBpath:(NSString *)geoDBpath;
+ (NSString *)sqlSafe:(id)value;
+ (id)sqlSafeNumber:(id)value;

-(BOOL)didTransactionSucceed;
- (NSString *)getError;
- (BOOL)rollbackTransaction;
- (id)initWithBypassFlex;

@end
