//	IntarS
//	copyright Pirmin Braun 1997-2006 - pirmin@pirmin.de
//	all Rights reserved;
#import  "IntarS.h"

#define MySQLHostname		@"hostname"
#define MySQLDatabase		@"database"
#define MySQLName		@"name"
#define MySQLPassword		@"password"

//a lean replacement for EOF; no EOAdaptor, no EOAdaptorContext, no EOAdaptorChannel, no EOModel
//no EOEntities, no snapshots, no delegates, no editingcontext, no displaygroup
//easy to port to Java and JDBC and Linux;
//higher functions are in db-specific PBOrbs;

@interface PBMySQLChannel:NSObject
{
    MYSQL               *sock;

    MYSQL_ROW          	cur;
    MYSQL_FIELD      	*curField;

    MYSQL_RES          	*result;

    BOOL 		isOpen;
    BOOL		isFetchInProgress;
    NSArray		*selectedAttributes;
    int 		dbNr;
    BOOL 		isUTF8;
}
- (int)dbNr;
ACCESSClassh(selectedAttributes,setSelectedAttributes,NSArray)
- (BOOL)isOpen;
- (BOOL)isFetchInProgress;
- (void)endFetch;
- (void)beginFetch;
- (BOOL)openChannel;
- (void)closeChannel;
- (BOOL)connect;
- (unsigned)insertRow:(NSDictionary *)row forTable:(PBDDTable *)t;
- (unsigned)updateRow:(NSDictionary *)row forTable:(PBDDTable *)t pk:(NSString *)pk;
- (unsigned)deleteRow:(NSDictionary *)dict forTable:(PBDDTable *)t;
- (unsigned)selectAttributes:(NSArray *)attributes qualifier:(EOQualifier *)q forTable:(PBDDTable *)t offset:(int)offset count:(int)count soa:(NSArray *)soa;
- (unsigned)selectAttributes:(NSArray *)attributes qualifier:(EOQualifier *)q forTable:(PBDDTable *)t tn:(NSString *)tn offset:(int)offset count:(int)count soa:(NSArray *)soa;
- (unsigned)deleteRowsDescribedByQualifier:(EOQualifier *)qualifier forTable:(PBDDTable *)t;
- (unsigned)evaluateSQL:(NSString *)s;
- (unsigned)evaluateSQL:(NSString *)s useResult:(BOOL)useResult;
- (void)cancelFetch;
- (NSMutableDictionary *)fetchRow;
- (NSArray *)describeResults;
//PBDD Generation
- (NSArray *)describeDatabase;
- (NSArray *)describeTableNames;
- (PBDDTable *)describeTableWithTableName:(NSString *)tableName;
- (NSArray *)describeAttributesForTableNameNew:(NSString *)tableName;
- (BOOL)isUTF8;

@end

