本文整理汇总了C#中KeyInfo类的典型用法代码示例。如果您正苦于以下问题:C# KeyInfo类的具体用法?C# KeyInfo怎么用?C# KeyInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyInfo类属于命名空间,在下文中一共展示了KeyInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: sqlite3IndexKeyinfo
// Return a dynamicly allocated KeyInfo structure that can be used with OP_OpenRead or OP_OpenWrite to access database index pIdx.
//
// If successful, a pointer to the new structure is returned. In this case the caller is responsible for calling sqlite3DbFree(db, ) on the returned
// pointer. If an error occurs (out of memory or missing collation sequence), NULL is returned and the state of pParse updated to reflect
// the error.
internal static KeyInfo sqlite3IndexKeyinfo(Parse pParse, Index pIdx)
{
var nCol = pIdx.nColumn;
var db = pParse.db;
var pKey = new KeyInfo();
if (pKey != null)
{
pKey.db = pParse.db;
pKey.aSortOrder = new byte[nCol];
pKey.aColl = new CollSeq[nCol];
for (var i = 0; i < nCol; i++)
{
var zColl = pIdx.azColl[i];
Debug.Assert(zColl != null);
pKey.aColl[i] = sqlite3LocateCollSeq(pParse, zColl);
pKey.aSortOrder[i] = pIdx.aSortOrder[i];
}
pKey.nField = (ushort)nCol;
}
if (pParse.nErr != 0)
{
pKey = null;
sqlite3DbFree(db, ref pKey);
}
return pKey;
}
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:31,代码来源:Build.cs
示例2: ValuePair
static KeyInfo ValuePair(Enum token, object value)
{
KeyInfo k=new KeyInfo();
k.ki_key=(int)(object)token;
k.ki_name=token.ToString();
return k;
}
开发者ID:LogoPhonix,项目名称:libgeotiff.net,代码行数:7,代码来源:geonames.cs
示例3: GetHelper
private static ProofKeysHelper GetHelper()
{
KeyInfo current = new KeyInfo(key, modulus, exponent);
KeyInfo old = new KeyInfo(oldKey, oldModulus, oldExponent);
return new ProofKeysHelper(current, old);
}
开发者ID:shivajiraot,项目名称:Office-Online-Test-Tools-and-Documentation,代码行数:7,代码来源:ProofKeyTests.cs
示例4: KeyValue
internal KeyValue(KeyInfo key, byte[] keyBuffer)
{
if (key == null || keyBuffer == null) {
throw new ArgumentNullException();
}
if (key.Length < keyBuffer.Length) {
throw new ArgumentException();
}
this.Key = key;
this.KeyBuffer = keyBuffer;
this.ComplementCount = 0;
}
开发者ID:jishida,项目名称:BtrieveWrapper,代码行数:12,代码来源:KeyValue.cs
示例5: TmKeyRec
public TmKeyRec(int _buffSize, BUFF_TYPE _buffType)
{
mBuffSize = _buffSize;
mInfo = new KeyInfo();
mRecInfo = new KeyInfo[mBuffSize];
mBuffPtr = -1;
mRecSize = mRecCtr = mPlayCtr = 0;
mState = STATE.STOP;
mBuffType = _buffType;
mPad = new PAD();
mDebug = new KeyInfoDebug();
}
开发者ID:hiyijia,项目名称:unity_mylib,代码行数:12,代码来源:TmKeyRec.cs
示例6: Zero
public uint[] OverflowIDs; // Cache of overflow page locations
#endif
#region Methods
// was:sqlite3BtreeCursorZero
public void Zero()
{
Next = null;
Prev = null;
KeyInfo = null;
RootID = 0;
_cachedRowID = 0;
Info = new MemPage.CellInfo();
Writeable = false;
AtLast = false;
ValidNKey = false;
State = 0;
Key = null;
NKey = 0;
SkipNext = 0;
#if !SQLITE_OMIT_INCRBLOB
IsIncrblob = false;
OverflowIDs = null;
#endif
PageID = 0;
}
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:28,代码来源:BtreeCursor.cs
示例7: Clear
public bool isIncrblobHandle; // True if this cursor is an incr. io handle
#endif
#region Methods
public void Clear()
{
pNext = null;
pPrev = null;
pKeyInfo = null;
pgnoRoot = 0;
cachedRowid = 0;
info = new CellInfo();
wrFlag = 0;
atLast = 0;
validNKey = false;
eState = 0;
pKey = null;
nKey = 0;
skipNext = 0;
#if !SQLITE_OMIT_INCRBLOB
isIncrblobHandle = false;
aOverflow = null;
#endif
iPage = 0;
}
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:27,代码来源:BtCursor.cs
示例8: SvgElement
// Methods
internal SvgElement(string prefix, string localname, string ns, SvgDocument doc)
: base(prefix, localname, ns, doc)
{
this.timeLineVisible = true;
KeyInfo[] infoArray1 = new KeyInfo[1] { new KeyInfo(0, 0) } ;
this.infoList = new ArrayList(infoArray1);
this.showParticular = false;
this.inKey = false;
this.animatelist = new SvgElementCollection();
this.svgAttributes = new Hashtable(0x10);
this.svgAnimAttributes = new Hashtable(0x10);
this.svgStyleAttributes = new Hashtable(0x10);
this.beforeChangeValueStr = string.Empty;
this.showchild = true;
this.pretime = -1;
this.AnimateNameValues = new Hashtable(0x10);
this.AttributePos = new Hashtable();
this.FormatOutXml = true;
this.UseElement = null;
this.CreateParse = true;
this.ownerDocument = doc;
this.FormatElement = false;
this.AllowRename = true;
}
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:25,代码来源:SvgElement.cs
示例9: UIKeyPressed
public override bool UIKeyPressed(KeyInfo key)
{
if (key == null) throw new ArgumentNullException("key");
switch (key.VirtualKeyCode)
{
case KeyCode.F1:
if (key.Is())
{
Far.Api.ShowHelp(Far.Api.GetType().Assembly.Location, SettingsUI.HelpSettings, HelpOptions.None);
return true;
}
break;
case KeyCode.Delete:
case KeyCode.F8:
SetDefaults();
return true;
}
return base.UIKeyPressed(key);
}
开发者ID:pezipink,项目名称:FarNet,代码行数:24,代码来源:SettingsPanel.cs
示例10: Sign
public static string Sign(string xml, X509Certificate2 certificate)
{
if (xml == null) throw new ArgumentNullException("xml");
if (certificate == null) throw new ArgumentNullException("certificate");
if (!certificate.HasPrivateKey) throw new ArgumentException("certificate", "Certificate should have a private key");
XmlDocument doc = new XmlDocument();
doc.PreserveWhitespace = true;
doc.LoadXml(xml);
SignedXml signedXml = new SignedXml(doc);
signedXml.SigningKey = certificate.PrivateKey;
// Attach certificate KeyInfo
KeyInfoX509Data keyInfoData = new KeyInfoX509Data(certificate);
KeyInfo keyInfo = new KeyInfo();
keyInfo.AddClause(keyInfoData);
signedXml.KeyInfo = keyInfo;
// Attach transforms
var reference = new Reference("");
reference.AddTransform(new XmlDsigEnvelopedSignatureTransform(includeComments: false));
reference.AddTransform(new XmlDsigExcC14NTransform(includeComments: false));
signedXml.AddReference(reference);
// Compute signature
signedXml.ComputeSignature();
var signatureElement = signedXml.GetXml();
// Add signature to bundle
doc.DocumentElement.AppendChild(doc.ImportNode(signatureElement, true));
return doc.OuterXml;
}
开发者ID:nagyistoce,项目名称:furore-sprinkler,代码行数:35,代码来源:XmlSignatureHelper.cs
示例11: InitKeyPoints
//Gets only transform Keys
public void InitKeyPoints()
{
ArmInfo[] arms = GetComponent<ArmController>().Arms;
TorsoInfo torso = GetComponent<TorsoController>().Torso;
#if EDITORMODE
//Rotation x, y and z curves are the same, so one is enough
//No keypoints defined for localTransform
AnimationCurve xCurve = AnimationUtility.GetEditorCurve(animation[AnimName].clip,"Hips/Spine/Spine1/RightShoulder/RightArm/RightForeArm/RightHand",typeof(Transform),"m_LocalRotation.x");
Keyframe[] frames = xCurve.keys;
//Keyframe[] frames =animation[AnimName].;
Keys = new KeyInfo[frames.Length];
//all frames as Keys Keys = new KeyInfo[frameCnt ];
for(int i = 0; i < Keys.Length; i++) {
animation[AnimName].time = frames[i].time;//(float) Keys[i].frameNo / animation[AnimName].clip.frameRate;
//animation[AnimName].time = i/animation[AnimName].clip.frameRate;//(float) Keys[i].frameNo / animation[AnimName].clip.frameRate;
animation.Sample ();
Keys[i] = new KeyInfo();
Keys[i].FrameNo = Mathf.FloorToInt(animation[AnimName].time * animation[AnimName].clip.frameRate);
Keys[i].Time = animation[AnimName].time;
for(int arm = 0; arm < 2; arm++) {
Keys[i].EePos[arm] = Keys[i].EePosOrig[arm] = arms[arm].Wrist.position;
}
Keys[i].ClavicleLRot = torso.ClavicleL.rotation;
Keys[i].ClavicleRRot = torso.ClavicleR.rotation;
Keys[i].NeckRot = torso.Neck.rotation;
Keys[i].SpineRot = torso.Spine.rotation;
Keys[i].Spine1Rot = torso.Spine1.rotation;
Keys[i].ElbowLRot = torso.ElbowL.rotation;
Keys[i].ElbowRRot = torso.ElbowR.rotation;
Keys[i].ClavicleLPos = torso.ClavicleL.position;
Keys[i].ClavicleRPos = torso.ClavicleR.position;
Keys[i].NeckPos = torso.Neck.position;
Keys[i].SpinePos = torso.Spine.position;
Keys[i].Spine1Pos = torso.Spine1.position;
Keys[i].ElbowLPos = torso.ElbowL.position;
Keys[i].ElbowRPos = torso.ElbowR.position;
}
//Compute end effector velocity
for(int i = 0; i < Keys.Length; i++) {
for(int arm = 0; arm < 2; arm++) {
if(i == 0)
Keys[0].EeVel[arm] = (Keys[1].EePos[arm] - Keys[0].EePos[arm]) / (Keys[1].Time - Keys[0].Time);
else if(i == Keys.Length - 1)
Keys[Keys.Length - 1].EeVel[arm] = (Keys[Keys.Length - 1].EePos[arm] - Keys[Keys.Length - 2].EePos[arm]) / (Keys[Keys.Length - 1].Time - Keys[Keys.Length - 2].Time);
else
Keys[i].EeVel[arm] = (Keys[i + 1].EePos[arm] - Keys[i - 1].EePos[arm]) / (Keys[i + 1].Time - Keys[i - 1].Time);
}
}
//Compute end effector acceleration
for(int i = 0; i < Keys.Length; i++) {
for(int arm = 0; arm < 2; arm++) {
if(i == 0)
Keys[0].EeAcc[arm] = (Keys[1].EeVel[arm] - Keys[0].EeVel[arm]) / (Keys[1].Time - Keys[0].Time);
else if(i == Keys.Length - 1)
Keys[Keys.Length - 1].EeAcc[arm] = (Keys[Keys.Length - 1].EeVel[arm] - Keys[Keys.Length - 2].EeVel[arm]) / (Keys[Keys.Length - 1].Time - Keys[Keys.Length - 2].Time);
else
Keys[i].EeAcc[arm] = (Keys[i + 1].EeVel[arm] - Keys[i - 1].EeVel[arm]) / (Keys[i + 1].Time - Keys[i - 1].Time);
}
}
#endif
}
开发者ID:BibleUs,项目名称:Personality,代码行数:75,代码来源:AnimationManager.cs
示例12: MaximumComplement
public static KeyValue MaximumComplement(KeyInfo key, params object[] segmentValues)
{
return new KeyValue(key, segmentValues, false);
}
开发者ID:jishida,项目名称:BtrieveWrapper,代码行数:4,代码来源:KeyValue.cs
示例13: Create
public static KeyValue Create(KeyInfo key, params object[] segmentValues)
{
if (key.Segments.Count != segmentValues.Length) {
throw new ArgumentException();
}
return new KeyValue(key, segmentValues);
}
开发者ID:jishida,项目名称:BtrieveWrapper,代码行数:7,代码来源:KeyValue.cs
示例14: FindCode
// Inverse Utilities (name=>code)
static int FindCode(KeyInfo[] info, string key)
{
foreach(KeyInfo i in info) if(i.ki_name==key) return i.ki_key;
// not a registered key; might be generic code
if(!key.StartsWith("Unknown-")) return -1;
try
{
key=key.Substring(8);
return int.Parse(key);
}
catch
{
return -1;
}
}
开发者ID:LogoPhonix,项目名称:libgeotiff.net,代码行数:18,代码来源:geo_names.cs
示例15: InitKeyPoints
//Vector3 ComputeInitialSwivelAngle(ArmInfo armInfo) {
// float theta;
// Vector3 u = new Vector3(1,0,0); //Local x axis
// Vector3 n = armInfo.wrist.position - armInfo.shoulder.position;
// Vector3 c = HandleUtility.ProjectPointLine (armInfo.elbow.position, armInfo.shoulder.position, armInfo.wrist.position);
// Vector3 pcap = armInfo.elbow.position - c;
// Vector3 ptilda = pcap - Vector3.Dot (pcap, n) * n;
// theta = Mathf.Atan2(Vector3.Cross(pcap, u).magnitude , Vector3.Dot (ptilda,u));
// return new Vector3(theta,0,0);
//}
//ARminfo is passed as a transform because animation is sampled
//We want the end effector position at the sampled time
public void InitKeyPoints()
{
TorsoController torso = GetComponent<TorsoController>();
ArmInfo[] arms = GetComponent<ArmController>().Arms;
AssignGoalKeys();
#if EDITORMODE
// AnimationClipCurveData[] curveDatas = AnimationUtility.GetAllCurves(animation[animName].clip, true);
// Keyframe[] frames = curveDatas[0].curve.keys;
//AnimationCurve xCurve = AnimationUtility.GetEditorCurve(animation[animName].clip,"Hips/Spine/Spine1/RightShoulder/RightArm/RightForeArm/RightHand",typeof(Transform),"m_LocalRotation.x");
//forearm keys are fewer in number, looks better with EMOTE
//AnimationCurve xCurve = AnimationUtility.GetEditorCurve(animation[AnimName].clip, "Hips/Spine/Spine1/RightShoulder/RightArm/RightForeArm", typeof(Transform), "m_LocalRotation.x");
AnimationCurve xCurve = AnimationUtility.GetEditorCurve(animation[AnimName].clip, "Hips/Spine/Spine1/RightShoulder/RightArm", typeof(Transform), "m_LocalRotation.x");
Keyframe[] frames = xCurve.keys;
using (StreamWriter sw = new StreamWriter("keyframes_" + AnimName + ".txt")) {
sw.WriteLine("MyKeyTimes = new float" + "[" + frames.Length + "];");
foreach (Keyframe kf in frames) {
sw.WriteLine("MyKeyTimes[i++] = " + kf.time + "f; ");
}
}
Debug.Log(AnimName);
#elif !EDITORMODE
//file io does not work in web player
/* string[] content = File.ReadAllLines("keyframes.txt");
MyKeyframe[] frames = new MyKeyframe[content.Length];
for (int i = 0; i < content.Length; i++) {
frames[i] = new MyKeyframe();
frames[i].time = float.Parse(content[i]);
}*/
//Will write IO operations later
MyKeyframe[] frames = new MyKeyframe[MyKeyTimes.Length];
for (int i = 0; i < MyKeyTimes.Length; i++) {
frames[i] = new MyKeyframe();
frames[i].Time = MyKeyTimes[i];
}
#endif
animation.Play(AnimName);
int goalKeyInd = 0;
Keys = new KeyInfo[frames.Length ];
for(int i = 0; i < frames.Length; i++) {
animation[AnimName].enabled = true;
animation[AnimName].time = frames[i].Time;
animation.Sample ();
Keys[i] = new KeyInfo();
Keys[i].Time = animation[AnimName].time;
//Keys[i].Time = animation[AnimName].length * i / (frames.Length - 1); //FUNDA : If we are using equally-spaced keys. We still sample from original frames, but we change key times.
if(i == GoalKeys[goalKeyInd]) {
Keys[i].IsGoal = true;
goalKeyInd++;
}
else if(i < GoalKeys[goalKeyInd])
Keys[i].IsGoal = false;
if (Keys[i].FrameNo >= FrameCnt) {
Keys[i].FrameNo = FrameCnt - 1;
}
//body chain and transformation arrays for the specific animation
BodyChain = torso.BodyChainToArray(torso.Torso.Root);
Keys[i].BodyPos = torso.BodyPosArr(BodyChain);
Keys[i].BodyRot = torso.BodyRotArr(BodyChain);
/*
BodyChain = torso.BodyChain;
Keys[i].BodyPos = torso.BodyPos;
Keys[i].BodyRot = torso.BodyRot;
*/
for(int arm = 0; arm < 2; arm++) {
Keys[i].ShoulderPos[arm] = Keys[i].ShoulderPosOrig[arm] = arms[arm].Shoulder.position;
Keys[i].EePos[arm] = Keys[i].EePosOrig[arm] = arms[arm].Wrist.position;
Keys[i].ElbowRot[arm] = Keys[i].ElbowRotOrig[arm] = arms[arm].Elbow.localRotation;
Keys[i].ElbowPos[arm] = Keys[i].ElbowPosOrig[arm] = arms[arm].Elbow.position;
}
}
//.........这里部分代码省略.........
开发者ID:BibleUs,项目名称:Personality,代码行数:101,代码来源:AnimationInfo.cs
示例16: sqlite3VdbeRecordUnpack
/*
** Given the nKey-byte encoding of a record in pKey[], parse the
** record into a UnpackedRecord structure. Return a pointer to
** that structure.
**
** The calling function might provide szSpace bytes of memory
** space at pSpace. This space can be used to hold the returned
** VDbeParsedRecord structure if it is large enough. If it is
** not big enough, space is obtained from sqlite3Malloc().
**
** The returned structure should be closed by a call to
** sqlite3VdbeDeleteUnpackedRecord().
*/
static UnpackedRecord sqlite3VdbeRecordUnpack(
KeyInfo pKeyInfo, /* Information about the record format */
int nKey, /* Size of the binary record */
byte[] pKey, /* The binary record */
UnpackedRecord pSpace, // char *pSpace, /* Unaligned space available to hold the object */
int szSpace /* Size of pSpace[] in bytes */
)
{
byte[] aKey = pKey;
UnpackedRecord p; /* The unpacked record that we will return */
int nByte; /* Memory space needed to hold p, in bytes */
int d;
u32 idx;
int u; /* Unsigned loop counter */
int szHdr = 0;
Mem pMem;
int nOff; /* Increase pSpace by this much to 8-byte align it */
/*
** We want to shift the pointer pSpace up such that it is 8-byte aligned.
** Thus, we need to calculate a value, nOff, between 0 and 7, to shift
** it by. If pSpace is already 8-byte aligned, nOff should be zero.
*/
//nOff = ( 8 - ( SQLITE_PTR_TO_INT( pSpace ) & 7 ) ) & 7;
//pSpace += nOff;
//szSpace -= nOff;
//nByte = ROUND8( sizeof( UnpackedRecord ) ) + sizeof( Mem ) * ( pKeyInfo->nField + 1 );
//if ( nByte > szSpace)
//{
//var p = new UnpackedRecord();//sqlite3DbMallocRaw(pKeyInfo.db, nByte);
// if ( p == null ) return null;
// p.flags = UNPACKED_NEED_FREE | UNPACKED_NEED_DESTROY;
//}
//else
{
p = pSpace;//(UnpackedRecord)pSpace;
p.flags = UNPACKED_NEED_DESTROY;
}
p.pKeyInfo = pKeyInfo;
p.nField = (u16)( pKeyInfo.nField + 1 );
//p->aMem = pMem = (Mem)&( (char)p )[ROUND8( sizeof( UnpackedRecord ) )];
//Debug.Assert( EIGHT_BYTE_ALIGNMENT( pMem ) );
p.aMem = new Mem[p.nField + 1];
idx = (u32)getVarint32( aKey, 0, out szHdr );// GetVarint( aKey, szHdr );
d = (int)szHdr;
u = 0;
while ( idx < (int)szHdr && u < p.nField && d <= nKey )
{
p.aMem[u] = sqlite3Malloc( p.aMem[u] );
pMem = p.aMem[u];
u32 serial_type = 0;
idx += (u32)getVarint32( aKey, idx, out serial_type );// GetVarint( aKey + idx, serial_type );
pMem.enc = pKeyInfo.enc;
pMem.db = pKeyInfo.db;
/* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
//pMem.zMalloc = null;
d += (int)sqlite3VdbeSerialGet( aKey, d, serial_type, pMem );
//pMem++;
u++;
}
Debug.Assert( u <= pKeyInfo.nField + 1 );
p.nField = (u16)u;
return p;// (void)p;
}
开发者ID:jdhardy,项目名称:ironpython,代码行数:78,代码来源:vdbeaux_c.cs
示例17: multiSelectOrderBy
//.........这里部分代码省略.........
Select p, /* The right-most of SELECTs to be coded */
SelectDest pDest /* What to do with query results */
)
{
int i, j; /* Loop counters */
Select pPrior; /* Another SELECT immediately to our left */
Vdbe v; /* Generate code to this VDBE */
SelectDest destA = new SelectDest(); /* Destination for coroutine A */
SelectDest destB = new SelectDest(); /* Destination for coroutine B */
int regAddrA; /* Address register for select-A coroutine */
int regEofA; /* Flag to indicate when select-A is complete */
int regAddrB; /* Address register for select-B coroutine */
int regEofB; /* Flag to indicate when select-B is complete */
int addrSelectA; /* Address of the select-A coroutine */
int addrSelectB; /* Address of the select-B coroutine */
int regOutA; /* Address register for the output-A subroutine */
int regOutB; /* Address register for the output-B subroutine */
int addrOutA; /* Address of the output-A subroutine */
int addrOutB = 0; /* Address of the output-B subroutine */
int addrEofA; /* Address of the select-A-exhausted subroutine */
int addrEofB; /* Address of the select-B-exhausted subroutine */
int addrAltB; /* Address of the A<B subroutine */
int addrAeqB; /* Address of the A==B subroutine */
int addrAgtB; /* Address of the A>B subroutine */
int regLimitA; /* Limit register for select-A */
int regLimitB; /* Limit register for select-A */
int regPrev; /* A range of registers to hold previous output */
int savedLimit; /* Saved value of p.iLimit */
int savedOffset; /* Saved value of p.iOffset */
int labelCmpr; /* Label for the start of the merge algorithm */
int labelEnd; /* Label for the end of the overall SELECT stmt */
int j1; /* Jump instructions that get retargetted */
int op; /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */
KeyInfo pKeyDup = null; /* Comparison information for duplicate removal */
KeyInfo pKeyMerge; /* Comparison information for merging rows */
sqlite3 db; /* Database connection */
ExprList pOrderBy; /* The ORDER BY clause */
int nOrderBy; /* Number of terms in the ORDER BY clause */
int[] aPermute; /* Mapping from ORDER BY terms to result set columns */
#if !SQLITE_OMIT_EXPLAIN
int iSub1 = 0; /* EQP id of left-hand query */
int iSub2 = 0; /* EQP id of right-hand query */
#endif
Debug.Assert( p.pOrderBy != null );
Debug.Assert( pKeyDup == null ); /* "Managed" code needs this. Ticket #3382. */
db = pParse.db;
v = pParse.pVdbe;
Debug.Assert( v != null ); /* Already thrown the error if VDBE alloc failed */
labelEnd = sqlite3VdbeMakeLabel( v );
labelCmpr = sqlite3VdbeMakeLabel( v );
/* Patch up the ORDER BY clause
*/
op = p.op;
pPrior = p.pPrior;
Debug.Assert( pPrior.pOrderBy == null );
pOrderBy = p.pOrderBy;
Debug.Assert( pOrderBy != null );
nOrderBy = pOrderBy.nExpr;
/* For operators other than UNION ALL we have to make sure that
** the ORDER BY clause covers every term of the result set. Add
** terms to the ORDER BY clause as necessary.
*/
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:67,代码来源:select_c.cs
示例18: multiSelect
//.........这里部分代码省略.........
p.pOffset = pOffset;
/* Generate code to take the intersection of the two temporary
** tables.
*/
Debug.Assert( p.pEList != null );
if ( dest.eDest == SRT_Output )
{
Select pFirst = p;
while ( pFirst.pPrior != null )
pFirst = pFirst.pPrior;
generateColumnNames( pParse, null, pFirst.pEList );
}
iBreak = sqlite3VdbeMakeLabel( v );
iCont = sqlite3VdbeMakeLabel( v );
computeLimitRegisters( pParse, p, iBreak );
sqlite3VdbeAddOp2( v, OP_Rewind, tab1, iBreak );
r1 = sqlite3GetTempReg( pParse );
iStart = sqlite3VdbeAddOp2( v, OP_RowKey, tab1, r1 );
sqlite3VdbeAddOp4Int( v, OP_NotFound, tab2, iCont, r1, 0 );
sqlite3ReleaseTempReg( pParse, r1 );
selectInnerLoop( pParse, p, p.pEList, tab1, p.pEList.nExpr,
null, -1, dest, iCont, iBreak );
sqlite3VdbeResolveLabel( v, iCont );
sqlite3VdbeAddOp2( v, OP_Next, tab1, iStart );
sqlite3VdbeResolveLabel( v, iBreak );
sqlite3VdbeAddOp2( v, OP_Close, tab2, 0 );
sqlite3VdbeAddOp2( v, OP_Close, tab1, 0 );
break;
}
}
explainComposite( pParse, p.op, iSub1, iSub2, p.op != TK_ALL );
/* Compute collating sequences used by
** temporary tables needed to implement the compound select.
** Attach the KeyInfo structure to all temporary tables.
**
** This section is run by the right-most SELECT statement only.
** SELECT statements to the left always skip this part. The right-most
** SELECT might also skip this part if it has no ORDER BY clause and
** no temp tables are required.
*/
if ( ( p.selFlags & SF_UsesEphemeral ) != 0 )
{
int i; /* Loop counter */
KeyInfo pKeyInfo; /* Collating sequence for the result set */
Select pLoop; /* For looping through SELECT statements */
CollSeq apColl; /* For looping through pKeyInfo.aColl[] */
int nCol; /* Number of columns in result set */
Debug.Assert( p.pRightmost == p );
nCol = p.pEList.nExpr;
pKeyInfo = new KeyInfo(); //sqlite3DbMallocZero(db,
pKeyInfo.aColl = new CollSeq[nCol]; //sizeof(*pKeyInfo)+nCol*(CollSeq*.Length + 1));
//if ( pKeyInfo == null )
//{
// rc = SQLITE_NOMEM;
// goto multi_select_end;
//}
pKeyInfo.enc = db.aDbStatic[0].pSchema.enc;// ENC( pParse.db );
pKeyInfo.nField = (u16)nCol;
for ( i = 0; i < nCol; i++ )
{//, apColl++){
apColl = multiSelectCollSeq( pParse, p, i );
if ( null == apColl )
{
apColl = db.pDfltColl;
}
pKeyInfo.aColl[i] = apColl;
}
for ( pLoop = p; pLoop != null; pLoop = pLoop.pPrior )
{
for ( i = 0; i < 2; i++ )
{
int addr = pLoop.addrOpenEphm[i];
if ( addr < 0 )
{
/* If [0] is unused then [1] is also unused. So we can
** always safely abort as soon as the first unused slot is found */
Debug.Assert( pLoop.addrOpenEphm[1] < 0 );
break;
}
sqlite3VdbeChangeP2( v, addr, nCol );
sqlite3VdbeChangeP4( v, addr, pKeyInfo, P4_KEYINFO );
pLoop.addrOpenEphm[i] = -1;
}
}
sqlite3DbFree( db, ref pKeyInfo );
}
multi_select_end:
pDest.iMem = dest.iMem;
pDest.nMem = dest.nMem;
sqlite3SelectDelete( db, ref pDelete );
return rc;
}
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:101,代码来源:select_c.cs
示例19: SQLiteKeyReader
/// <summary>
/// This function does all the nasty work at determining what keys need to be returned for
/// a given statement.
/// </summary>
/// <param name="cnn"></param>
/// <param name="reader"></param>
/// <param name="stmt"></param>
internal SQLiteKeyReader(SQLiteConnection cnn, SQLiteDataReader reader, SQLiteStatement stmt)
{
Dictionary<string, int> catalogs = new Dictionary<string, int>();
Dictionary<string, List<string>> tables = new Dictionary<string, List<string>>();
List<string> list;
List<KeyInfo> keys = new List<KeyInfo>();
// Record the statement so we can use it later for sync'ing
_stmt = stmt;
// Fetch all the attached databases on this connection
using (DataTable tbl = cnn.GetSchema("Catalogs"))
{
foreach (DataRow row in tbl.Rows)
{
catalogs.Add((string)row["CATALOG_NAME"], Convert.ToInt32(row["ID"], CultureInfo.InvariantCulture));
}
}
// Fetch all the unique tables and catalogs used by the current statement
using (DataTable schema = reader.GetSchemaTable(false, false))
{
foreach (DataRow row in schema.Rows)
{
// Check if column is backed to a table
if (row[SchemaTableOptionalColumn.BaseCatalogName] == DBNull.Value)
continue;
// Record the unique table so we can look up its keys
string catalog = (string)row[SchemaTableOptionalColumn.BaseCatalogName];
string table = (string)row[SchemaTableColumn.BaseTableName];
if (tables.ContainsKey(catalog) == false)
{
list = new List<string>();
tables.Add(catalog, list);
}
else
list = tables[catalog];
if (list.Contains(table) == false)
list.Add(table);
}
// For each catalog and each table, query the indexes for the table.
// Find a primary key index if there is one. If not, find a unique index instead
foreach (KeyValuePair<string, List<string>> pair in tables)
{
for (int i = 0; i < pair.Value.Count; i++)
{
string table = pair.Value[i];
DataRow preferredRow = null;
using (DataTable tbl = cnn.GetSchema("Indexes", new string[] { pair.Key, null, table }))
{
// Loop twice. The first time looking for a primary key index,
// the second time looking for a unique index
for (int n = 0; n < 2 && preferredRow == null; n++)
{
foreach (DataRow row in tbl.Rows)
{
if (n == 0 && (bool)row["PRIMARY_KEY"] == true)
{
preferredRow = row;
break;
}
else if (n == 1 && (bool)row["UNIQUE"] == true)
{
preferredRow = row;
break;
}
}
}
if (preferredRow == null) // Unable to find any suitable index for this table so remove it
{
pair.Value.RemoveAt(i);
i--;
}
else // We found a usable index, so fetch the necessary table details
{
using (DataTable tblTables = cnn.GetSchema("Tables", new string[] { pair.Key, null, table }))
{
// Find the root page of the table in the current statement and get the cursor that's iterating it
int database = catalogs[pair.Key];
int rootPage = Convert.ToInt32(tblTables.Rows[0]["TABLE_ROOTPAGE"], CultureInfo.InvariantCulture);
int cursor = stmt._sql.GetCursorForTable(stmt, database, rootPage);
// Now enumerate the members of the index we're going to use
using (DataTable indexColumns = cnn.GetSchema("IndexColumns", new string[] { pair.Key, null, table, (string)preferredRow["INDEX_NAME"] }))
{
KeyQuery query = null;
List<string> cols = new List<string>();
for (int x = 0; x < indexColumns.Rows.Count; x++)
//.........这里部分代码省略.........
开发者ID:yingfangdu,项目名称:SQLiteNet,代码行数:101,代码来源:SQLiteKeyReader.cs
示例20: Initialize
// Use this for initialization
public void Initialize(KeyInfo [] animKeys)
{
Keys = new KeyInfo[animKeys.Length];
for(int i = 0; i < animKeys.Length ; i++){
Keys[i] = animKeys[i];
}
_keyCnt = Keys.Length - 2 ; // -1 because keys 0 and keys.length-1 are the same, -2 because the last frame gives extreme results
//Alloc space according to keyframe count
for(int i = 0; i < 2; i++) {
SpaceMetric[i] = new float[_keyCnt];
SpaceIndex[i] = new int[_keyCnt];
WeightMetric[i] = new float[_keyCnt];
WeightIndex[i] = new int[_keyCnt];
TimeMetric[i] = new float[_keyCnt];
TimeIndex[i] = new int[_keyCnt];
FlowMetric[i] = new float[_keyCnt -1]; //eliminate the last element as it is unnaturally big
FlowIndex[i] = new int[_keyCnt];
Curvature[i] = new float[_keyCnt];
//Initialize histograms
SpaceHist[i] = new float[NBins + 1];
TimeHist[i] = new float[NBins + 1];
FlowHist[i] = new float[NBins + 1];
WeightHist[i] = new float[NBins + 1];
CurvatureHist[i] = new float[NBins + 1];
for(int j = 0; j < NBins +1 ; j++) {
SpaceHist[i][j] = 0;
TimeHist[i][j] = 0;
FlowHist[i][j] = 0;
WeightHist[i][j] = 0;
CurvatureHist[i][j] = 0;
}
}
Segments.Clear();
KeySegments.Clear();
for(int i = 0; i < 10; i++) {
PostureMetric[i] = new float[_keyCnt]; // 10 angles for keyframes
PostureHist[i] = new float[NBins + 1];
for(int j = 0; j< NBins +1 ; j++)
PostureHist[i][j] = 0;
}
}
开发者ID:BibleUs,项目名称:Personality,代码行数:50,代码来源:Metrics.cs
注:本文中的KeyInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论