At the moment I have the following table:
    CREATE TABLE memUsageLine(
        className   TEXT NOT NULL,
        pid         INT  NOT NULL,
        timeChecked INT  NOT NULL DEFAULT (strftime('%s')),

        freeAfter   INT NOT NULL,
        freeBefore  INT NOT NULL,
        maxMemory   INT  NOT NULL, -- Is probably not necessary
        totalAfter  INT NOT NULL,
        totalBefore INT NOT NULL,

        PRIMARY KEY (className, PID, timeChecked)
    );

​and I create the following view:
    CREATE VIEW memUsageLineExtended AS
    SELECT   className
    ,        pid
    ,        strftime('%Y-%m-%d %H:%M', timeChecked, 'unixepoch',
'localtime') as timeChecked
    ,        freeAfter
    ,        freeBefore
    ,        maxMemory
    ,        totalAfter
    ,        totalBefore
    ,        totalAfter  -
freeAfter                                           as usedAfter
    ,        totalBefore -
freeBefore                                          as usedBefore
    ,        CAST(totalAfter AS REAL) / (totalAfter  -
freeAfter)              as ratioTotalUsed
    FROM     memUsageLine
    ;

In the past I worked (I think) with a database (not SQLite) where I could
usedAfter in the definition for ratioTotalUsed. It is not a very big
problem, but is something like that possible with SQLite?

-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to