Example: Closing without Saving

This example shows how using File - Close without saving a project can affect local tables and components differently from those saved already into a data source, such as a linked database.

 

If a project has only local components then closing it without saving changes made will leave the original .map project file unchanged.    However, if we have linked in data sources and we have made any changes to those data sources, in general those changes will have been committed to those data sources at the time we made the changes.   Closing the project without saving will not "undo" changes already made to external data sources.    

 

In this example we create a data source using a Microsoft Access .mdb file database.  We can connect to Access .mdb only in 32-bit settings (a result of Microsoft's uneven move to 64-bit applications), so to follow along and to duplicate this example, make sure to run 32-bit Manifold.    See also the Example: Create and Use New Data Source using an MDB Database topic.

 

tech_ravi_sm.png

Very Important:  In this example we launch 32-bit Manifold to connect to .mdb files.   We do this even if we are operating in 64-bit Windows and would normally launch 64-bit Manifold.  If we are running 32-bit Windows the only Manifold we have available is 32-bit, of course, but even if we are running 64-bit Windows we must choose to run 32-bit Manifold to connect to an MDB file.

 

Using 32-bit Manifold avoids complications arising from incompatibility between Microsoft's 64-bit Access Database Engine and other Microsoft applications that may be installed on the same system.

 

eg_datasrc01_00.png

 

ico_nb_arrow_blue.pngLaunch 32-bit Manifold.   

 

 

eg_not_saving01_01.png

 

Choose File - Create - New Data Source.

 

eg_not_saving01_02.png

 

We specify a Name of books.mdb, choose a Type of File: mdb and then use the browse [...] button to browse over to a Source of C:\data\books.mdb. That .mdb is a Microsoft Access .mdb file database that contains tables, queries and examples for Chris Fehily's fine book, SQL: Visual QuickStart Guide, which is highly recommended by Manifold for anyone new to SQL.   

 

Press Create Data Source and a new data source is added to the project.

 

 

eg_not_saving01_2a.png

 

 

We expand the books.mdb data source and then double-click on the authors table to open it.

 

 

eg_not_saving01_2b.png

 

Click on the authors table to highlight it in the Project pane and then press the Copy icon in the Project pane toolbar.

 

 

eg_not_saving01_03.png

 

We close the books mdb data source to provide more free space in the Project pane.   Click anywhere in the "white space" of the Project pane and press on the Paste icon in the Project pane toolbar.

 

 

eg_not_saving01_04.png

 

We have just created a copy of the authors table that is in the .mdb file database, with the copy being created as a local table within the project.

 

eg_not_saving01_05.png

 

We will now use File - Save As to save the project.

 

eg_not_saving01_06.png

 

 

We will save the project using the name books with mdb as the name for our .map project file.

 

Next, we will modify the tables in the project, beginning with the authors table that is inside the books mdb data source, that is, within the .mdb file database to which that data source is linked.

 

We double-click into the au_fname field for the last record to edit it, change the name from Paddy to Sean, and then commit the edit by pressing Enter and then Ctrl-Enter.

 

 

eg_not_saving01_07.png

 

We have just changed the record within the .mdb file database.   We will now edit the local copy that we made of that table.   We double-click the authors table in the Project pane.

 

 

eg_not_saving01_08.png

 

We can see that obviously it is indeed a copy of the authors table in the .mdb file database.   Note that when multiple window are open in the Manifold desktop we can tell which is which by the names on their tabs.   The authors : books mdb tab is for the authors table that resides in the books mdb data source while the authors tab is for the local authors table that resides in the project.

 

We edit the same field in the local authors table to change the name from Paddy to James.

 

eg_not_saving01_09.png

 

We will now Close the file without saving it.

 

eg_not_saving01_10.png

 

When we issue a File - Close command Manifold knows the project has changed but has not been saved since changes were made so Manifold will ask us if we want to save changes.

 

 

eg_not_saving01_11.png

 

 

We Press No.   This will close the project and will not update the books with mdb.map  file that was last saved.

 

 

eg_not_saving01_12.png

 

Let us now Open the books with mdb.map project file we previously saved.

 

eg_not_saving01_13.png

 

When the project opens we see it still has as expected both the books mdb data source as well as the authors local table we created by copying and pasting a table from the data source.   

 

eg_not_saving01_14.png

 

If we double-click on the local authors table to open it we see that the edit we made to that table, to change the name in the last record from Paddy to James, has disappeared.   That is because the last time we saved this project was before the edit so what we see in the local table is how it appeared at the time we saved the project but before we changed the name.

 

eg_not_saving01_15.png

 

In contrast, if we drill down into the books mdb data source and open the authors table within the .mdb file database, we can see that the edit we made to that table, changing the name from Paddy to Sean, has not disappeared.   The name has indeed been changed.   

 

eg_not_saving01_16.png

 

We might find that unexpected given that we made the change from Paddy to Sean after we saved the project.

 

In the case of the data source connected to the .mdb file database, it doesn't matter that we made the edit after we saved the project because the data source is a live, dynamic connection to the .mdb file database.   If we change a record in an .mdb file database the changes take immediate effect, as changes to records do with almost every database.    The moment we committed our change of Paddy to Sean by pressing Ctrl-Enter that change was propagated into and committed to the .mdb file database which the books mdb data source represents.

 

When we use File - Save or File - Save As to save the project to a .map project file, we are saving data that is stored within the project and we are storing housekeeping information, such as connection strings, required to reconnect to any data sources that have been created in the project.   Any changes to data within data sources typically have already been made whether or not we save the project.  If we close the project without saving it, those changes which have already been made to an external data source will not be undone

 

See Also

Getting Started - For a discussion of importing compared to linking and where data is stored.

 

File - Create - New Data Source

 

File - New / Open / Close / Save / Save As

 

Example: Create and Use New Data Source using an MDB Database