WIP: remove the old database abstraction layer

remove such classes:
- DbBase
- DbConn
- DbTextStream
- Db

while here:
- remove: TextStream, SLog, TexTextStream
This commit is contained in:
2024-06-22 18:03:54 +02:00
parent 5d457f3d4b
commit 6aa100f12c
138 changed files with 6658 additions and 12402 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2021, Tomasz Sowa
* Copyright (c) 2008-2024, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,7 @@
#include <errno.h>
#include "mv.h"
#include "core/misc.h"
#include "functions.h"
@@ -155,7 +156,7 @@ bool Mv::ParseDirCheckLastName()
if( out_has_file )
{
log << log1 << "Mv: incorrent path" << logend;
slog << logerror << T("mv_incorrect_path") << logend;
//slog << logerror << T("mv_incorrect_path") << logend;
return false;
}
else
@@ -212,7 +213,7 @@ bool Mv::ParseDir(const std::wstring & dst_path, bool check_access)
if( res != 0 && res != 1 )
{
slog << logerror << T("mv_incorrect_dst_path") << logend;
//slog << logerror << T("mv_incorrect_dst_path") << logend;
return false;
}
@@ -232,7 +233,7 @@ bool Mv::CanRemoveRenameChild(const Item & child)
if( !parent_dir || !system->CanRemoveRenameChild(*parent_dir, child.item_content.user_id) )
{
log << log1 << "Mv: permission denied to: " << child.url << logend;
slog << logerror << T("mv_permission_denied_to") << ": " << child.url << logend;
//slog << logerror << T("mv_permission_denied_to") << ": " << child.url << logend;
return false;
}
@@ -256,7 +257,7 @@ bool Mv::MoveStaticFile(const std::wstring & from, const std::wstring & to)
else
{
log << log1 << "Mv: cannot move a static file from: " << from << ", to: " << to << logend;
slog << logerror << T("internal_error") << logend;
//slog << logerror << T("internal_error") << logend;
return false;
}
}
@@ -277,7 +278,7 @@ bool ok = true;
if( !ok )
{
log << log1 << "Mv: cannot create a static path" << logend;
slog << logerror << T("internal_error") << logend;
//slog << logerror << T("internal_error") << logend;
return;
}
@@ -289,7 +290,7 @@ bool ok = true;
if( !item.item_content.update() )
{
log << log1 << "Mv: cannot move static file (database problem)" << logend;
slog << logerror << T("internal_error") << logend;
//slog << logerror << T("internal_error") << logend;
return;
}
@@ -384,7 +385,7 @@ bool Mv::MoveDir(Item & src_dir, std::vector<Item*> & dst_dir_tab, const std::ws
if( dst_dir_id == src_dir.id || system->dirs.HasParent(dst_dir_id, src_dir.id) )
{
log << log1 << "Mv: cannot move directory to inside it" << logend;
slog << logerror << T("mv_cannot_move_to_inside");
//slog << logerror << T("mv_cannot_move_to_inside");
return false;
}
@@ -439,7 +440,7 @@ bool Mv::MoveDir2(Item & src_dir, long dst_dir_id, const std::wstring & new_url,
if( src_dir.parent_id == -1 )
{
log << log1 << "Mv: the root directory cannot be moved anywhere" << logend;
slog << logerror << T("mv_cant_move_root_dir") << logend;
//slog << logerror << T("mv_cant_move_root_dir") << logend;
return false;
}
@@ -455,7 +456,7 @@ bool Mv::MoveDir2(Item & src_dir, long dst_dir_id, const std::wstring & new_url,
if( !system->dirs.CreateDirTab(dst_dir_id, out_dir_tab) )
{
log << log1 << "Mv: incorrect directory" << logend;
slog << logerror << T("mv_incorrect_dir") << logend;
//slog << logerror << T("mv_incorrect_dir") << logend;
return false;
}
@@ -486,7 +487,7 @@ bool Mv::MoveDir2(Item & src_dir, const std::wstring & dst_path, bool check_acce
if( src_dir.parent_id == -1 )
{
log << log1 << "Mv: the root directory cannot be moved anywhere" << logend;
slog << logerror << T("mv_cant_move_root_dir") << logend;
//slog << logerror << T("mv_cant_move_root_dir") << logend;
return false;
}
@@ -499,7 +500,7 @@ bool Mv::MoveDir2(Item & src_dir, const std::wstring & dst_path, bool check_acce
if( out_has_file )
{
log << log1 << "Mv: directory can be moved only to a directory" << logend;
slog << logerror << T("mv_dir_can_be_moved_to_dir") << logend;
//slog << logerror << T("mv_dir_can_be_moved_to_dir") << logend;
return false;
}
@@ -623,7 +624,7 @@ bool Mv::MoveFileOrSymlink2(Item & src_file, const std::wstring & dst_path, bool
if( out_has_file )
{
log << log3 << "Mv: such file already exists (skipping)" << logend;
slog << logerror << T("mv_file_exists") << logend;
//slog << logerror << T("mv_file_exists") << logend;
return false;
}
@@ -653,7 +654,7 @@ void Mv::MoveAllFilesFromDir(Item & src_dir, std::vector<Item*> & dst_dir_tab, b
if( check_access && !system->CanRemoveRenameChild(src_dir, item_tab[i].item_content.user_id) )
{
log << log1 << "Mv: permission denied to: " << src_dir.url << logend;
slog << logerror << T("mv_permission_denied_to") << ": " << src_dir.url << logend;
//slog << logerror << T("mv_permission_denied_to") << ": " << src_dir.url << logend;
}
else
{
@@ -688,14 +689,14 @@ void Mv::MoveDirContent2(Item & src_dir, long dst_dir_id, bool check_access)
if( src_dir.parent_id == -1 )
{
log << log1 << "Mv: the root directory cannot be moved anywhere" << logend;
slog << logerror << T("mv_cant_move_root_dir") << logend;
//slog << logerror << T("mv_cant_move_root_dir") << logend;
return;
}
if( !system->dirs.CreateDirTab(dst_dir_id, out_dir_tab) )
{
log << log1 << "Mv: incorrect directory" << logend;
slog << logerror << T("mv_incorrect_dir") << logend;
//slog << logerror << T("mv_incorrect_dir") << logend;
return;
}
@@ -721,7 +722,7 @@ void Mv::MoveDirContent2(Item & src_dir, const std::wstring & dst_dir, bool chec
if( out_has_file || !out_filename.empty() )
{
log << log1 << "Mv: directory content can be moved only to a directory" << logend;
slog << logerror << T("mv_dir_content_can_be_moved_to_dir") << logend;
//slog << logerror << T("mv_dir_content_can_be_moved_to_dir") << logend;
return;
}