- Inherits From:
- NSDocument
- Declared In:
- MCPDocument.h
BOOL MCPConInfoNeeded, MCPPassNeeded;
NSString *MCPHost, *MCPLogin, *MCPDatabase;
unsigned int MCPPort;
MCPConnection *MCPConnect;
NSWindowController *MCPMainWinCont;
Class MCPConnectedWinCont;
NSString *MCPModelName;
BOOL MCPWillCreateNewDB;
MCPPassNeeded No description. MCPDatabase No description. MCPPort No description. MCPConnect No description. MCPMainWinCont No description. MCPConnectedWinCont Window controller used once the connection is established (As a class). MCPModelName No description. MCPWillCreateNewDB No description.
Class MaintenanceInitialisation and deallocation
- + initialize
Connection to the databse related
- - init
- - dealloc
Accessors to the parameters of the connection
- - MCPqueryString:
- - MCPinsertRow:
- - MCPgetConnection
Accessor to the window generated once the connection is established
- - setMCPHost:
- - setMCPLogin:
- - setMCPDatabase:
- - setMCPPort:
- - setMCPConInfoNeeded:
- - MCPHost
- - MCPLogin
- - MCPDatabase
- - MCPPort
- - MCPConInfoNeeded
- - MCPPassNeeded
- - MCPisConnected
- - MCPConnect
Accessors to the main window (connection or connected window), through their window controller.
- - setMCPConnectedWinCont:
- - MCPConnectedWinCont
Accessors to the DB creation instances.
- - MCPMainWinCont
Practical creation of the database, from a model file.
- - setMCPModelName:
- - setMCPWillCreateNewDB:
- - MCPModelName
- - MCPWillCreateNewDB
Overrides of NSDocument methods.
- - createModelDB
Method to take care of the password sheet.
- - dataRepresentationOfType:
- - loadDataRepresentation:ofType:
- - makeWindowControllers
- - windowControllerDidLoadNib:
- - MCPPasswordSheetDidEnd:returnCode:contextInfo:
+ (void)initialize
No method description.
- (BOOL)MCPConInfoNeeded
Return the status of the gathering of information for the connection.
- (MCPConnection *)MCPConnect
Return a pointer to the used MCPConnection. SHOULD NOT be used (one should rather use the connection methods : MCPqueryString: or MCPinsertRow:)
- (Class)MCPConnectedWinCont
Return the Class object of the class used for the main document window (once the connection to the DB server is established).
- (NSString *)MCPDatabase
Returns the actual database name of the used db server.
- (NSString *)MCPHost
Returns the actual hostname of the used db server.
- (NSString *)MCPLogin
Returns the actual login to the used db server.
- (NSWindowController *)MCPMainWinCont
Return the current main window controller for the document (closing this window causes a close of the document).
- (NSString *)MCPModelName
No method description.
- (BOOL)MCPPassNeeded
Return the status of the gathering of the password for the connection.
- (void)MCPPasswordSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
Method called once the user enterred the password and click Ok (or press return) Try to make a connection (depending of the button clicked), if password is refused, go back to ask connection information.
- (unsigned int)MCPPort
Returns the port used to connect to the database server (0 means default: from mysql.h -> MYSQL_PORT=3306).
- (BOOL)MCPWillCreateNewDB
No method description.
- (MCPConnection *)MCPgetConnection
Get directly the MCPConnection of the MCPDocument... This method should be used with care, because one can (inadvertly) modify the DB connection of the document itself, producing further inexpected state later.
- (unsigned int)MCPinsertRow:(NSString *)insert
Method to use to insert a new row in a table, will return the primary key (auto_increment column) of the new record.
- (BOOL)MCPisConnected
Check if the connection is working.
- (MCPResult *)MCPqueryString:(NSString *)query
Send a query to the MCPConnection instance variable. For insert queries, one should prefer the insert: method, which return the primary key (auto_increment) of the new row.
- (BOOL)createModelDB
No method description.
- (NSData *)dataRepresentationOfType:(NSString *)aType
Return data correspoding to archived dictionary containing the parameters for the connection (except for the password, not saved).
- (void)dealloc
Deallocation of the object... autorelease all the members.
- (id)init
Initialisation of the MCPDocument object, by default every thing is setted to null (or empty), accordingly to that the mConInfoNeeded is setted to YES (true): the connection information (parameters) ARE needed.
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
Load a file containing the connection parameters (except for the password) in the instance of the MCPDocument.
- (NSArray *)makeWindowControllers
Make the proper window: either the Connection Info window or the main browser window.
- (void)setMCPConInfoNeeded:(BOOL)theConInfoNeeded
VERY IMPORTANT method! Change the value of mConInfoNeeded AND toggle the states of the object, removing appropriate window and displaying other(s) ...
- (void)setMCPConnectedWinCont:(Class)theConnectedWinCont
Use to set the type of NSWindowController to be used for the main window of the document once the connection as been established.
- (void)setMCPDatabase:(NSString *)theDatabase
Sets the name of the database to use on the db server (doesn't accept changes once mConInfoNeeded is NO).
- (void)setMCPHost:(NSString *)theHost
Sets the name of the host to which to connect (the one which the db server runs) (doesn't accept changes once MCPConInfoNeeded is NO).
- (void)setMCPLogin:(NSString *)theLogin
Sets the name of the database to use on the db server (doesn't accept changes once MCPConInfoNeeded is NO).
- (void)setMCPModelName:(NSString *)theModelName
No method description.
- (void)setMCPPort:(unsigned int)thePort
Set the port to use to connect to the database server (doesn't accept changes once mConInfoNeeded is NO).
- (void)setMCPWillCreateNewDB:(BOOL)theWillCreateNewDB
No method description.
- (void)windowControllerDidLoadNib:(NSWindowController *)aController
What to do when a specific window is loaded: - Nothing for the Connection Info Window (MCPConnectionWindow.nib). - Whatever one wants for another window type.
Indeed it looks like this method is never called, unless one has a single window controller document... not the case here...