本文整理汇总了C#中Mem.xDel方法的典型用法代码示例。如果您正苦于以下问题:C# Mem.xDel方法的具体用法?C# Mem.xDel怎么用?C# Mem.xDel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mem
的用法示例。
在下文中一共展示了Mem.xDel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sqlite3VdbeMemGrow
/*
** Make sure pMem.z points to a writable allocation of at least
** n bytes.
**
** If the memory cell currently contains string or blob data
** and the third argument passed to this function is true, the
** current content of the cell is preserved. Otherwise, it may
** be discarded.
**
** This function sets the MEM_Dyn flag and clears any xDel callback.
** It also clears MEM_Ephem and MEM_Static. If the preserve flag is
** not set, Mem.n is zeroed.
*/
private static int sqlite3VdbeMemGrow(Mem pMem, int n, int preserve)
{
// TODO -- What do we want to do about this routine?
//Debug.Assert( 1 >=
// ((pMem.zMalloc !=null )? 1 : 0) + //&& pMem.zMalloc==pMem.z) ? 1 : 0) +
// (((pMem.flags & MEM_Dyn)!=0 && pMem.xDel!=null) ? 1 : 0) +
// ((pMem.flags & MEM_Ephem)!=0 ? 1 : 0) +
// ((pMem.flags & MEM_Static)!=0 ? 1 : 0)
//);
//assert( (pMem->flags&MEM_RowSet)==0 );
//if( n<32 ) n = 32;
//if( sqlite3DbMallocSize(pMem->db, pMem.zMalloc)<n ){
if (preserve != 0)
{//& pMem.z==pMem.zMalloc ){
if (pMem.z == null)
pMem.z = "";// sqlite3DbReallocOrFree( pMem.db, pMem.z, n );
else
if (n < pMem.z.Length)
pMem.z = pMem.z.Substring(0, n);
preserve = 0;
}
else
{
// sqlite3DbFree(pMem->db,ref pMem.zMalloc);
pMem.z = "";// sqlite3DbMallocRaw( pMem.db, n );
}
//}
// if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){
// memcpy(pMem.zMalloc, pMem.z, pMem.n);
//}
if ((pMem.flags & MEM_Dyn) != 0 && pMem.xDel != null)
{
pMem.xDel(ref pMem.z);
}
// TODO --pMem.z = pMem.zMalloc;
if (pMem.z == null)
{
pMem.flags = MEM_Null;
}
else
{
pMem.flags = (u16)(pMem.flags & ~(MEM_Ephem | MEM_Static));
}
pMem.xDel = null;
return pMem.z != null ? SQLITE_OK : SQLITE_NOMEM;
}
示例2: sqlite3VdbeMemReleaseExternal
/*
** If the memory cell contains a string value that must be freed by
** invoking an external callback, free it now. Calling this function
** does not free any Mem.zMalloc buffer.
*/
private static void sqlite3VdbeMemReleaseExternal(Mem p)
{
Debug.Assert(p.db == null || sqlite3_mutex_held(p.db.mutex));
testcase(p.flags & MEM_Agg);
testcase(p.flags & MEM_Dyn);
testcase(p.flags & MEM_RowSet);
testcase(p.flags & MEM_Frame);
if ((p.flags & (MEM_Agg | MEM_Dyn | MEM_RowSet | MEM_Frame)) != 0)
{
if ((p.flags & MEM_Agg) != 0)
{
sqlite3VdbeMemFinalize(p, p.u.pDef);
Debug.Assert((p.flags & MEM_Agg) == 0);
sqlite3VdbeMemRelease(p);
}
else if ((p.flags & MEM_Dyn) != 0 && p.xDel != null)
{
Debug.Assert((p.flags & MEM_RowSet) == 0);
p.xDel(ref p.z);
p.xDel = null;
}
else if ((p.flags & MEM_RowSet) != 0)
{
sqlite3RowSetClear(p.u.pRowSet);
}
else if ((p.flags & MEM_Frame) != 0)
{
sqlite3VdbeMemSetNull(p);
}
}
p.n = 0;
p.z = null;
p.zBLOB = null;
}
示例3: sqlite3VdbeMemReleaseExternal
/*
** If the memory cell contains a string value that must be freed by
** invoking an external callback, free it now. Calling this function
** does not free any Mem.zMalloc buffer.
*/
static void sqlite3VdbeMemReleaseExternal( ref Mem p )
{
Debug.Assert( p.db == null || sqlite3_mutex_held( p.db.mutex ) );
if ( ( p.flags & ( MEM_Agg | MEM_Dyn | MEM_RowSet ) ) != 0 )
{
if ( ( p.flags & MEM_Agg ) != 0 )
{
sqlite3VdbeMemFinalize( ref p, p.upDef );
Debug.Assert( ( p.flags & MEM_Agg ) == 0 );
sqlite3VdbeMemRelease( ref p );
}
else if ( ( p.flags & MEM_Dyn ) != 0 && p.xDel != null )
{
Debug.Assert( ( p.flags & MEM_RowSet ) == 0 );
p.xDel( ref p.z );
p.xDel = null;
}
else if ( ( p.flags & MEM_RowSet ) != 0 )
{
sqlite3RowSetClear( p.upRowSet );
}
}
p.n = 0;
p.z = null;
p.zBLOB = null;
//
// Release additional C# pointers for backlinks
p._Mem = null;
p._SumCtx = null;
p._MD5Context = null;
}