mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Sql: SqlId::ToLowerCase, ToUpperCase
git-svn-id: svn://ultimatepp.org/upp/trunk@7251 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
17b84ec741
commit
c64db5b4b1
2 changed files with 24 additions and 2 deletions
|
|
@ -21,15 +21,29 @@ T ReadSqlValue(T& x, const char *&s) {
|
|||
}
|
||||
|
||||
static bool sSqlIdQuoted;
|
||||
static bool sToUpperCase;
|
||||
static bool sToLowerCase;
|
||||
|
||||
void SqlId::UseQuotes(bool b)
|
||||
{
|
||||
sSqlIdQuoted = b;
|
||||
}
|
||||
|
||||
void SqlId::ToLowerCase(bool b)
|
||||
{
|
||||
sToUpperCase = sToUpperCase && !b;
|
||||
sToLowerCase = b;
|
||||
}
|
||||
|
||||
void SqlId::ToUpperCase(bool b)
|
||||
{
|
||||
sToLowerCase = sToLowerCase && !b;
|
||||
sToUpperCase = b;
|
||||
}
|
||||
|
||||
String SqlId::Quoted() const
|
||||
{
|
||||
if(sSqlIdQuoted && !id.IsNull())
|
||||
if(!id.IsNull())
|
||||
return String().Cat() << '\t' << id << '\t';
|
||||
return id.ToString();
|
||||
}
|
||||
|
|
@ -66,7 +80,13 @@ void SqlCompile(const char *&s, StringBuffer *r, byte dialect)
|
|||
if(r) {
|
||||
if(do_quote)
|
||||
*r << quote;
|
||||
r->Cat(b, s);
|
||||
if(sToUpperCase)
|
||||
r->Cat(ToUpper(String(b, s)));
|
||||
else
|
||||
if(sToLowerCase)
|
||||
r->Cat(ToLower(String(b, s)));
|
||||
else
|
||||
r->Cat(b, s);
|
||||
if(do_quote)
|
||||
*r << quote;
|
||||
if(c == SQLC_AS) {
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ private:
|
|||
|
||||
public:
|
||||
static void UseQuotes(bool b = true);
|
||||
static void ToLowerCase(bool b = true);
|
||||
static void ToUpperCase(bool b = true);
|
||||
|
||||
bool IsEqual(const SqlId& b) const { return id == b.id; }
|
||||
bool IsEqual(const Id& b) const { return id == b; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue