What do the psc fields do?

From LinuxMCE
Revision as of 16:31, 24 February 2008 by Rwilson131 (Talk | contribs)

Jump to: navigation, search

When you add a table to a repository sqlCVS adds 5 fields to the end of the table, which is how the client side keeps track of changes. Normally you don't need to worry about the fields--they all have default values that accomplish their purpose, which is:

psc_id: Every record needs a globally unique id which never changes. This cannot be the primary key since the primary key can be changed, and then there is no way to know if this is a new record or what the original value was. So the psc_id has a default value of NULL. When the client side does a checkin, all rows where psc_id is null must be new rows because during the checkin process they will be given permanent id's by the server.

psc_batch: Every time you check-in or commit your local working copy, all the changes you made are put into a "batch", which is like a revision. This field contains the last batch, or revision, which modified this row.

psc_user: Every user is given a unique ID. The sqlCVS program has a ValidateUser module that can be replaced by a developer to accomodate any type of back-end user authentication, such as LDAP, active directory, or some other database. This module also handles validating users' passwords, determining who is a supervisor, and mapping the psc_user to a real user account.

psc_frozen: If you set this field to 't' that means the record is frozen. sqlCVS can't stop the local client from making changes to the record in his local copy, but it does prevent him from checking those changes in to the master database. When he attempts to checkin changes to a frozen record or table, those changes will be stored in a special "unauthorized batch", recognizeable because the batch number is negative. At checkin time he will be given the unauthorized batch number, which he can give to a supervisor. If a supervisor decides he wants the changes merged in anyway he can use the "Approve Batch" command to apply them.

psc_mod: This is a timestamp field. Everytime a record is changed MySql will automatically set the timestamp field to the current date/time. During the checkin process psc_mod will be set to 0 as the row's changes are sent to the server. So any rows where psc_mod is not 0 have been modified and those changes need to be checked in.