Home » U++ Library support » U++ SQL » Prefix to prevent name clash in SQL: SqlId, variables, tables, ...
Re: Prefix to prevent name clash in SQL: SqlId, variables, tables, ... [message #28361 is a reply to message #17171] |
Mon, 30 August 2010 15:45 |
sevenjay
Messages: 30 Registered: October 2008 Location: Taiwan
|
Member |
|
|
I have another opinion on this.
When you create tables/columns with lower-case names, set SqlID like
It will not match the table/column name "Title" because it will be "TITLE" in cn->info[i].name.
That is not convenient to force user to set SqlID all upper case.
I think it could be case insensitive equality comparison.
if(cn->info[i].name == s)
could be
if( 0 == s.CompareInsensitive(~(cn->info[i].name)))
The method CompareInsensitive maybe like this
template <class B>
int AString<B>::CompareInsensitive(const tchar *b) const
{
const tchar *a = B::Begin();
const tchar *ae = End();
for(;;) {
if(a >= ae)
return *b == 0 ? 0 : -1;
if(*b == 0)
return 1;
int q = cmpval__(*a) - cmpval__(*b);
if( (cmpval__('a') < cmpval__(*a) && cmpval__(*a) < cmpval__('z')) ||
(cmpval__('A') < cmpval__(*a) && cmpval__(*a) < cmpval__('Z')) )
if(q == cmpval__('a') - cmpval__('A') || q == cmpval__('A') - cmpval__('a'))
q = 0;
if(q)
return q;
*a++;
*b++;
}
}
I tried it's OK.
But I am not sure if it is faster than ToUpper.
|
|
|
|
|
Prefix to prevent name clash in SQL: SqlId, variables, tables, ...
By: mingodad on Sun, 17 February 2008 13:40
|
|
|
Re: Prefix to prevent name clash in SQL: SqlId, variables, tables, ...
By: mirek on Tue, 19 February 2008 23:42
|
|
|
Re: Prefix to prevent name clash in SQL: SqlId, variables, tables, ...
|
|
|
Re: Prefix to prevent name clash in SQL: SqlId, variables, tables, ...
By: mirek on Fri, 01 August 2008 10:07
|
|
|
Re: Prefix to prevent name clash in SQL: SqlId, variables, tables, ...
By: sevenjay on Mon, 30 August 2010 15:45
|
Goto Forum:
Current Time: Mon May 13 15:38:11 CEST 2024
Total time taken to generate the page: 0.02556 seconds
|