<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html><head> <title>File: P4table.rb</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel=StyleSheet href=".././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript" language="JavaScript"> <!-- function popCode(url) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } //--> </script> </head> <body bgcolor="white"> <table summary="Information on file" width="100%"> <tr class="title-row"> <td><table summary="layout" width="100%"><tr> <td class="big-title-font" colspan="2">P4table.rb</td> <td align="right"><table summary="layout" cellspacing="0" cellpadding="2"> <tr> <td class="small-title-font">Path:</td> <td class="small-title-font">P4table.rb</td> </tr> <tr> <td class="small-title-font">Modified:</td> <td class="small-title-font">Tue Nov 26 11:25:34 GMT 2002</td> </tr> </table> </td></tr></table></td> </tr> </table> <!-- banner header --> <div class="description"><h1>Introduction</h1> <p> Classes implementing a generic database model on top of plain text files stored in Perforce. </p> <p> Every record consists of fields/values and may have associated files. The data for each record is stored as both a job and a text file. The text file is always called <id>/record and any associated files are also stored alongside the record file. i.e. <id>/file1 <id>/file2. </p> <p> Each table name is a folder name and all records for that table are stored in text files under that folder. i.e. <table>/<id>/record </p> <p> All column names must also be fields in the jobspec so you can search for records using "p4 jobs -e". </p> <table> <tr><td valign="top"><b>NOTE</b>:</td><td>When creating your jobspec, make sure that <b>ALL</b> field names are in lowercase. Ruby likes method names to be lowercase and it fits better as well as reducing scope for errors. </td></tr> </table> <p> The job version of any record contains only the latest version of that record for searching purposes. </p> <table> <tr><td valign="top"><b>WARNING</b>:</td><td>This software is designed to have its OWN Perforce server to work with. <b>DO NOT USE IT AGAINST AN EXISTING PERFORCE SERVER.</b> </td></tr> </table> <p> For a quick start, take a look at the <a href="../classes/P4Table.html">P4Table</a> class as all your tables should be derived from it and the Jobspec rules below. </p> <h1>Jobspec Rules</h1> <p> When creating your jobspec observe the following rules for any chance of success. </p> <ul> <li>All fieldnames <b>must</b> be lowercase </li> <li>The jobspec must contain a field called "job" </li> <li>The jobspec <b>must</b> contain a field called "files" of type "text" </li> <li>Make most fields optional - especially if you have more than one table </li> <li>Do not use invalid preset values in your jobspec. i.e. a field which may only contain certain values but is deliberately initialised to an invalid value to force users to change it. P4/Ruby can't handle jobspecs like this at the moment. </li> </ul> <h1>Jobspec Example</h1> <p> Below is the jobspec used for a FAX tracking application based on P4Ruby which should give you some idea of the possibilities. </p> <pre> # A Perforce Job Spec Specification. # # Updating this form can be dangerous! # See 'p4 help jobspec' for proper directions. Fields: 101 job word 32 required 102 status select 10 required 103 owner word 32 required 104 modified_date date 20 always 105 note text 0 optional 106 sender line 32 optional 107 fax_number line 32 optional 108 files text 80 optional 109 date_received date 20 once 110 date_closed date 20 optional </pre> <pre> Values: status open/closed Presets: status open owner $user modified_date $now date_received $now </pre> <pre> Comments: </pre> </div> <table summary="Requires" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Required files</td></tr> </table> <div class="name-list"> P4 </div> <table summary="List of classes" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Classes and Modules</td></tr> </table> <div class="classlist"> Class <a href="../classes/P4Global.html" class="link">P4Global</a><br /> Class <a href="../classes/P4RecFile.html" class="link">P4RecFile</a><br /> Class <a href="../classes/P4RecId.html" class="link">P4RecId</a><br /> Class <a href="../classes/P4Record.html" class="link">P4Record</a><br /> Class <a href="../classes/P4Table.html" class="link">P4Table</a><br /> </div> </body>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 4677 | Tony Smith |
Move P4table.rb to the P4Ruby library and rename it to p4table.rb instead. There's an update coming so this is just the move. |
||
#1 | 3093 | Tony Smith |
Move docs for P4Table in preparation for upcoming docs for specsaver.rb |
||
//guest/tony_smith/perforce/utils/doc/files/P4table_rb.html | |||||
#1 | 2396 | Tony Smith |
Add RDoc documentation for P4Table.rb. Very pretty. |