Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  6. // PARTICULAR PURPOSE.
  7. //
  8. // Copyright (c) 1998-1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Sample Name: VJQuery - Sample Visual J++ Query Application
  11. //
  12. //--------------------------------------------------------------------------
  13. Description
  14. ===========
  15. The VJQuery sample is an example command-line application written in
  16. Visual J++ that illustrates how to query Indexing Service using the SQL
  17. query language and the ADO API.
  18. Path
  19. ====
  20. Source: mssdk\samples\winbase\indexing\VJQuery\
  21. User's Guide
  22. ============
  23. * To build the sample
  24. 1. In the Visual J++ development environment, open the
  25. VJQuery.vjp project from the source path of the sample.
  26. 2. In the Build menu, select Build.
  27. * To execute a default query using the sample
  28. 1. Make sure that Indexing Service is started.
  29. 2. In the Debug menu, select Start.
  30. 3. In the JView window, read the results of the default SQL query
  31. SELECT Filename, Size, Write, Path
  32. FROM SCOPE('DEEP TRAVERSAL OF "\"')
  33. WHERE CONTAINS('"Indexing Service"')
  34. * To specify a complete SQL statement for a query using the sample
  35. 1. Make sure that Indexing Service is started.
  36. 2. Set the PATH environment variable to include "D:\mssdk\Bin",
  37. where D: is the drive on which you installed the Platform SDK.
  38. 3. Open a command window and change the directory to the path of the
  39. built sample.
  40. 4. Formulate a query that you know will succeed. You need to know the
  41. machine, catalog, scope, and query text.
  42. 5. Submit a complete SQL statement by entering, at the command-line
  43. prompt,
  44. jview /p /cp:p "<JAVAPACKAGES>" VJQuery -s <Statement>
  45. where <Statement> is a complete SQL statement such as the
  46. preceding default SQL query. You must escape any double-quote
  47. characters in the text of the <Statement> parameter.
  48. * To specify only a WHERE clause for a query using the sample
  49. 1. Make sure that Indexing Service is started.
  50. 2. Set the PATH environment variable to include "D:\mssdk\Bin",
  51. where D: is the drive on which you installed the Platform SDK.
  52. 3. Open a command window and change the directory to the path of the
  53. built sample.
  54. 4. Formulate a query that you know will succeed. You need to know the
  55. machine, catalog, scope, and query text.
  56. 5. Submit text for a WHERE clause that is concatenated to the
  57. following incomplete, fixed SQL statement
  58. SELECT Filename, Size, Write, Path
  59. FROM SCOPE('DEEP TRAVERSAL OF "\"')
  60. WHERE
  61. by entering, at the command-line prompt,
  62. jview /p /cp:p "<JAVAPACKAGES>" VJQuery <Where_Text>
  63. where <Where_Text> is the desired text to follow the WHERE keyword.
  64. You must escape any double quotes in the text of the <Where_Text>
  65. parameter. For example, to duplicate the default SQL query, enter
  66. jview /p /cp:p "<JAVAPACKAGES>" VJQuery CONTAINS('\"Indexing Service\"')
  67. Programming Notes
  68. =================
  69. The Query class has methods that set the text of the query, execute the
  70. query, and display the results of the query.
  71. * Either the SetRawSql method or the SetSqlWhere method sets the
  72. m_SqlText variable to the specified SQL statement.
  73. * The Execute method executes the query. It creates an ADO Recordset
  74. object and executes the query by opening the object with the SQL text
  75. and the OLE DB Provider for Indexing Service.
  76. * The Display method enumerates the resulting values of the fields from
  77. the Recordset object and prints them.