本文整理汇总了C#中IdList类的典型用法代码示例。如果您正苦于以下问题:C# IdList类的具体用法?C# IdList怎么用?C# IdList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdList类属于命名空间,在下文中一共展示了IdList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NameInUsingClause
static bool NameInUsingClause(IdList using_, string colName)
{
if (using_ != null)
for (int k = 0; k < using_.Ids.length; k++)
if (string.Compare(using_.Ids[k].Name, colName, StringComparison.OrdinalIgnoreCase) == 0) return true;
return false;
}
示例2: checkColumnOverlap
/*
** pEList is the SET clause of an UPDATE statement. Each entry
** in pEList is of the format <id>=<expr>. If any of the entries
** in pEList have an <id> which matches an identifier in pIdList,
** then return TRUE. If pIdList==NULL, then it is considered a
** wildcard that matches anything. Likewise if pEList==NULL then
** it matches anything so always return true. Return false only
** if there is no match.
*/
static int checkColumnOverlap(IdList pIdList, ExprList pEList)
{
int e;
if (pIdList == null || NEVER(pEList == null))
return 1;
for (e = 0; e < pEList.nExpr; e++)
{
if (sqlite3IdListIndex(pIdList, pEList.a[e].zName) >= 0)
return 1;
}
return 0;
}
示例3: RenderResults
public static void RenderResults(HtmlWriter writer, SearchRecord[] records, bool renderUl = true)
{
var visibleCategorizations = CategorizationFolder.GetVisibleCategorizations();
var newsListUrl = Urls.GetMainNewsListUrl();
if (renderUl)
writer.RenderBeginTag(HtmlTextWriterTag.Ul, "news-list");
foreach (var record in records)
{
var date = record.GetDate("date");
writer.RenderBeginTag(HtmlTextWriterTag.Li, "clearfix");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddAttribute(HtmlTextWriterAttribute.Href, record.GetString("url"));
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.RenderFullTag(HtmlTextWriterTag.H3, record.GetString("title"));
writer.RenderEndTag(); // a
if (date != null)
writer.RenderFullTag(HtmlTextWriterTag.Span,
"Publiseret " + record.GetDate("date").Value.ToString("dd-MM-yyyy"), "date");
var categorizations = new IdList(record.GetString("categorizations"));
if (categorizations.Any())
{
RenderCategorizations(writer, categorizations, visibleCategorizations, newsListUrl);
}
writer.RenderBeginTag(HtmlTextWriterTag.A);
var text = record.GetString("summary");
if (text.Length > 150)
text = text.Substring(0, 150);
writer.RenderFullTag(HtmlTextWriterTag.P, text);
writer.RenderEndTag(); // a
writer.RenderEndTag(); // div
writer.RenderEndTag(); // li.clearfix
}
if (renderUl)
writer.RenderEndTag();
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
AjaxUtil.RegisterPageMethods(this);
if (!string.IsNullOrEmpty(Request.QueryString["frame"]))
{
ClientScript.RegisterStartupScript(Page.GetType(), "editorInitialization", @"
var gridEditorFrame = $('#" + Request.QueryString["frame"] + @"', window.parent.document);
gridEditorFrame.parent().css('clear','both');
", true);
}
editor.Attributes.Add("hiddenId", Request.QueryString["hiddenId"]);
var provider = GetProvider();
var sourceNodes = provider.GetRootNodes().ToList();
var destinationNodes = new List<Node>();
using (CmsContext.Editing)
{
var item = CmsService.Instance.GetItem<Entity>(new Id(Request.QueryString["itemId"]));
var fieldName = Request.QueryString["fieldName"];
var value = new IdList(item[fieldName]);
foreach (var id in value)
{
var node = sourceNodes.Where(n => n.Id == id.ToString()).FirstOrDefault();
if (node != null)
{
sourceNodes.Remove(node);
destinationNodes.Add(node);
}
}
var litSource = new Literal();
litSource.Text = "<ul class=\"srcList listbox\">" + multiListControl.GenerateListBox(sourceNodes) + "</ul>";
multiListControl.Initialize(litSource, destinationNodes);
}
}
示例5: CreateChildControls
protected override void CreateChildControls()
{
var provider = GetProvider();
using (CmsContext.Editing)
{
var item = CmsService.Instance.GetItem<Entity>(new Id(Request.QueryString["itemId"]));
var fieldName = Request.QueryString["fieldName"];
var value = new IdList(item[fieldName]);
var destinationNodes = value.Select(id => provider.GetNode(id.ToString())).Where(node => node != null).ToArray();
var treeview = new LinqItTreeView();
treeview.Provider = Request.QueryString["provider"];
treeview.ProviderReferenceId = Request.QueryString["itemId"];
var placeholder = new PlaceHolder();
placeholder.Controls.Add(new LiteralControl("<div class=\"srcList \">"));
placeholder.Controls.Add(treeview);
placeholder.Controls.Add(new LiteralControl("</div>"));
multiListControl.Initialize(placeholder, destinationNodes);
}
base.CreateChildControls();
}
示例6: Example3
static string Example3()
{
Pirate p = new Pirate();
StmtList sl1 = new StmtList();
Sub joe = new Sub("joe", sl1);
p.Add(joe);
LocalDecl ld1 = new LocalDecl();
ld1.type = new StringType();
NamedReg name = new NamedReg();
name.name = "name";
IdList idl1 = new IdList();
idl1.Add(name);
ld1.id_list = idl1;
sl1.Add(ld1);
Assign a1 = new Assign();
a1.lval = name;
StringLiteral s1 = new StringLiteral();
s1.value = " Joe!";
a1.rval = s1;
sl1.Add(a1);
Assign a2 = new Assign();
StringLiteral s2 = new StringLiteral();
s2.value = "Hi!";
TmpStringReg tsr0 = new TmpStringReg();
tsr0.number = 0;
a2.lval = tsr0;
a2.rval = s2;
sl1.Add(a2);
Assign a3 = new Assign();
TmpStringReg tsr1 = new TmpStringReg();
tsr1.number = 1;
BinaryCat bc1 = new BinaryCat();
bc1.a = tsr0;
bc1.b = name;
a3.lval = tsr1;
a3.rval = bc1;
sl1.Add(a3);
AssignCat a4 = new AssignCat();
a4.lval = tsr1;
StringLiteral s3 = new StringLiteral();
s3.value = "\n";
a4.rval = s3;
sl1.Add(a4);
CallStmt cs1 = new CallStmt();
Call c1 = new Call();
c1.func = "print";
c1.args = tsr1;
cs1.call = c1;
sl1.Add(cs1);
StringWriter sw = new StringWriter();
PirateWriter pv = new PirateWriter(sw);
DynamicVisitor.accept(p, pv);
return sw.ToString();
}
示例7: Example4
static string Example4()
{
StmtList sl1 = new StmtList();
Sub foo = new Sub("foo", sl1);
Pirate p = new Pirate();
p.Add(foo);
ParamDecl pd1 = new ParamDecl();
pd1.type = new IntType();
IdList idl1 = new IdList();
NamedReg n = new NamedReg();
n.name = "n";
idl1.Add(n);
pd1.id_list = idl1;
sl1.Add(pd1);
ParamDecl pd2 = new ParamDecl();
pd2.type = new StringType();
IdList idl2 = new IdList();
NamedReg message = new NamedReg();
message.name = "message";
idl2.Add(message);
pd2.id_list = idl2;
sl1.Add(pd2);
StringWriter sw = new StringWriter();
PirateWriter pv = new PirateWriter(sw);
DynamicVisitor.accept(p, pv);
return sw.ToString();
}
示例8: sqlite3Insert
static void sqlite3Insert(
Parse pParse, /* Parser context */
SrcList pTabList, /* Name of table into which we are inserting */
ExprList pList, /* List of values to be inserted */
Select pSelect, /* A SELECT statement to use as the data source */
IdList pColumn, /* Column names corresponding to IDLIST. */
int onError /* How to handle constraint errors */
)
{
sqlite3 db; /* The main database structure */
Table pTab; /* The table to insert into. aka TABLE */
string zTab; /* Name of the table into which we are inserting */
string zDb; /* Name of the database holding this table */
int i = 0;
int j = 0;
int idx = 0; /* Loop counters */
Vdbe v; /* Generate code into this virtual machine */
Index pIdx; /* For looping over indices of the table */
int nColumn; /* Number of columns in the data */
int nHidden = 0; /* Number of hidden columns if TABLE is virtual */
int baseCur = 0; /* VDBE VdbeCursor number for pTab */
int keyColumn = -1; /* Column that is the INTEGER PRIMARY KEY */
int endOfLoop = 0; /* Label for the end of the insertion loop */
bool useTempTable = false; /* Store SELECT results in intermediate table */
int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
int addrInsTop = 0; /* Jump to label "D" */
int addrCont = 0; /* Top of insert loop. Label "C" in templates 3 and 4 */
int addrSelect = 0; /* Address of coroutine that implements the SELECT */
SelectDest dest; /* Destination for SELECT on rhs of INSERT */
int iDb; /* Index of database holding TABLE */
Db pDb; /* The database containing table being inserted into */
bool appendFlag = false; /* True if the insert is likely to be an append */
/* Register allocations */
int regFromSelect = 0; /* Base register for data coming from SELECT */
int regAutoinc = 0; /* Register holding the AUTOINCREMENT counter */
int regRowCount = 0; /* Memory cell used for the row counter */
int regIns; /* Block of regs holding rowid+data being inserted */
int regRowid; /* registers holding insert rowid */
int regData; /* register holding first column to insert */
int regEof = 0; /* Register recording end of SELECT data */
int[] aRegIdx = null; /* One register allocated to each index */
#if !SQLITE_OMIT_TRIGGER
bool isView = false; /* True if attempting to insert into a view */
Trigger pTrigger; /* List of triggers on pTab, if required */
int tmask = 0; /* Mask of trigger times */
#endif
db = pParse.db;
dest = new SelectDest();// memset( &dest, 0, sizeof( dest ) );
if ( pParse.nErr != 0 /*|| db.mallocFailed != 0 */ )
{
goto insert_cleanup;
}
/* Locate the table into which we will be inserting new information.
*/
Debug.Assert( pTabList.nSrc == 1 );
zTab = pTabList.a[0].zName;
if ( NEVER( zTab == null ) )
goto insert_cleanup;
pTab = sqlite3SrcListLookup( pParse, pTabList );
if ( pTab == null )
{
goto insert_cleanup;
}
iDb = sqlite3SchemaToIndex( db, pTab.pSchema );
Debug.Assert( iDb < db.nDb );
pDb = db.aDb[iDb];
zDb = pDb.zName;
#if NO_SQLITE_OMIT_AUTHORIZATION //#if !SQLITE_OMIT_AUTHORIZATION
if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab.zName, 0, zDb) ){
goto insert_cleanup;
}
#endif
/* Figure out if we have any triggers and if the table being
** inserted into is a view
*/
#if !SQLITE_OMIT_TRIGGER
pTrigger = sqlite3TriggersExist( pParse, pTab, TK_INSERT, null, out tmask );
isView = pTab.pSelect != null;
#else
Trigger pTrigger = null; //# define pTrigger 0
int tmask = 0; //# define tmask 0
bool isView = false;
#endif
#if SQLITE_OMIT_VIEW
//# undef isView
isView = false;
#endif
#if !SQLITE_OMIT_TRIGGER
Debug.Assert( ( pTrigger != null && tmask != 0 ) || ( pTrigger == null && tmask == 0 ) );
#endif
#if !SQLITE_OMIT_VIEW
/* If pTab is really a view, make sure it has been initialized.
** ViewGetColumnNames() is a no-op if pTab is not a view (or virtual
//.........这里部分代码省略.........
示例9: sqlite3IdListDup
static IdList sqlite3IdListDup( sqlite3 db, IdList p )
{
IdList pNew;
int i;
if ( p == null )
return null;
pNew = new IdList();//sqlite3DbMallocRaw(db, sizeof(*pNew) );
if ( pNew == null )
return null;
pNew.nId = pNew.nAlloc = p.nId;
pNew.a = new IdList_item[p.nId];//sqlite3DbMallocRaw(db, p.nId*sizeof(p.a[0]) );
if ( pNew.a == null )
{
sqlite3DbFree( db, ref pNew );
return null;
}
for ( i = 0; i < p.nId; i++ )
{
pNew.a[i] = new IdList_item();
IdList_item pNewItem = pNew.a[i];
IdList_item pOldItem = p.a[i];
pNewItem.zName = pOldItem.zName;// sqlite3DbStrDup(db, pOldItem.zName);
pNewItem.idx = pOldItem.idx;
}
return pNew;
}
示例10: TriggerInsertStep
public static TriggerStep TriggerInsertStep(Context ctx, Token tableName, IdList column, ExprList list, int null_5, OE orconf) { return TriggerInsertStep(ctx, tableName, column, list, null, orconf); }
示例11: sqlite3TriggerInsertStep
/*
** Build a trigger step out of an INSERT statement. Return a pointer
** to the new trigger step.
**
** The parser calls this routine when it sees an INSERT inside the
** body of a trigger.
*/
// OVERLOADS, so I don't need to rewrite parse.c
private static TriggerStep sqlite3TriggerInsertStep(sqlite3 db, Token pTableName, IdList pColumn, int null_4, int null_5, u8 orconf)
{
return sqlite3TriggerInsertStep(db, pTableName, pColumn, null, null, orconf);
}
示例12: sqlite3BeginTrigger
/*
** This is called by the parser when it sees a CREATE TRIGGER statement
** up to the point of the BEGIN before the trigger actions. A Trigger
** structure is generated based on the information available and stored
** in pParse.pNewTrigger. After the trigger actions have been parsed, the
** sqlite3FinishTrigger() function is called to complete the trigger
** construction process.
*/
static void sqlite3BeginTrigger(
Parse pParse, /* The parse context of the CREATE TRIGGER statement */
Token pName1, /* The name of the trigger */
Token pName2, /* The name of the trigger */
int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
IdList pColumns, /* column list if this is an UPDATE OF trigger */
SrcList pTableName,/* The name of the table/view the trigger applies to */
Expr pWhen, /* WHEN clause */
int isTemp, /* True if the TEMPORARY keyword is present */
int noErr /* Suppress errors if the trigger already exists */
)
{
Trigger pTrigger = null; /* The new trigger */
Table pTab; /* Table that the trigger fires off of */
string zName = null; /* Name of the trigger */
sqlite3 db = pParse.db; /* The database connection */
int iDb; /* The database to store the trigger in */
Token pName = null; /* The unqualified db name */
DbFixer sFix = new DbFixer(); /* State vector for the DB fixer */
int iTabDb; /* Index of the database holding pTab */
Debug.Assert( pName1 != null ); /* pName1.z might be NULL, but not pName1 itself */
Debug.Assert( pName2 != null );
Debug.Assert( op == TK_INSERT || op == TK_UPDATE || op == TK_DELETE );
Debug.Assert( op > 0 && op < 0xff );
if ( isTemp != 0 )
{
/* If TEMP was specified, then the trigger name may not be qualified. */
if ( pName2.n > 0 )
{
sqlite3ErrorMsg( pParse, "temporary trigger may not have qualified name" );
goto trigger_cleanup;
}
iDb = 1;
pName = pName1;
}
else
{
/* Figure out the db that the the trigger will be created in */
iDb = sqlite3TwoPartName( pParse, pName1, pName2, ref pName );
if ( iDb < 0 )
{
goto trigger_cleanup;
}
}
if ( null == pTableName ) //|| db.mallocFailed
{
goto trigger_cleanup;
}
/* A long-standing parser bug is that this syntax was allowed:
**
** CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab ....
** ^^^^^^^^
**
** To maintain backwards compatibility, ignore the database
** name on pTableName if we are reparsing our of SQLITE_MASTER.
*/
if ( db.init.busy != 0 && iDb != 1 )
{
//sqlite3DbFree( db, pTableName.a[0].zDatabase );
pTableName.a[0].zDatabase = null;
}
/* If the trigger name was unqualified, and the table is a temp table,
** then set iDb to 1 to create the trigger in the temporary database.
** If sqlite3SrcListLookup() returns 0, indicating the table does not
** exist, the error is caught by the block below.
*/
if ( pTableName == null /*|| db.mallocFailed != 0 */ )
{
goto trigger_cleanup;
}
pTab = sqlite3SrcListLookup( pParse, pTableName );
if ( db.init.busy == 0 && pName2.n == 0 && pTab != null
&& pTab.pSchema == db.aDb[1].pSchema )
{
iDb = 1;
}
/* Ensure the table name matches database name and that the table exists */
// if ( db.mallocFailed != 0 ) goto trigger_cleanup;
Debug.Assert( pTableName.nSrc == 1 );
if ( sqlite3FixInit( sFix, pParse, iDb, "trigger", pName ) != 0 &&
sqlite3FixSrcList( sFix, pTableName ) != 0 )
{
goto trigger_cleanup;
}
pTab = sqlite3SrcListLookup( pParse, pTableName );
if ( pTab == null )
{
//.........这里部分代码省略.........
示例13: BeginTrigger
public static void BeginTrigger(Parse parse, Token name1, Token name2, TK trTm, TK op, IdList columns, SrcList tableName, Expr when, bool isTemp, int noErr)
{
Context ctx = parse.Ctx; // The database connection
Debug.Assert(name1 != null); // pName1.z might be NULL, but not pName1 itself
Debug.Assert(name2 != null);
Debug.Assert(op == TK.INSERT || op == TK.UPDATE || op == TK.DELETE);
Debug.Assert(op > 0 && op < (TK)0xff);
Trigger trigger = null; // The new trigger
int db; // The database to store the trigger in
Token name = null; // The unqualified db name
if (isTemp)
{
// If TEMP was specified, then the trigger name may not be qualified.
if (name2.length > 0)
{
parse.ErrorMsg("temporary trigger may not have qualified name");
goto trigger_cleanup;
}
db = 1;
name = name1;
}
else
{
// Figure out the db that the the trigger will be created in
db = parse.TwoPartName(name1, name2, ref name);
if (db < 0)
goto trigger_cleanup;
}
if (tableName == null || ctx.MallocFailed)
goto trigger_cleanup;
// A long-standing parser bug is that this syntax was allowed:
// CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab ....
// ^^^^^^^^
// To maintain backwards compatibility, ignore the database name on pTableName if we are reparsing our of SQLITE_MASTER.
if (ctx.Init.Busy && db != 1)
{
C._tagfree(ctx, ref tableName.Ids[0].Database);
tableName.Ids[0].Database = null;
}
// If the trigger name was unqualified, and the table is a temp table, then set iDb to 1 to create the trigger in the temporary database.
// If sqlite3SrcListLookup() returns 0, indicating the table does not exist, the error is caught by the block below.
//? if (tableName == null) goto trigger_cleanup;
Table table = Delete.SrcListLookup(parse, tableName); // Table that the trigger fires off of
if (ctx.Init.Busy == null && name2.length == 0 && table != null && table.Schema == ctx.DBs[1].Schema)
db = 1;
// Ensure the table name matches database name and that the table exists
if (ctx.MallocFailed) goto trigger_cleanup;
Debug.Assert(tableName.Srcs == 1);
DbFixer sFix = new DbFixer(); // State vector for the DB fixer
if (sFix.FixInit(parse, db, "trigger", name) && sFix.FixSrcList(tableName))
goto trigger_cleanup;
table = Delete.SrcListLookup(parse, tableName);
if (table == null)
{
// The table does not exist.
if (ctx.Init.DB == 1)
{
// Ticket #3810.
// Normally, whenever a table is dropped, all associated triggers are dropped too. But if a TEMP trigger is created on a non-TEMP table
// and the table is dropped by a different database connection, the trigger is not visible to the database connection that does the
// drop so the trigger cannot be dropped. This results in an "orphaned trigger" - a trigger whose associated table is missing.
ctx.Init.OrphanTrigger = true;
}
goto trigger_cleanup;
}
if (E.IsVirtual(table))
{
parse.ErrorMsg("cannot create triggers on virtual tables");
goto trigger_cleanup;
}
// Check that the trigger name is not reserved and that no trigger of the specified name exists
string nameAsString = Parse.NameFromToken(ctx, name);
if (nameAsString == null || parse.CheckObjectName(nameAsString) != RC.OK)
goto trigger_cleanup;
Debug.Assert(Btree.SchemaMutexHeld(ctx, db, null));
if (ctx.DBs[db].Schema.TriggerHash.Find(nameAsString, nameAsString.Length, (Trigger)null) != null)
{
if (noErr == 0)
parse.ErrorMsg("trigger %T already exists", name);
else
{
Debug.Assert(!ctx.Init.Busy);
parse.CodeVerifySchema(db);
}
goto trigger_cleanup;
}
// Do not create a trigger on a system table
if (table.Name.StartsWith("sqlite_", StringComparison.InvariantCultureIgnoreCase))
{
parse.ErrorMsg("cannot create trigger on system table");
parse.Errs++;
goto trigger_cleanup;
}
//.........这里部分代码省略.........
示例14: SetPreStates
/// <summary>
/// Sets the PRE states of a state transition condition.
/// </summary>
/// <param name="names"></param>
public void SetPreStates(IdList names)
{
StateIndexes.AddRange(Variable.Type.GetIndexesOfNames(names));
PreWildcard = names.Wildcard;
}
示例15: CheckColumnOverlap
static bool CheckColumnOverlap(IdList idList, ExprList eList)
{
if (idList == null || C._NEVER(eList == null)) return true;
for (int e = 0; e < eList.Exprs; e++)
if (Expr.IdListIndex(idList, eList.Ids[e].Name) >= 0) return true;
return false;
}