"""Get and return a tuple of tuples containing the doctype, the action, and the
page number (pagenb) for the instances of use of the element identified by "elname".
I.e. get the information about which submission pages the element is used on.
@param elname: The unique identifier for an element ("name" in "sbmFIELDDESC",
"fidesc" in "sbmFIELD").
@return: tuple of tuples (doctype, action, pagenb)
"""
q="""SELECT subm.docname, subm.actname, sf.pagenb FROM sbmIMPLEMENT AS subm LEFT JOIN sbmFIELD AS sf ON sf.subname=CONCAT(subm.actname, subm.docname) WHERE sf.fidesc=%s ORDER BY sf.subname ASC, sf.pagenb ASC"""
returnrun_sql(q,(elname,))
defget_subname_pagenb_element_use(elname):
"""Get and return a tuple of tuples containing the "submission name" (subname) and the
page number (pagenb) for the instances of use of the element identified by "elname".
I.e. get the information about which submission pages the element is used on.
@param elname: The unique identifier for an element ("name" in "sbmFIELDDESC",
"fidesc" in "sbmFIELD").
@return: tuple of tuples (subname, pagenb)
"""
q="""SELECT sf.subname, sf.pagenb FROM sbmFIELD AS sf WHERE sf.fidesc=%s ORDER BY sf.subname ASC, sf.pagenb ASC"""
returnrun_sql(q,(elname,))
defget_elename_allelements():
"""Get and return a tuple of tuples containing the "element name" (name) for each WebSubmit
element in the WebSubmit database.
@return: tuple of tuples: (name)
"""
q="""SELECT name FROM sbmFIELDDESC ORDER BY name"""
returnrun_sql(q)
defget_all_element_names():
"""Return a list of the names of all "elements" in the WebSubmit DB.
@return: a list of strings, where each string is a WebSubmit element
"""
q="""SELECT DISTINCT(name) FROM sbmFIELDDESC ORDER BY name"""
res=run_sql(q)
returnmap(lambdax:str(x[0]),res)
defget_element_details(elname):
"""Get and return a tuple of tuples for all ELEMENTS with the element name "elname".
@param elname: ELEMENT name (elname).
@return: tuple of tuples (one tuple per check row): (marccode,type,size,rows,cols,maxlength,