You are on page 1of 19

1

Version Control and Team Coding in Toad for Oracle

Author: Stephen Beausang – Toad Development Team

Contents
Using version control with and without Team Coding ................................................................... 3
Configuring version control in Toad............................................................................................... 4
Setting up and using Team Coding ................................................................................................. 6
Installing Team Coding ................................................................................................................... 7
Using Team Coding in Toad ......................................................................................................... 15

2

© 2013 Quest Software, Inc.
ALL RIGHTS RESERVED.
This guide contains proprietary information protected by copyright. The software described in
this guide is furnished under a software license or nondisclosure agreement. This software may
be used or copied only in accordance with the terms of the applicable agreement. No part of this
guide may be reproduced or transmitted in any form or by any means, electronic or mechanical,
including photocopying and recording for any purpose other than the purchaser’s personal use
without the written permission of Quest Software, Inc.

The information in this document is provided in connection with Quest products. No license,
express or implied, by estoppel or otherwise, to any intellectual property right is granted by this
document or in connection with the sale of Quest products. EXCEPT AS SET FORTH IN
QUEST'S TERMS AND CONDITIONS AS SPECIFIED IN THE LICENSE AGREEMENT
FOR THIS PRODUCT, QUEST ASSUMES NO LIABILITY WHATSOEVER AND
DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO
ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-
INFRINGEMENT. IN NO EVENT SHALL QUEST BE LIABLE FOR ANY DIRECT,
INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES
(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS
INTERRUPTION OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR
INABILITY TO USE THIS DOCUMENT, EVEN IF QUEST HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. Quest makes no representations or warranties with
respect to the accuracy or completeness of the contents of this document and reserves the right to
make changes to specifications and product descriptions at any time without notice. Quest does
not make any commitment to update the information contained in this document.

If you have any questions regarding your potential use of this material, contact:
Quest Software World HeadquartersLEGAL Dept5 Polaris WayAliso Viejo, CA 92656email:
legal@quest.com

Refer to our Web site (www.quest.com) for regional and international office information.
3

Using version control with and without Team Coding
You can use Toad with a version-control system (VCS) to manage source files. Toad then manages the
changes to files, but not database objects. This does not require any server-side objects.
You can also use a version-control system in conjunction with Team Coding in Toad to control source
files that are not database dependent. Team Coding controls database objects which contain source code,
such as procedures, functions, and triggers by locking a record in the database. Toad interfaces directly
with the version-control system to provide version history for database objects and files.
If you are using Toad with a version control system, should you also
use Team Coding?
Version control system With Team Coding*
Key Features
 Controls source files only (no
server side objects)
 User decides which files to control
 Uses Source Control VCS**
Browser

 Controls compiled database objects
and source files (requires server side
objects)
 Optionally uses Code Collections to
control objects and files
 The Team Coding Administrator
determines which objects and / or
source files to control.
 Uses Team Coding Viewer
 Uses Team Coding VCS Browser
How to configure
 All options are stored locally. Use
Toad Options | Source Control
to configure

 Use Utilities | Team Coding |
Configure Team Coding
 Code Collections are managed in the
Code Collections dialog
 Global settings (for all users) are
stored in the database
 Some user options are stored locally
using Toad Options | Source
Control | Team Coding
Where items are controlled in Toad
 Editor
 Project Manager
 Source Control VCS Browser
 Editor
 Schema Browser
 Project Manager
 Team Coding Viewer
 Team Coding VCS Browser
* Toad imposes a limitation on your version-control system when used with Team Coding:
- In Toad, your version-control system is disabled if you are logged on to a
database that is controlled by Team Coding and has at least one file type Code
Collection item.
- In this case, the Team Coding rules are enforced and your source control provider
is ignored.
** VCS indicates Version Control System, meaning your version-control provider.

4

Please note that you can also use Team Coding in Toad without using a version-control system.
Configuring version control in Toad
This example uses Microsoft Team Foundation Server (TFS). See separate documentation for other
provider set-up.
1. Verify that your source-control provider and projects have been set up and configured correctly,
and that you can perform commands using your local provider tool outside of Toad.
2. In Toad, go to View | Toad Options | Source Control.



3. Make your Default VCS selection.
4. Click Settings.
Each provider‟s configuration is unique. TFS configuration
options are shown here.
Note: Under “Connection,” you can optionally
select:
Automatically Log in to default TFS
workspace.
It is a good practice to leave this off initially, if you
are setting up Team Coding and want to test your
configuration.
Once everything is configured correctly, you can
check this box if you do not wish to get a login screen every time you connect to the
server via Toad.
Your version-control provider is now configured and ready to use.

5

Working with your version-control provider in Toad’s Editor
Toad allows you to check in / check out source files from the Editor or the Project Manager. In the Editor,
you can use the VCS options on the Team Coding toolbar to perform functions, or right click on the editor
and select the Source Control list.
1. Open the Editor.
2. On the toolbar click the „Select Version Control Project‟ button.
The Login window for your provider opens.

3. Enter connection and/or local workspace information.
Toad saves this information for subsequent logons.
4. In the Select Project window, expand the list to select the VCS project and click OK.


If the Working Directory is required and does not exist, Toad prompts you to create it.
5. Type in the editor to create a new file.
6. Click the „Save as‟ button on the regular toolbar to save it locally.
The location defaults to your project.
The version-control buttons in the toolbar become available.
7. Click the „Add file to source control‟ button on the Team Coding toolbar.
You will see a success message in the output window.
Edit a file that is controlled in your version-control system:
1. Open the file in the Editor using the regular „Open File‟ button.
2. Click the „Check Out current Object/File‟ button in the Toolbar.
If the file is controlled in your version-control system, you will see a success message in the
output window.
6

3. Edit and save the file, and then click „Check in‟ to check in your changes.
More version-control functions
Toad also provides these version-control functions:
 „Get Latest,‟ „Undo Checkout‟ and „Compare Contents.‟
 „Check in All Source Control Files.‟
This displays all of the files that you have checked out and allows you to check them in.
 The Source Control Browser which allows you browse source control projects, perform check out
functions, and to open files in the Editor.
To use this function click the „Source Control Version Control Browser‟ button on the toolbar.
Setting up and using Team Coding
There are several steps to setting up Team Coding for use with a version-control system.
 Configure the version-control system.
 Configure Team Coding Options (the Team Coding server-side objects are installed
during this process).
 Set up Code Collections for objects or files that you wish to control.
We cover each of these steps in detail, walking you through the menu options.
Team Coding Toolbar and Menu
Team Coding can be accessed from the Team Coding toolbar on the main Toad window, or from the
main toolbar: Utilities |Team Coding.

Team Coding toolbar
If the Team Coding Toolbar is not visible when you open Toad:
 Right-click on the main Toad toolbar,
 Select Team Coding.

Utilities | Team Coding
We refer to menu items, but you can also use the Toolbar.

7

Installing Team Coding
1. Connect to the database that you wish to control with Team Coding.
2. Go to Utilities | Team Coding | Configure Team Coding.
An information dialog alerts you if Team Coding Objects are not installed. This requires that your
logon has DBA privileges.
Click OK.
3. Click Install Team Coding and follow the steps in the install wizard.
Team Coding must be installed in a publically accessible schema.
This installs the Team Coding server-side objects in the database.
We are using the Toad Schema.
Note: If the Toad schema does not exist, Toad prompts you to create it:
In the Create Toad User window, type a password and confirm it.
4. Select an Administrator Role for Team Coding.
The default value is TC_ADMIN_ROLE. The installing user is granted the TC_ADMIN_ROLE by
default. You may also assign this role to other users. TC Admin has the following additional
privileges:
- Configure Team Coding
- Create Code Collections
- Freeze Objects
- Uninstall Team Coding
Click Next.
5. In the Team Coding Installation window, click Execute.
8


This installs the server-side objects.
6. Log in to the schema you specified or created, and then click OK.
7. In the Team Coding Configuration window once again, click Enable Team Coding for this
Database.
8. Click Use Code Collections.
If you will use Team Coding in conjunction with a version-control system:
9. Select Use Version Control System (VCS).
10. Make your selection and click Configure.
Note: Some providers, such as Visual Source Safe and all providers that are supported through
the Microsoft SCC API, do not allow a separate client configuration from Toad. In this case, the
configuration is done when the provider is installed.
9

Example for TFS
The dialog pictured below is specifically for Team Foundation Server.

A typical configuration is shown below.
This example shows the following options selected:
Use Code Collections – This option allows us to specify which objects we wish to control.
If this option is turned off, all objects are controlled by default.
Use Version Control – Team Coding uses your version-control system to maintain version
history for controlled objects. In this example, we have selected „Microsoft Team Foundation
Server (2005-2010) from the VCS dropdown.
You may also use Code Analysis to validate Team Coding objects before check- in. This is a
separate topic and covered in Toad help.
11. Make your remaining selections and click OK.
You are prompted to log on to the VCS Provider.
At this point, you are asked via a prompt if you would like to set up Code Collections now. That is covered
in the next section.
10

Set up Code Collections to control Team Coding Objects
Code Collections enable the Team Coding Administrator to specify the objects to be controlled by Team
Coding. You need TC_ADMIN privileges to edit code collections.
In this example, we set up code collections to control all Team Coding objects in the TKD_SCHOOL
schema and local source files that start with „TKD‟.
Note: We are using Team Coding to control database objects and some source files.
If you are continuing from the previous section, you will already be in this window; start with Step 3.
1. Go to Utilities | Team Coding | Configure Team Coding.
2. Select Use Code Collections and click OK.
3. Click Yes in the prompt that asks if you want to set up code collections.
4. Click Add in the Team Coding Code Collections window.
5. Enter a name for the code collection.
Each Code Collection in Toad maps to a single version-control project.
6. Use the search button to navigate to your VCS Project.
For TFS, the working directory is defined by the logged-on workspace.
7. Select Database Objects, the Schema, and the default „All‟ for the Name Mask.
Click OK, and click Close.


This controls all supported objects in the specified schema.
11

Set up Code Collections to control source files
You can also use Team Coding to control source files. This requires that you are using a version-control
system, and that Code Collections are enabled.

1. On the Team Coding toolbar, click the „Manage Team Coding Code Collections‟ button and
click Add.
You can:
- Create a new collection by entering a unique collection name, or
- Add an item to an existing collection by selecting from the name dropdown.
In this example, we selected the existing TKD_SCHOOL collection.
2. Create or select a collection as described above and click Edit.
3. Select Files to control source files and enter the mask of the file names you wish to control.
This controls all files on your desktop that match the „TKD*.sql‟ mask, in this example.


The selected objects are now controlled by Team Coding for all users who log on to the
ORATFS10 database.
Click OK.

12

Populating the Team Coding tables for the first time - Create a New Revision for Team
Coding Objects
Typically, Objects are added to the Team Coding Viewer and to the source control repository when they
are checked out for the first time.
For example, you can right-click on a procedure in the Schema Browser and check out a procedure that
is in the TDK_SCHOOL schema. The TC_ADMIN can also create a complete revision for controlled
objects. This populates all controlled objects in the Team Coding viewer, and creates a new revision in
the version-control repository for the object source.
Note: In the previous process, we established control of source files. The steps below are for
database objects.
You will see that:
- Create New Revision is not available for the project after selecting Files in Step 3 above.
- If you repeat the above sequence and select Database Objects, then the Create New
Revision button becomes available in Step 2 below.
1. On the Team Coding toolbar, click the „Manage Team Coding Code Collections‟ button .
2. Select the collection item you wish to update and click Create New Revision.
3. Select the objects that you wish to include and click OK.
Export Options are displayed.
13



4. Select Create a new revision for existing objects.
Add a comment and click OK.

A record is added to the Team Coding Tables for each controlled object, and a new revision is
added to the version-control repository for the source for each object.

14

Verify Team Coding Status
You can check the Team Coding Status at any time.
Go to Utilities | Team Coding | Team Coding Status.
This window lets you see the status of the Team Coding install and any session messages.



15

Using Team Coding in Toad
There are a number of ways that you can access Team Coding objects in Toad:
 Schema Browser
 Editor
 Team Coding Viewer
 Team Coding Source Control Browser
Using Team Coding with the Schema Browser
The easiest way to see Team Coding is in the Schema Browser.


1. In the Schema Browser, right click on an object that is controlled by Team Coding.
If it is available to edit, the „Check Out‟ and „Get Latest‟ menu options are visible.
You can also tell if an object is available by the status on the Team Coding Toolbar. In this case
the „Check Out‟ and „Get Latest‟ buttons are enabled.
2. Select Check Out.
The Team Coding object is „Locked‟ in the Team Coding table, and the latest version of the
source code is downloaded to the Team VCS working directory.
You can now edit the object.
3. Double-click the object name (SEND_EMAIL) to open the source in the editor.
Make some modifications.
4. Click the „Compile‟ button to compile and save the object.


16

5. Click the „Check in‟ button from the Team Coding Toolbar, or right-click on the object in the
Schema Browser to check in your changes.
You may need to click the refresh button in the Schema Browser to view your changes in the
Schema Browser window.

Using Team Coding in the Editor
Team Coding can also be used to control source files. The Editor uses the same Team Coding Toolbar
buttons as the Schema Browser. You can easily tell the Team Coding status of objects in the editor by
viewing the status text in the status bar.
The Team Coding statuses are:
 Uncontrolled – Team Coding does not control the object in the Editor.
 Available – The object is controlled by Team Coding and available for check out.
 Checked Out – The object is checked out by the current user, and locked for edit for other users.
 Locked – The object has been checked out by another user and is locked for editing.
 Frozen – The object is „Frozen‟ by Team Coding Admin. All edits are prohibited to all users.
 Disabled - The object is disabled by Team Coding.
This happens when objects are controlled by Team Coding, but Team Coding is disabled. This is
usually due to some kind of setup issues with Team Coding, typically the version-control system
is not installed and configured correctly.
Create a new Team Coding file in the Editor
1. Open the Editor and create a new file.
2. Save the file using the mask that you set up in Code Collections. For example TKD_1.sql.
Team Coding recognizes that the file is controlled.
The file is now marked as „Read Only‟ in the editor.
The „Check out‟ button becomes enabled in the Team Coding toolbar.
The status bar shows the Team Coding status. In this case the status bar shows „Available‟.
3. Check out the current object/file using the „Check out‟ button on the Team Coding toolbar.
If you did not save the file in the Team Foundation Server working directory, you are prompted to
do so.
Click OK.
17

The „Check in‟ button becomes enabled in the Team Coding Toolbar. You can now edit the file to
make changes.

4. Make changes to the file in the Editor and click Save.
5. Click the „Check in‟ button to check in the modified file as a new revision to the version-control
project. You can also view the file entry in the Team Coding Viewer and the Team Coding VCS
Browser.
Team Coding Viewer
The Team Coding Viewer is only available with Team Coding enabled.
The Team Coding Viewer lets you view and work with any objects or files that have been added to the
Team Coding table. Typically, this includes objects that have previously been checked out for edit, or
have been added using „Create new revision‟ from Code Collections.
It is possible that controlled objects are not in this list, if they are controlled by Code Collections, but have
not been added to the Team Coding table yet.
1. From the Toad menu, go to Utilities | Team Coding | Team Coding Viewer.


2. Use the toolbar buttons or right-click a record to take these actions:
These are subject to the status of the object in the datbase and your permissions.
18

 Check out – This locks the object in the Team Coding table and enables you to edit.
A copy of the object source is checked out by TFS and downloaded to the working directory.
The file name is a combination of the schema name, the object name, and the extension for that
type of object. For example in the display the source file would have the name
TKD_SCHOOL.SEND_EMAIL.PRC.
 Check in - The object is unlocked in the Team Coding table and available for other users to edit.
Changes to the object are saved and updated as a revision in the TFS project.
 Undo Check out – Unlocks the object, but does not update any changes.
 Break Team Coding Lock – Unlocks another user‟s lock on an object.
Team Coding Admin only
 Freeze / Unfreeze – Freeze an object for all users, and prevent any changes.
Team Coding Admin only
 Open – Open the object in the default editor
 Delete – Delete the object record from the Team Coding Table.
Note: This does not delete the actual object.
If you have Code Analysis integration you can also perform some Code Analysis functions from this
window. See online help in Toad for more information.
Team Coding Source Control Browser
The Team Coding Source Control Browser is only available with Team Coding. A similar browser,
independent of Team Coding, is available for your version-control projects.
The Team Coding Source Control Browser provides an alternate view of objects controlled in Team
Coding. You can browse version-control projects from within Toad and check in, and check out Objects.
Advantage – The VCS Browser has the advantage of showing all projects and items in the version-
control system server.
Disadvantage – The disadvantage is that many of these items may not be associated with your Team
Coding project.
Objects are displayed as the file name that is used by the version-control system. For example,
SEND_EMAIL is displayed as TKD_SCHOOL.SEND_EMAIL.PRC.
 To open the browser, go to Utilities | Team Coding | Team Coding VCS Browser.


In addition to standard check in and check out functions, the VCS browser shows revision history, which
you can use to view the different revisions of an object and compare contents with the current revision.
19

 Right-click on the revision and click Open or View Differences to compare revisions.

Team Coding also has a „Check in All Team Coding Objects‟ function which is triggered automatically
when you end a session, or can be called from the Team Coding menu or toolbar.