Skip to content

Instantly share code, notes, and snippets.

@brandon-beacher
Created September 15, 2009 03:51
Show Gist options
  • Select an option

  • Save brandon-beacher/187101 to your computer and use it in GitHub Desktop.

Select an option

Save brandon-beacher/187101 to your computer and use it in GitHub Desktop.
#!/usr/bin/env narwhal
require("browser");
var dirname = require("file").path(module.path).dirname();
load(dirname + "/../lib/couch.js");
var db = new CouchDB();
db.uri = "http://localhost:5984/dfc/";
var url = "jdbc:mysql://localhost/dfc_development?user=root";
var connection = Packages.com.mysql.jdbc.Driver().connect(url, null);
var customers = connection.createStatement().executeQuery("select * from customers order by layout");
while (customers.next()) {
var customer = {};
customer._id = java.util.UUID.randomUUID().toString();
customer.type = "Customer";
customer.layout = customers.getString("layout");
db.save(customer);
}
customers.close();
connection.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment