Note that there are some explanatory texts on larger screens.

plurals
  1. POReturn enum through a function
    primarykey
    data
    text
    <p>I tried researching this, but could find a solution that fit my situation.</p> <p>So i'm trying to make a basic wrapper for the metadata of a mysql field:</p> <pre><code>#pragma once #include &lt;string&gt; #include &lt;stdint.h&gt; #include &lt;windows.h&gt; #include "mysql.h" namespace escobar { namespace storage { class mysql_field_metadata { private: uint32_t result_index; /* For indexing the field for a mysql record. */ std::string name; /* The name of the column. */ std::string original_name; /* The original name of the column, if the name is an alias. */ std::string table; /* Name of the table */ std::string original_table; /* The original name of the table, if the table name is an alias. */ std::string database; /* The name of the database the table/record belongs to. */ uint32_t length; /* The length of the field. */ uint32_t max_length; /* The maximum length of the set. */ uint32_t decimals; /* Number of decimals used in the field. */ uint32_t charset; /* Table charset. */ enum enum_field_types type; /* The type of MYSQL data. */ public: mysql_field_metadata(MYSQL_FIELD* field_data, uint32_t _result_index) : result_index(_result_index), name(field_data-&gt;name), original_name(field_data-&gt;org_name), table(field_data-&gt;table), original_table(field_data-&gt;org_table), database(field_data-&gt;db), length(field_data-&gt;length), max_length(field_data-&gt;max_length), decimals(field_data-&gt;decimals), charset(field_data-&gt;charsetnr), type(field_data-&gt;type) { } ~mysql_field_metadata(void) { } std::string get_name(void) { return this-&gt;name; } std::string get_original_name(void) { return this-&gt;original_name; } std::string get_table(void) { return this-&gt;original_name; } std::string get_original_table(void) { return this-&gt;original_table; } std::string get_database(void) { return this-&gt;database; } uint32_t get_length(void) { return this-&gt;length; } uint32_t get_max_length(void) { return this-&gt;max_length; } uint32_t get_decimals(void) { return this-&gt;decimals; } uint32_t get_charset(void) { return this-&gt;charset; } enum emum_field_types get_type(void) { return this-&gt;type; } }; }} </code></pre> <p>As you can see, my last function:</p> <p><code>enum emum_field_types get_type(void) { return this-&gt;type; }</code></p> <p>It doesn't seem to be working, I get the following error:</p> <p><code>error C2440: 'return' : cannot convert from 'enum_field_types' to 'escobar::storage::emum_field_types' 1&gt; Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload