MySQL++

Changes On Branch tolower-speedup
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch tolower-speedup Excluding Merge-Ins

This is equivalent to a diff from 143985738d to 81b6c9452e

2018-05-02
14:34
Removed "register" qualifiers from all variable declarations. It's deprecated in C++11 and C++14 and is now illegal in C++17. Closes [648dafd5ed]. check-in: 78fc2ae13b user: tangent tags: trunk
2017-11-23
01:07
On the mailing list, Dan Grubbs proposed replacing the use of mysqlpp::internal::str_to_lwr() with a tolower() based loop. He says it improves profiling results, but his formulation doesn't do the same thing as the original code, nor in fact apparently anything useful, thus this testing branch. Closed on 2018-07-12 due to lack of input from original poster. Closed-Leaf check-in: 81b6c9452e user: tangent tags: tolower-speedup
01:06
Added some SSQLSv2 testing files present in previous svn repo but not in tarballs, thus not restored in Fossil conversion, which prevented dtest from running to completion. Since SSQLSv2 has never been completed, this is purely annoying rather than actually important. check-in: 143985738d user: tangent tags: trunk
00:51
Removed the redundant library removal bit on config/mysql_loc.m4. If triggered, it causes bare -L flags to be put into Makefile.in, which isn't likely to work out well. I don't recall this being *required* anywhere; it looks like overzealous cleanup. check-in: a8184428f3 user: tangent tags: trunk

Changes to lib/field_names.cpp.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57


58
59
60
61
62
63
64
65
66
67
#include "field_names.h"
#include "result.h"

#include <algorithm>

namespace mysqlpp {

namespace internal { extern void str_to_lwr(std::string& s); }

void
FieldNames::init(const ResultBase* res)
{
	size_t num = res->num_fields();
	reserve(num);

	for (size_t i = 0; i < num; i++) {
		push_back(res->fields().at(i).name());
	}
}


unsigned int
FieldNames::operator [](const std::string& s) const
{
	std::string temp1(s);
	internal::str_to_lwr(temp1);
	for (const_iterator it = begin(); it != end(); ++it) {
	std::string temp2(*it);


		internal::str_to_lwr(temp2);
		if (temp2.compare(temp1) == 0) {
			return it - begin();
		}
	}

	return end() - begin();
}

} // end namespace mysqlpp







<
<















<
<
|
|
>
>
|
|
|
|
|

|



30
31
32
33
34
35
36


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51


52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "field_names.h"
#include "result.h"

#include <algorithm>

namespace mysqlpp {



void
FieldNames::init(const ResultBase* res)
{
	size_t num = res->num_fields();
	reserve(num);

	for (size_t i = 0; i < num; i++) {
		push_back(res->fields().at(i).name());
	}
}


unsigned int
FieldNames::operator [](const std::string& s) const
{


    for (const_iterator it = begin(); it != end(); ++it) {
        std::string temp(*it);
        const std::string::size_type len = s.length();
        if (len == temp.length()) {
            std::string::size_type i = 0;
            while ((i < len) && (tolower(s[i]) == tolower(temp[i]))) ++i;
            if (i == len) return it - begin();
        }
    }

    return end() - begin();    
}

} // end namespace mysqlpp