#include "property.hpp" #include #include #include #include IkarusProperty::IkarusProperty(IkarusProject * project, IkarusId id, Data data): IkarusObject{project, id}, _data{data} {} cppbase::Result IkarusProperty::get_property_type( IkarusProject * project, IkarusId id ) { LOG_DEBUG("fetching unboxed property type"); LOG_VERBOSE("project={};property={}", project->get_path().c_str(), id); VTRY(auto const type, project->get_db()->query_one("SELECT `type` FROM `objects` WHERE `id` = ?", id)); return cppbase::ok(static_cast(type)); } IKA_API void ikarus_property_delete(IkarusProperty * property) { LOG_INFO("deleting property"); LOG_VERBOSE("project={};property={}", property->get_project()->get_path().c_str(), property->get_id()); auto * ctx = property->get_project()->get_function_context(); TRYRV( , property->get_project() ->get_db() ->execute("DELETE FROM `objects` WHERE `id` = ?", property->get_id()) .on_error([ctx](auto const& err) { ctx->set_error( fmt::format("failed to delete property from objects table: {}", err), true, IkarusErrorInfo_Source_SubSystem, IkarusErrorInfo_Type_SubSystem_Database ); }) ); LOG_VERBOSE("property was successfully deleted from database, freeing"); property->get_project()->uncache_property(property); LOG_VERBOSE("successfully deleted property"); } IkarusPropertyType ikarus_property_get_type(IkarusProperty const * property) { LOG_DEBUG("fetching property type"); }