NAME

WeBWorK::DB::Schema::WW1Hash - support access to the set_user and problem_user tables with a WWDBv1 hash-style backend.

TABLE ACCESS METHODS

See descriptions in the WeBWorK::DB::Schema manpage.

count(@keyparts)
list(@keyparts)
exists(@keyparts)
add($Record)
get(@keyparts)
gets(@keypartsRefs)
put($Record)
delete(@keyparts)

PRIVATE TABLE ACCESS METHODS

These are helper methods used by the TABLE ACCESS METHODS.

get1(@keyparts)

Retrieves one set or problem from the database, packages it into a record object, and removes values that match global defaults. Assumes that the driver is already connected to the database. Used by gets().

getsNoFilter(@keypartsRefs)

Similar to gets(), but does not remove values that match global defaults.

get1NoFilter(@keyparts)

Similar to get1(), but does not remove values that match global defaults. Used by get1() and getsNoFilter() and several methods in GlobalTableEmulator.

getAll($userID, $setID)

Returns all problems in a given set. Only supported for the problem_user table.

getAllNoFilter($userID, $setID)

Similar to getAll(), but does not remove values that match global defaults. Used by getAll() and the getAll() method in GlobalTableEmulator.

delete1($PSVN, $problemID)

for the set_user table, ignore $problemID and deletes the set with the matching $PSVN. for the problem_user table, deletes the problem matching $problemID from the set matching $PSVN, or all problems if $problemID is not defined. Assumes that the driver is already connected to the database. Used by delete().

UTILITIES

copyOverrides($GlobalRecord, $UserRecord)

Copies global values from $GlobalRecord into the correponding fields in $UserRecord.

reindex()

Destroy and rebuild the internal set-PSVN and user-PSVN indices to eliminate any inconsistancies.

                # mark down that we've seen these IDs in a "real" PSVN record
                $userIDsMentioned{$userID} = 1;
                $setIDsMentioned{$setID} = 1;

STRING CONVERSION METHODS

These methods use string2hash() and the TABLE MULTIPLEXING METHODS to convert between strings and IDs/records.

($userID, $setID, @problemIDs) = string2IDs($string)
$Set = string2set($string)
$Problem = string2problem($string, $problemID)
@Problems = string2problems($string)
($Set, @Problems) = string2records($string)
records2string($Set, @Problems)

TABLE MULTIPLEXING METHODS

Both the set_user and problem_user tables are stored in one hash, keyed by PSVN. These methods split a hash value into multiple records, and combine multiple records into a single hash value.

($userID, $setID, @problemIDs) = hash2IDs(%hash)
$Set = hash2set(%hash)
$Problem = hash2problem($problemID, %hash)
%hash = set2hash($Set)
%hash = problem2hash($Problem)

ID-KEYED PSVN ACCESS/MODIFICATION METHODS

# the PSVN pseudo-table and the set and user indexes are not visible to the # API, but we need to be able to update them to remain compatible with WWDBv1.

$PSVN = getPSVN($userID, $setID)

Retrieves an existing PSVN from the PSVN indices given a user ID and set ID. If no PSVN for that user/set pair exists, an undefined value is returned.

$PSVN = setPSVN($userID, $setID)

Retrieves an existing PSVN from the PSVN indices given a user ID and set ID. If no PSVN for that user/set pair exists, a new one is generated, added to the indices, and returned.

deletePSVN($userID, $setID)

Remove an existing PSVN from the PSVN indexes, given the user ID and set ID for that PSVN.

PSVN LISTING METHODS

@PSVNs = getAllPSVNs()

Retrieves a list of all existing PSVNs.

@PSVNs = getPSVNsForUser($userID)

Retrieves a list of PSVNs for a user from the user PSVN index.

@PSVNs = getPSVNsForSet($setID)

Retrieves a list of PSVNs for a set from the set PSVN index.

PSVN INDEX ACCESS/MODIFICATION METHODS

These methods store and fetch PSVN indexes as hashes. The $prefix argument is the prefix on the hash keys that make up the index, which are set as constants in this module (i.e. LOGIN_PREFIX or SET_PREFIX).

@ids = listPSVNIndices($prefix)

list IDs for which PSVN indices exist given a prefix.

%PSVNIndex = fetchPSVNIndex($prefix, $id)

Return the PSVN index identified by the given prefix and ID as a hash.

storePSVNIndex($prefix, $id, %PSVNIndex)

Store the data in %PSVNIndex in the PSVN index identified by the given prefix and ID.

deletePSVNIndex($prefix, $id)

Delete the PSVN index identified by the given prefix and ID.

HASH STRING ACCESS/MODIFICATION METHODS

$string = fetchString($PSVN)
storeString($PSVN, $string)
deleteString($PSVN)