GetKeyValuePair() static private method

static private GetKeyValuePair ( string connectionString, int currentPosition, StringBuilder buffer, bool useOdbcRules, string &keyname, string &keyvalue ) : int
connectionString string
currentPosition int
buffer StringBuilder
useOdbcRules bool
keyname string
keyvalue string
return int
Exemplo n.º 1
0
        private static string[] ParseRestrictions(string restrictions, Hashtable synonyms)
        {
#if DEBUG
            DataCommonEventSource.Log.Trace("<comm.DBConnectionString|INFO|ADV> Restrictions='{0}'", restrictions);
#endif
            List <string> restrictionValues = new List <string>();
            StringBuilder buffer            = new StringBuilder(restrictions.Length);

            int nextStartPosition = 0;
            int endPosition       = restrictions.Length;
            while (nextStartPosition < endPosition)
            {
                int startPosition = nextStartPosition;

                string keyname, keyvalue; // since parsing restrictions ignores values, it doesn't matter if we use ODBC rules or OLEDB rules
                nextStartPosition = DbConnectionOptions.GetKeyValuePair(restrictions, startPosition, buffer, false, out keyname, out keyvalue);
                if (!string.IsNullOrEmpty(keyname))
                {
#if DEBUG
                    DataCommonEventSource.Log.Trace("<comm.DBConnectionString|INFO|ADV> KeyName='{0}'", keyname);
#endif
                    string realkeyname = ((null != synonyms) ? (string)synonyms[keyname] : keyname);
                    if (string.IsNullOrEmpty(realkeyname))
                    {
                        throw ADP.KeywordNotSupported(keyname);
                    }
                    restrictionValues.Add(realkeyname);
                }
            }
            return(RemoveDuplicates(restrictionValues.ToArray()));
        }
Exemplo n.º 2
0
        private static string[] ParseRestrictions(string restrictions, Dictionary <string, string> synonyms)
        {
            List <string> restrictionValues = new List <string>();
            StringBuilder buffer            = new StringBuilder(restrictions.Length);

            int nextStartPosition = 0;
            int endPosition       = restrictions.Length;

            while (nextStartPosition < endPosition)
            {
                int startPosition = nextStartPosition;

                string keyname, keyvalue; // since parsing restrictions ignores values, it doesn't matter if we use ODBC rules or OLEDB rules
                nextStartPosition = DbConnectionOptions.GetKeyValuePair(restrictions, startPosition, buffer, false, out keyname, out keyvalue);
                if (!string.IsNullOrEmpty(keyname))
                {
                    string realkeyname = ((null != synonyms) ? (string)synonyms[keyname] : keyname); // MDAC 85144
                    if (string.IsNullOrEmpty(realkeyname))
                    {
                        throw ADP.KeywordNotSupported(keyname);
                    }
                    restrictionValues.Add(realkeyname);
                }
            }
            return(RemoveDuplicates(restrictionValues.ToArray()));
        }
Exemplo n.º 3
0
        private static string[] ParseRestrictions(string restrictions, Hashtable synonyms)
        {
            List <string> list   = new List <string>();
            StringBuilder buffer = new StringBuilder(restrictions.Length);
            int           num    = 0;
            int           length = restrictions.Length;

            while (num < length)
            {
                string str;
                string str3;
                int    currentPosition = num;
                num = DbConnectionOptions.GetKeyValuePair(restrictions, currentPosition, buffer, false, out str, out str3);
                if (!ADP.IsEmpty(str))
                {
                    string str2 = (synonyms != null) ? ((string)synonyms[str]) : str;
                    if (ADP.IsEmpty(str2))
                    {
                        throw ADP.KeywordNotSupported(str);
                    }
                    list.Add(str2);
                }
            }
            return(RemoveDuplicates(list.ToArray()));
        }