src/snac/server/database/SQL.php
/**
     * Get publish version history info
     *
     * Currently used only the EACCPFSerializer.php for maintenanceEvent data.
     *
     * cpf.rng doesn't like milliseconds so create an ISO date without them. Note I have included the "T"
     * which has issues.
     *
     * https://www.postgresql.org/docs/current/static/datatype-datetime.html
     *
     * Note: ISO 8601 specifies the use of uppercase letter T to separate the date and time. PostgreSQL
     * accepts that format on input, but on output it uses a space rather than T, as shown above[below]. This is for
     * readability and for consistency with RFC 3339 as well as some other database systems.
     *
     * Bad: 2016-07-28 16:30:16.18485 Good: 2016-07-28T16:30:16
     *
     * @param string[] $vhInfo associative list with keys: version, ic_id
     * @param boolean $listAll optional If set to true, will list all the version history.  If not set, will only
     * list publicly available history
     * @return string[] An associative list with keys corresponding to the version_history table columns.
     */
Get publish version history info
Currently used only the EACCPFSerializer.php for maintenanceEvent data.

cpf.rng doesn't like milliseconds so create an ISO date without them. Note I have included the "T"
which has issues.



ISO 8601 specifies the use of uppercase letter T to separate the date and time. PostgreSQL
accepts that format on input, but on output it uses a space rather than T, as shown above[below]. This is for
readability and for consistency with RFC 3339 as well as some other database systems.



@param string[] $vhInfo associative list with keys: version, ic_id
@param boolean $listAll optional If set to true, will list all the version history.  If not set, will only
list publicly available history
@return string[] An associative list with keys corresponding to the version_history table columns.
Get publish version history info Currently used only the EACCPFSerializer . php for maintenanceEvent data . cpf . rng doesn ' t like milliseconds so create an ISO date without them . Note I have included the " T " which has issues . ISO 8601 specifies the use of uppercase letter T to separate the date and time . PostgreSQL accepts that format on input but on output it uses a space rather than T as shown above [ below ] . This is for readability and for consistency with RFC 3339 as well as some other database systems . @param string [] $vhInfo associative list with keys : version ic_id @param boolean $listAll optional If set to true will list all the version history . If not set will only list publicly available history @return string [] An associative list with keys corresponding to the version_history table columns .
public function selectVersionHistory($vhInfo,$listAll = false) {
        $limitHistory = 'and (v.status=\'published\' or v.status=\'ingest cpf\' or v.status=\'deleted\' or v.status=\'tombstone\' or v.status=\'ingest cpf\' or v.status=\'merge split\')';
        if ($listAll === true)
            $limitHistory = "";
        $result = $this->sdb->query(
            'select v.*, to_char(v.timestamp, \'YYYY-MM-DD"T"HH24:MI:SS\') as update_date, a.username, a.fullname
            from version_history v, appuser a
            where v.user_id = a.id and v.id=$1 and v.version<=$2
                '.$limitHistory.'
            order by v.timestamp asc',
            array($vhInfo["ic_id"], $vhInfo["version"]));
        $all = array();
        while ($row = $this->sdb->fetchrow($result))
        {
            array_push($all, $row);
        }
        return $all;
    }
public function selectVersionHistory ( $ vhInfo , $ listAll = false ) { $ limitHistory = 'and (v.status=\'published\' or v.status=\'ingest cpf\' or v.status=\'deleted\' or v.status=\'tombstone\' or v.status=\'ingest cpf\' or v.status=\'merge split\')' ; if ( $ listAll === true ) $ limitHistory = " " ; $ result = $ this -> sdb -> query ( 'select v.*, to_char(v.timestamp, \'YYYY-MM-DD"T"HH24:MI:SS\') as update_date, a.username, a.fullname
            from version_history v, appuser a
            where v.user_id = a.id and v.id=$1 and v.version<=$2
                ' . $ limitHistory . '
            order by v.timestamp asc' , array ( $ vhInfo [ " ic_id " ] , $ vhInfo [ " version " ] ) ) ; $ all = array ( ) ; while ( $ row = $ this -> sdb -> fetchrow ( $ result ) ) { array_push ( $ all , $ row ) ; } return $ all ; }
Get publish version history info
 Currently used only the EACCPFSerializer.php for maintenanceEvent data.
Get publish version history info Currently used only the EACCPFSerializer . php for maintenanceEvent data .