本文整理汇总了C++中TStr::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ TStr::Length方法的具体用法?C++ TStr::Length怎么用?C++ TStr::Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStr
的用法示例。
在下文中一共展示了TStr::Length方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CookieExpand
TStr CookieExpand(TStr &Cookie, const TStr &Name)
{
TStr c = Cookie.CopyAfter(Name + "=");
c = c.CopyBefore(";").CopyBefore(",");
if( c.Length() != 32 ) {
c = Cookie.CopyAfter(Name + "=").CopyAfter(Name + "=");
c = c.CopyBefore(";").CopyBefore(",");
}
if( c.Length() != 32 ) {
c = Cookie.CopyAfter(Name + "=").CopyAfter(Name + "=").CopyAfter(Name + "=");
c = c.CopyBefore(";").CopyBefore(",");
}
if( c.Length() != 32 )
c.Clear();
return c;
}
示例2: ClearValue
void TDatabaseSession::ClearValue(const TStr &Cookie, const TStr &Name)
{
if( Cookie.Length() > 0 ) {
query->execSql("DELETE FROM tbs_session WHERE FCookie='"+Cookie+"' and FName='"+Name+"'");
query->execSql("DELETE FROM tbs_session_blob WHERE FCookie='"+Cookie+"' and FName='"+Name+"'");
}
}
示例3: SaveValue
void TDatabaseSession::SaveValue(
const TStr &Cookie,
const TStr &Name,
const char *Value,
const int Size)
{
/*
NULL ASCII 0. represent this by `\0'
\ ASCII 92, Represent this by `\\'
' ASCII 39, Represent this by `\''
" ASCII 34, Represent this by `\"'
*/
if( Cookie.Length() > 0 ) {
query->openSql("SELECT ID FROM tbs_session_blob WHERE FName='"+Name+"' and FCookie='"+Cookie+"' and to_days(fDate) > to_days(now())-"+DaySave);
char * s = new char[Size+Size];
mysql_escape_string(s,Value,Size);
TStr v(s);
delete[] s;
if( query->eof() )
query->execSql("INSERT INTO tbs_session_blob (FName,FCookie,FValue,FDate) VALUES ('"+Name+"','"+Cookie+"','"+v+"',now())");
else
query->execSql(TStr("UPDATE tbs_session_blob SET FValue='"+v+"', FDate=now() WHERE ID=")+query->fields(0));
query->close();
}
}
示例4: LoadValue
bool TDatabaseSession::LoadValue(
const TStr &Cookie,
const TStr &Name,
TStr &Value)
{
if( Cookie.Length() > 0 ) {
query->openSql("SELECT FValue,Length(FValue) FROM tbs_session_blob WHERE FCookie='"+Cookie+"' and FName='"+Name+"' and to_days(fDate) > to_days(now())-"+DaySave);
if( !query->eof() ) {
Value += query->fields(0);
return true;
}
}
return false;
}
示例5: SetValue
void TDatabaseSession::SetValue(
const TStr &Cookie,
const TStr &Name,
const TStr &Value)
{
SetCookie(Cookie);
if( Cookie.Length() > 0 ) {
m_ssi::TMapItem<TStr> *p = SessionList.Find(Name);
if( p == NULL ) {
query->execSql("INSERT INTO tbs_session (FName,FCookie,FValue,FDate) VALUES ('"+Name+"','"+Cookie+"','"+Value+"',now())");
SessionList.Add(Name,Value);
} else {
query->execSql("UPDATE tbs_session SET FValue='"+Value+"', FDate=now() WHERE FName='"+Name+"' and FCookie='"+Cookie+"'");
p->SetValue(Value);
}
}
}