Found the reason for sqlite_table_exists always returning false. It's weird, but in such function declaration, I get in table_name variable the same pointer as db_filename. If function's arguments declared as "const wchar_t const*" OR I declare them in mqh as a reference - everything works as it should.