int main(int argc, char *argv[]) { WT_CONNECTION *conn; WT_SESSION *session; home = example_setup(argc, argv); /* Open a connection to the database, creating it if necessary. */ error_check(wiredtiger_open(home, NULL, "create", &conn)); /*! [add collator nocase] */ error_check(conn->add_collator(conn, "nocase", &nocasecoll, NULL)); /*! [add collator nocase] */ /*! [add collator prefix10] */ error_check(conn->add_collator(conn, "prefix10", &pcoll10.iface, NULL)); /* Open a session for the current thread's work. */ error_check(conn->open_session(conn, NULL, NULL, &session)); /* Do some work... */ error_check(conn->close(conn, NULL)); /*! [add collator prefix10] */ return (EXIT_SUCCESS); }
int main(void) { int ret; WT_CONNECTION *conn; WT_SESSION *session; /* * Create a clean test directory for this run of the test program if the * environment variable isn't already set (as is done by make check). */ if (getenv("WIREDTIGER_HOME") == NULL) { home = "WT_HOME"; ret = system("rm -rf WT_HOME && mkdir WT_HOME"); } else home = NULL; /* Open a connection to the database, creating it if necessary. */ if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0) fprintf(stderr, "Error connecting to %s: %s\n", home == NULL ? "." : home, wiredtiger_strerror(ret)); /*! [add collator nocase] */ ret = conn->add_collator(conn, "nocase", &nocasecoll, NULL); /*! [add collator nocase] */ /*! [add collator prefix10] */ ret = conn->add_collator(conn, "prefix10", &pcoll10.iface, NULL); /* Open a session for the current thread's work. */ if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0) fprintf(stderr, "Error opening a session on %s: %s\n", home == NULL ? "." : home, wiredtiger_strerror(ret)); /* Do some work... */ ret = conn->close(conn, NULL); /*! [add collator prefix10] */ return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE); }