mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Sql: SqlSetFrom variant with pos, count, S_::GetIndex(id)
git-svn-id: svn://ultimatepp.org/upp/trunk@7573 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ed6412aa24
commit
58f5c08afa
4 changed files with 25 additions and 0 deletions
|
|
@ -144,6 +144,8 @@ struct S_info {
|
|||
int GetCount() const { return column.GetCount(); }
|
||||
|
||||
SqlId GetId(int i) const { return column.GetKey(i); }
|
||||
int GetIndex(const String& id) const { return column.Find(id); }
|
||||
int GetIndex(const SqlId& id) const { return column.Find(~id); }
|
||||
|
||||
int GetWidth(int i) const { return column[i].width; }
|
||||
int GetWidth(const SqlId& id) const;
|
||||
|
|
@ -194,6 +196,8 @@ struct S_type {
|
|||
|
||||
static int GetCount();
|
||||
static SqlId GetId(int i);
|
||||
static int GetIndex(const String& id);
|
||||
static int GetIndex(const SqlId& id);
|
||||
static int GetWidth(int i);
|
||||
static int GetWidth(const SqlId& id);
|
||||
|
||||
|
|
|
|||
|
|
@ -479,6 +479,17 @@ SqlSet SqlSetFrom(const T& cont)
|
|||
return set;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
SqlSet SqlSetFrom(const T& cont, int pos, int count)
|
||||
{
|
||||
SqlSet set;
|
||||
typename T::ConstIterator it = cont.Begin() + pos;
|
||||
typename T::ConstIterator e = it + count;
|
||||
for(; it != e; it++)
|
||||
set.Cat(*it);
|
||||
return set;
|
||||
}
|
||||
|
||||
class SqlSetC : public SqlSet {
|
||||
public:
|
||||
SqlSetC(const String& s) { text = s; priority = SET; }
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public: \
|
|||
\
|
||||
static int GetCount() { return GetInfo().GetCount(); } \
|
||||
static SqlId GetId(int i) { return GetInfo().GetId(i); } \
|
||||
static int GetIndex(const String& id) { return GetInfo().GetIndex(id); } \
|
||||
static int GetIndex(const SqlId& id) { return GetInfo().GetIndex(id); } \
|
||||
static int GetWidth(int i) { return GetInfo().GetWidth(i); } \
|
||||
static int GetWidth(const SqlId& id) { return GetInfo().GetWidth(id); } \
|
||||
\
|
||||
|
|
|
|||
|
|
@ -95,6 +95,14 @@ t]_[*@3 i])&]
|
|||
[s2; Returns a column ID for column at [%-*@3 i].&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:S`_type`:`:GetIndex`(const String`&`):%- [@(0.0.255) static] [@(0.0.255) int]_[* GetIn
|
||||
dex]([@(0.0.255) const]_[_^String^ String][@(0.0.255) `&]_[*@3 id])&]
|
||||
[s5;:S`_type`:`:GetIndex`(const SqlId`&`):%- [@(0.0.255) static] [@(0.0.255) int]_[* GetInd
|
||||
ex]([@(0.0.255) const]_[_^SqlId^ SqlId][@(0.0.255) `&]_[*@3 id])&]
|
||||
[s2;~~~1792; Returns the index of column [%-*@3 id] or negative number
|
||||
if not found.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:S`_type`:`:GetWidth`(int`):%- [@(0.0.255) static] [@(0.0.255) int]_[* GetWidth]([@(0.0.255) i
|
||||
nt]_[*@3 i])&]
|
||||
[s2; Returns the width of column (usually text) as defined in the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue