Esempio n. 1
0
        public ObjectName ResolveTableName(string name)
        {
            var schema = Session.CurrentSchema;

            if (String.IsNullOrEmpty(schema))
            {
                throw new InvalidOperationException("Default schema not specified in the query.");
            }

            var objSchemaName = ResolveSchemaName(schema);

            if (objSchemaName == null)
            {
                throw new InvalidOperationException(
                          String.Format("The default schema of the session '{0}' is not defined in the database.", schema));
            }

            ObjectName objName;

            if (!ObjectName.TryParse(name, out objName))
            {
                throw new ArgumentException(String.Format("The name '{0}' is invalid.", name));
            }

            if (objName.Parent == null)
            {
                objName = new ObjectName(objSchemaName, objName.Name);
            }

            return(ResolveTableName(objName));
        }
Esempio n. 2
0
        public void GetSqlFromName()
        {
            ObjectName name;

            Assert.True(ObjectName.TryParse("a.*", out name));

            Assert.Equal("a.*", name.ToString());
        }
Esempio n. 3
0
        public void ParseGlobName()
        {
            ObjectName name;

            Assert.True(ObjectName.TryParse("a.*", out name));

            Assert.Equal("a.*", name.FullName);
            Assert.NotNull(name.Parent);
            Assert.NotNull(name.ParentName);
            Assert.Equal("*", name.Name);
            Assert.Equal("a", name.ParentName);
            Assert.True(name.IsGlob);
        }
Esempio n. 4
0
        public void ParseComposedName()
        {
            ObjectName name;

            Assert.True(ObjectName.TryParse("a.b", out name));

            Assert.Equal("a.b", name.FullName);
            Assert.NotNull(name.Parent);
            Assert.NotNull(name.ParentName);
            Assert.Equal("b", name.Name);
            Assert.Equal("a", name.ParentName);
            Assert.False(name.IsGlob);
        }