changed: db: table item: url_subject into url
changed: item.url_subject into item.url
changed: a new table: content
with: id, subject, content, content_type
(those from the item table)
it helps to create hard links
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@466 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
46
core/db_itemcolumns.cpp
Executable file
46
core/db_itemcolumns.cpp
Executable file
@@ -0,0 +1,46 @@
|
||||
#include "db.h"
|
||||
|
||||
|
||||
|
||||
void Db::ItemColumns::SetColumns(PGresult * r)
|
||||
{
|
||||
// PQfnumber returns -1 if there is no such a column
|
||||
id = PQfnumber(r, "id"); // !! why item.id doesn't work?
|
||||
user_id = PQfnumber(r, "user_id");
|
||||
group_id = PQfnumber(r, "group_id");
|
||||
privileges = PQfnumber(r, "privileges");
|
||||
url = PQfnumber(r, "url");
|
||||
type = PQfnumber(r, "type");
|
||||
parent_id = PQfnumber(r, "parent_id");
|
||||
content_id = PQfnumber(r, "content_id");
|
||||
default_item = PQfnumber(r, "default_item");
|
||||
subject = PQfnumber(r, "subject");
|
||||
content = PQfnumber(r, "content");
|
||||
content_type = PQfnumber(r, "content_type");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Db::ItemColumns::SetItem(PGresult * r, long row, Item & item)
|
||||
{
|
||||
if( id != -1 ) item.id = atol( Db::AssertValue(r, row, id) );
|
||||
if( user_id != -1 ) item.user_id = atol( Db::AssertValue(r, row, user_id) );
|
||||
if( group_id != -1 ) item.group_id = atol( Db::AssertValue(r, row, group_id) );
|
||||
if( privileges != -1 ) item.privileges = atoi( Db::AssertValue(r, row, privileges) );
|
||||
if( url != -1 ) item.url = Db::AssertValue(r, row, url);
|
||||
if( type != -1 ) item.type = static_cast<Item::Type>( atoi( Db::AssertValue(r, row, type) ) );
|
||||
if( parent_id != -1 ) item.parent_id = atol( Db::AssertValue(r, row, parent_id) );
|
||||
if( content_id != -1 ) item.content_id = atol( Db::AssertValue(r, row, content_id) );
|
||||
if( default_item != -1 ) item.default_item = atol( Db::AssertValue(r, row, default_item) );
|
||||
if( subject != -1 ) item.subject = Db::AssertValue(r, row, subject);
|
||||
if( content != -1 ) item.content = Db::AssertValue(r, row, content);
|
||||
if( content_type != -1 ) item.content_type = atoi( Db::AssertValue(r, row, content_type) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user