public class IndexViewExample extends Object
IndexViewExample has 8 major commands:
IndexViewExample -loaddata -file <dir_data_file> ...The <-file> argument is used to specify the path of data file. When the load is completed the count of records is output.
IndexViewExample -buildindex -name <field_name> ...This command also supports building multi-column indexes. For example,
IndexViewExample -buildindex -name <field_name1>,<field_name2>,...
IndexViewExample -dropindex -name <field_name>This command also supports dropping multi-column indexes. For example,
IndexViewExample -dropindex -name <field_name1>,<field_name2>,...
IndexViewExample -insert -key <primary_key_value> -value <field_name1>=<field_value1>, <field_name2>=<field_value2>,...The <-key> argument must be set to the value of primary key field -- "id" in this particular example -- which is the unique identifier of a BillInfo record. Any BillInfo fields that are not specified are set to their default values.
IndexViewExample -update -key <primary_key_value> -value <field_name1>=<field_value1>, <field_name2>=<field_value2>,...This command also supports updating multi-column indexes. For example,
IndexViewExample -update -seckey <field_name1>=<field_value1>, <field_name2>=<field_value2>,... -value <field_name1>=<field_value1>, <field_name2>=<field_value2>,...All primary DB records that are located using the given Index View key are updated.
IndexViewExample -delete -key <primary_key_value>This command also supports deletion using multi-column indexes. For example,
IndexViewExample -delete -seckey <field_name1>=<field_value1>, <field_name2>=<field_value2>,...
IndexViewExample -query -seckey <field_name1>=<field_value1>, <field_name2>=<field_value2>,...This command performs the query using both the Index View and a scan of all primary DB records. The wall clock to perform both operations is output.
IndexViewExample -showindexTo run the example, start a KVStore instance. A simple way is to run KVLite as described in the Oracle NoSQL Database Installation document. After starting the KVStore instance, the Avro schemas used by the example must be added to the store using the administration command line interface (CLI). Start the admin CLI as described in the Oracle NoSQL Database Administrator's Guide. Then enter the following commands to add the example schema:
kv-> ddl add-schema -file billinfo-schema.avscAfter adding the schema, use the KVStore instance name, host and port for running the example. e.g. in a -loaddata command:
IndexViewExample -loaddata -host <host_name default: localhost> -port <port default: 5000> -store <store_name default: kvstore>In this package the default data file is "example_data.csv" which has 4000 records. If more data is required, use the "datagenerator" tool to generate more. For more information, see http://www.generatedata.com.
Modifier and Type | Class and Description |
---|---|
(package private) class |
IndexViewExample.ExecutorParser
Parses command line arguments.
|
(package private) static class |
IndexViewExample.Operation |
Constructor and Description |
---|
IndexViewExample() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
buildIndexes()
Builds Index View(s) for the fields supplied on the command line.
|
(package private) void |
deleteRecord()
Deletes record(s) in the primary DB and any related Index View record(s).
|
(package private) void |
dropIndexes()
Drops Index View(s) on the fields supplied on the command line.
|
(package private) void |
handle(IndexViewExample.Operation operation) |
(package private) void |
init(String[] argv) |
(package private) void |
insertRecord()
Inserts a record into primary DB and creates Index View record(s).
|
(package private) void |
loadData()
Loads records.
|
static void |
main(String[] argv) |
(package private) void |
queryRecord()
Retrieves the primary DB record(s) associated with the Index View key
argument(s).
|
(package private) void |
runExample(String[] argv) |
(package private) void |
showIndex()
Outputs field names, schema name and current status of all Index Views
in Oracle NoSQL Database.
|
(package private) void |
updateRecord()
Updates records in the primary DB and any related Index View record(s).
|
void init(String[] argv)
void handle(IndexViewExample.Operation operation)
void loadData() throws IOException
IOException
void buildIndexes()
void dropIndexes()
void insertRecord()
void updateRecord()
void deleteRecord()
void queryRecord()
void showIndex()
void runExample(String[] argv)
public static void main(String[] argv)
Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.