Update: update
Use update to update all items that satisfy the where clause. The syntax of the where clause is identical for select, update and delete, and is fully described in the select command section. Values that contain spaces should be enclosed in double quotes. This command has been modeled on the standard SQL update syntax.
Note: Only user modifiable properties can be specified for a value update. Run the describe type command to identify the set of user modifiable properties.
Syntax
The syntax for this command is:
stcmd{Ex} update type [{set propertyName = value, propertyName = value, where {{ attached-label = 'labelName' } | { query = 'myquery' } | propertyName relation value and/or propertyName relation value and/or...} {{for} {folder = 'myfolder' {recurse} or folder = 'myfolderhierarchy' {recurse} or folder = . {recurse} or ...}} | { ( propertyName1, propertyName2, . . . propertyNamen ) } from fileName { join propertyName }] {output* | {propertyName,...} | filter='myFilter' into "outputFilePath" { separator ‘fieldSeparator’} {-pattern "pattern"}} [–epwdfile “passwordfilepat”] [-p "userName:password@hostName:endpoint/projectName/[viewName/] [folderHierarchy/]"]
Relation in {=, <, <=, >, >=, <>, !=}.
As an alternative to the set … where … syntax, you can use the (propertyName 1..n ) from filename { join propertyName } syntax. This is useful for updating types with values from a comma separated file on disk (see the Examples below).
A special null value is recognized as an allowed value of an Enumerated Property. This permits the syntax:
update ChangeRequest set status = null where status = New -p "user:pwd@host:port/project/view"
(In this example, an assigned status is unassigned).
update ChangeRequest set status = New where status = null -p "user:pwd@host:port/project/view"
(In this example, an unassigned status is re-assigned).
Parameters
For information about the command parameters, refer to Operation Parameters.
In addition:
Property Values
The following are the property values for the command:
Property Type | Value | ||||||
---|---|---|---|---|---|---|---|
Text | Literal string. | ||||||
Integer | A string in the form of an integer like "1234". | ||||||
Double | A string in the form of a double like "1234.5678". | ||||||
Long | A string in the form of a long like "1234567890". | ||||||
Boolean | The string "true" or "false" - case insensitive. | ||||||
Date | String format yyyy-mm-dd, 4 digit year, 1 <= mm <= 12, 1 <= dd <= 31. | ||||||
DateTime | If -pattern "pattern" is specified, then it is parsed using java.text.SimpleDateFormat, localized pattern set to "pattern". See http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html. If -pattern is not specified, attempt to match patterns using java.text.DateFormat {SHORT, MEDIUM, LONG, FULL} in that order. See http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html. If all else fails, try ISO8601 parsing e.g.: yyyy-mm-ddThh:mm:ssZ (ignore fractional content after seconds). | ||||||
TimeSpan | String format [ws][-][d. |d]hh:mm:ss[.ff][ws], items in brackets optional. See com.starteam.util.TimeSpan. ws whitespace, d days, ff fractional second, hh hours, mm minutes 0 <= mm <= 59, ss seconds 0 <= ss <= 59. | ||||||
Enumerated | String. Enumerated value specified may be internal name, display name, or string representation of integer enumeration code. If the Enumerated property is multi-selectable, two or more enums may be specified as values. In this case, they must be separated by a period. For example: 101.102.103. Here are some examples: stcmd insert into story (name, tag) values ("This is a story name", 101.103) stcmd update story set tag = 102.103 where viewmemberid = 1234 | ||||||
Object |
| ||||||
LinkValue
| A string in the form of an integer like "1234" which represents the viewmemberid of the source or target link of a trace. |
Note: The update command can be used to assign a new revision comment to the tip revision of a selected set of items of a given type using the special property keyword revisionComment. revisionComment should not be used in conjunction with any other property updates. For example:
stcmd update changeRequest set revisionComment = "Now is the time for all good men" where query = "Status = Open" -p …
Simple Example
The following example sets the synopsis to the value foo for all change requests with an Open status.
stcmd connect localhost:49201 // OR stcmd connect localhost:49201 // attempts an autologon via the toolbar & cached credentials stcmd set project = ‘StarDraw’ view = ‘StarDraw’ stcmd update changerequest set synopsis = "foo" where query = "Status = Open" disconnect
Example Using a Text File for Changes
The following example will update the set of all change requests in the file crsForUpdate.txt, properties as specified in the comma separated list, values in the file spread across several lines, 1 per change request, order of the values matching the order of the properties in the command syntax.
stcmd update ChangeRequest (ChangeNumber, Synopsis, usr_SomeText, Component) from c:\\somepath\\crsForUpdate.txt separator , -p “Administrator:Administrator@localhost:49201/TestUpdate”
If the property names are not specified in the command syntax, they must be specified as the first line of the file. The default separator for the command line is the | symbol. Command authors can override the separator by providing a different separator in the syntax, e.g. separator , meaning, the file uses comma as the property value separator.
One and only one column in the file must be the column used to match each row to an item in StarTeam. This match will be made on the primary descriptor (e.g. CR Number) or the viewmemberID (the default), provided they are also specified in the file.
If neither property is found, then the command author must specify the join propertyName in the syntax. In this case, the join property column is expected to be in the file.
The file content (property values) must match the order of the properties specified in the update syntax, and separated by a ,. Each change request must be on a separate line.
The property ChangeNumber is the key that matches the data in the file to change requests in the server. It can behave as a key because it is a read-only property, and it is also the primary descriptor for the change request type. You could equally well have used ViewMemberID as the key, specified that instead of ChangeNumber, and provided view member id's in the file.
Properties Synopsis and Component are user modifiable text properties.
Property usr_SomeText is a custom property added to the type by the customer (that's why its name starts with usr_).
By definition, all custom properties on a type are user modifiable.
Type and property names are case insensitive and all command line syntax is expected to be in lower case however, project, view, folder, file names may or may not be case sensitive, depending upon the platform.
Matching the example above, the file crsForUpdate.txt would have the format:
1234,"this is a 1234 foo","special text for the custom property usr_SomeText","software component" 5678,"this is a 5678 bar","other text, that is relevant, to a bar","hardware component"
From the example, 1234 & 5678 are change numbers for which change requests must already exist in the server, in the selected project and view.
If you specified a different separator (for example: |), then the data in the file would be separated by |.
1234|"this is a 1234 foo"|"special text for the custom property usr_SomeText"|"software component"
You may specify any consecutive data values in the file, provided that the order and type of the data values match the order and type of the property names specified in the command, and that these properties are user modifiable.