Ejemplo n.º 1
0
 /// <summary>
 /// Set the Index to the specified offset from the origin.
 /// </summary>
 /// <param name="results">The resultset.</param>
 /// <param name="origin">The origin to move from</param>
 /// <param name="offset">The offset to move the index by.</param>
 /// <returns>True if successful.</returns>
 internal bool SetIndex(FlaimResultSet results, IndexOrigin origin, int offset)
 {
     return(FWSetListIndex(results.ResultSet, origin, offset));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Close the search and free any resources.
 /// </summary>
 /// <param name="results">The resultset to close.</param>
 internal void CloseSearch(FlaimResultSet results)
 {
     FWCloseSearch(results.ResultSet);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// The the next objects. This will fill the buffer or read to the end.
 /// </summary>
 /// <param name="results">The resultset.</param>
 /// <param name="buffer">The buffer to fill.</param>
 /// <returns></returns>
 internal int GetNextObjectList(FlaimResultSet results, ref char[] buffer)
 {
     return(FWGetNextObjectList(results.ResultSet, pStore, buffer, buffer.Length));
 }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="queryArray">Queries used for this search</param>
        /// <param name="results"></param>
        /// <param name="flaimServer"></param>
        /// <returns></returns>
        internal FlaimError.Error MQSearch(Query[] queryArray, out FlaimResultSet results, FlaimServer flaimServer)
        {
            FlaimError.Error rc = FlaimError.Error.FERR_OK;

            results = null;
            int    count         = 0;
            IntPtr pFlaimResults = new IntPtr();

            int[]    op            = new int[queryArray.Length];
            string[] sValue        = new String[queryArray.Length];
            string[] sName         = new String[queryArray.Length];
            string[] sType         = new String[queryArray.Length];
            int      caseSensitive = 0;
            int      arrayIndex    = 0;

            foreach (Query qry in queryArray)
            {
                sValue[arrayIndex] = String.Copy(qry.Value);
                sName[arrayIndex]  = String.Copy(qry.Property);
                sType[arrayIndex]  = String.Copy(qry.Type.ToString());
                switch (qry.Operation)
                {
                case SearchOp.Equal:
                    op[arrayIndex] = 103;                                       // FLM_EQ_OP
                    break;

                case SearchOp.Not_Equal:
                    op[arrayIndex] = 108;                                       // FLM_NE_OP
                    break;

                case SearchOp.Begins:
                    op[arrayIndex] = 105;                                       // FLM_MATCH_BEGIN_OP
                    break;

                case SearchOp.Ends:
                    op[arrayIndex] = 106;                                       // FLM_MATCH_END_OP
                    break;

                case SearchOp.Contains:
                    op[arrayIndex] = 107;                                       // FLM_CONTAINS_OP
                    break;

                case SearchOp.Greater:
                    op[arrayIndex] = 111;                                       // FLM_GT_OP
                    break;

                case SearchOp.Less:
                    op[arrayIndex] = 109;                                       // FLM_LT_OP
                    break;

                case SearchOp.Greater_Equal:
                    op[arrayIndex] = 112;                                       // FLM_GE_OP
                    break;

                case SearchOp.Less_Equal:
                    op[arrayIndex] = 110;                                       // FLM_LE_OP
                    break;

                case SearchOp.Exists:
                    switch (qry.Type)
                    {
                    case Syntax.Boolean:
                        op[arrayIndex]     = 112;
                        sValue[arrayIndex] = "0";
                        break;

                    case Syntax.Byte:
                    case Syntax.Char:
                    case Syntax.DateTime:
                    case Syntax.Int16:
                    case Syntax.Int32:
                    case Syntax.Int64:
                    case Syntax.SByte:
                    case Syntax.TimeSpan:
                    case Syntax.UInt16:
                    case Syntax.UInt32:
                    case Syntax.UInt64:
                        op[arrayIndex]     = 111;                                               // FLM_GT_OP
                        sValue[arrayIndex] = Int64.MinValue.ToString();
                        break;

                    case Syntax.Relationship:
                    case Syntax.String:
                    case Syntax.Uri:
                    case Syntax.XmlDocument:
                        op[arrayIndex]     = 105;
                        sValue[arrayIndex] = "*";
                        break;

                    case Syntax.Single:
                        op[arrayIndex]     = 111;                                               // FLM_GT_OP
                        sValue[arrayIndex] = Single.MinValue.ToString();
                        break;
                    }
                    break;

                case SearchOp.CaseEqual:
                    caseSensitive  = 1;
                    op[arrayIndex] = 103;                                       // FLM_EQ_OP
                    break;
                }

                if (arrayIndex++ >= 3)
                {
                    break;
                }
            }


            if (op[0] != 0)
            {
                if (queryArray.Length == 1)
                {
                    rc = FWMQSearch(pStore, queryArray[0].CollectionId, sName[0], op[0], sValue[0], sType[0], null, 0, null, null, null, 0, null, null, null, 0, null, null, (int)1, caseSensitive, out count, out pFlaimResults);
                }
                else if (queryArray.Length == 2)
                {
                    rc = FWMQSearch(pStore, queryArray[0].CollectionId, sName[0], op[0], sValue[0], sType[0], sName[1], op[1], sValue[1], sType[1], null, 0, null, null, null, 0, null, null, (int)2, caseSensitive, out count, out pFlaimResults);
                }
                else if (queryArray.Length == 3)
                {
                    rc = FWMQSearch(pStore, queryArray[0].CollectionId, sName[0], op[0], sValue[0], sType[0], sName[1], op[1], sValue[1], sType[1], sName[2], op[2], sValue[2], sType[2], null, 0, null, null, (int)3, caseSensitive, out count, out pFlaimResults);
                }
                else if (queryArray.Length == 4)
                {
                    rc = FWMQSearch(pStore, queryArray[0].CollectionId, sName[0], op[0], sValue[0], sType[0], sName[1], op[1], sValue[1], sType[1], sName[2], op[2], sValue[2], sType[2], sName[3], op[3], sValue[3], sType[3], (int)4, caseSensitive, out count, out pFlaimResults);
                }
                if (FlaimError.IsSuccess(rc))
                {
                    results = new FlaimResultSet(pFlaimResults, count, flaimServer);
                }
            }

            return(rc);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="query"></param>
        /// <param name="results"></param>
        /// <param name="flaimServer"></param>
        /// <returns></returns>
        internal FlaimError.Error Search(Query query, out FlaimResultSet results, FlaimServer flaimServer)
        {
            FlaimError.Error rc = FlaimError.Error.FERR_OK;

            results = null;
            int    count;
            IntPtr pFlaimResults;
            int    op            = 0;
            string sValue        = query.Value;
            int    caseSensitive = 0;

            switch (query.Operation)
            {
            case SearchOp.Equal:
                op = 103;                                       // FLM_EQ_OP
                break;

            case SearchOp.Not_Equal:
                op = 108;                                       // FLM_NE_OP
                break;

            case SearchOp.Begins:
                op = 105;                                       // FLM_MATCH_BEGIN_OP
                break;

            case SearchOp.Ends:
                op = 106;                                       // FLM_MATCH_END_OP
                break;

            case SearchOp.Contains:
                op = 107;                                       // FLM_CONTAINS_OP
                break;

            case SearchOp.Greater:
                op = 111;                                       // FLM_GT_OP
                break;

            case SearchOp.Less:
                op = 109;                                       // FLM_LT_OP
                break;

            case SearchOp.Greater_Equal:
                op = 112;                                       // FLM_GE_OP
                break;

            case SearchOp.Less_Equal:
                op = 110;                                       // FLM_LE_OP
                break;

            case SearchOp.Exists:
                switch (query.Type)
                {
                case Syntax.Boolean:
                    op     = 112;
                    sValue = "0";
                    break;

                case Syntax.Byte:
                case Syntax.Char:
                case Syntax.DateTime:
                case Syntax.Int16:
                case Syntax.Int32:
                case Syntax.Int64:
                case Syntax.SByte:
                case Syntax.TimeSpan:
                case Syntax.UInt16:
                case Syntax.UInt32:
                case Syntax.UInt64:
                    op     = 111;                                               // FLM_GT_OP
                    sValue = Int64.MinValue.ToString();
                    break;

                case Syntax.Relationship:
                case Syntax.String:
                case Syntax.Uri:
                case Syntax.XmlDocument:
                    op     = 105;
                    sValue = "*";
                    break;

                case Syntax.Single:
                    op     = 111;                                               // FLM_GT_OP
                    sValue = Single.MinValue.ToString();
                    break;
                }
                break;

            case SearchOp.CaseEqual:
                caseSensitive = 1;
                op            = 103;                            // FLM_EQ_OP
                break;
            }

            if (op != 0)
            {
                rc = FWSearch(pStore, query.CollectionId, query.Property, op, sValue, query.Type.ToString(), caseSensitive, out count, out pFlaimResults);
                if (FlaimError.IsSuccess(rc))
                {
                    results = new FlaimResultSet(pFlaimResults, count, flaimServer);
                }
            }

            return(rc);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Close the search and free any resources.
 /// </summary>
 /// <param name="results">The resultset to close.</param>
 internal void CloseSearch(FlaimResultSet results)
 {
     Flaim.CloseSearch(results);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Set the Index to the specified offset from the origin.
 /// </summary>
 /// <param name="results">The resultset.</param>
 /// <param name="origin">The origin to move from</param>
 /// <param name="offset">The offset to move the index by.</param>
 /// <returns>True if successful.</returns>
 public bool SetIndex(FlaimResultSet results, IndexOrigin origin, int offset)
 {
     return(Flaim.SetIndex(results, origin, offset));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Method to return the next set of objects.
 /// All the objects that can fit in the buffer will be returned.
 /// returns false when no more objects exist.
 /// </summary>
 /// <param name="results"></param>
 /// <param name="buffer">Buffer used to return the objects.</param>
 /// <returns>true - objects returned. false - no more objects</returns>
 public int GetNext(FlaimResultSet results, ref char[] buffer)
 {
     return(Flaim.GetNextObjectList(results, ref buffer));
 }