示例#1
0
 public void OpenQuery(string queryText, string baseUri)
 {
     MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;
     DataSourceTreeController dsController = mainWindow.DatasourceController;
     DocumentController docController = mainWindow.Controller;
     context = null;
     if (reader != null)
         reader.Close();            
     command = new Command(dsController.Dictionary);
     string searchPath = docController.SearchPath;
     if (!String.IsNullOrEmpty(baseUri) && !String.IsNullOrEmpty(searchPath))
         searchPath = baseUri + ";" + searchPath;
     command.SearchPath = searchPath;
     command.CommandText = queryText;
     command.BeforeExecute += new QueryExecuteDelegate(command_BeforeExecute);
 }
示例#2
0
 private void command_BeforeExecute(Command source, Notation notation, Optimizer optimizer, QueryContext context)
 {
     this.context = context;
     Notation.Record[] recs = notation.Select(Descriptor.Root, 1);
     if (recs.Length > 0)
     {
         Notation.Record[] recsd = notation.Select(recs[0].Arg0, Descriptor.Binding, 1);
         if (recsd.Length > 0)
             throw new ESQLException("Query parameters is not supported in XQueryConsole", null);
     }
     if (context.UseSampleData)
     {
         String path = Path.Combine(
             Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Data");
         if (Directory.Exists(path))
             context.DatabaseDictionary.SearchPath = path;                
     }
 }
示例#3
0
 public void CloseQuery()
 {
     if (reader != null)
     {
         reader.Close();
         reader = null;
         command = null;
         context = null;
     }
 }