Permalink
Browse files

Fixed do_postgres README indentation and added syntax highlighting

  • Loading branch information...
1 parent cab2e27 commit c8e9afb69dec27a14ea1bebe819523951b942295 @parndt parndt committed May 1, 2013
View
@@ -15,9 +15,11 @@ This driver is currently provided only for JRuby.
An example of usage:
- @connection = DataObjects::Connection.new("derby://employees")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+```ruby
+@connection = DataObjects::Connection.new("derby://employees")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
The `Connection` constructor should be passed either a DataObjects-style URL or
JDBC-style URL:
View
@@ -15,9 +15,11 @@ This driver is currently provided only for JRuby.
An example of usage:
- @connection = DataObjects::Connection.new("h2://employees")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+```ruby
+@connection = DataObjects::Connection.new("h2://employees")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
The `Connection` constructor should be passed either a DataObjects-style URL or
JDBC-style URL:
@@ -15,9 +15,11 @@ This driver is currently provided only for JRuby.
An example of usage:
- @connection = DataObjects::Connection.new("hsqldb://employees")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+```ruby
+@connection = DataObjects::Connection.new("hsqldb://employees")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
The `Connection` constructor should be passed either a DataObjects-style URL or
JDBC-style URL:
View
@@ -14,14 +14,16 @@ This driver implements the DataObjects API for the MySQL relational database.
An example of usage:
- # default user (root, no password); default port (3306)
- DataObjects::Connection.new("mysql://host/database")
- # specified user, specified port
- DataObjects::Connection.new("mysql://user:pass@host:8888/database")
-
- @connection = DataObjects::Connection.new("mysql://localhost/employees")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+```ruby
+# default user (root, no password); default port (3306)
+DataObjects::Connection.new("mysql://host/database")
+# specified user, specified port
+DataObjects::Connection.new("mysql://user:pass@host:8888/database")
+
+@connection = DataObjects::Connection.new("mysql://localhost/employees")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
## Requirements
@@ -26,9 +26,11 @@ This driver is currently provided only for JRuby.
An example of usage:
- @connection = DataObjects::Connection.new("openedge://localhost:4000/sports2000")
- @reader = @connection.create_command('SELECT * FROM State').execute_reader
- @reader.next!
+```ruby
+@connection = DataObjects::Connection.new("openedge://localhost:4000/sports2000")
+@reader = @connection.create_command('SELECT * FROM State').execute_reader
+@reader.next!
+```
The `Connection` constructor should be passed either a DataObjects-style URI or
JDBC-style URI:
@@ -14,9 +14,11 @@ This driver implements the DataObjects API for the Oracle relational database.
An example of usage:
- @connection = DataObjects::Connection.new("oracle://employees")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+```ruby
+@connection = DataObjects::Connection.new("oracle://employees")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
## Requirements
@@ -14,14 +14,16 @@ This driver implements the DataObjects API for the PostgreSQL relational databas
An example of usage:
- # default user (postgres, postgres), default port (5432)
- DataObjects::Connection.new("postgres://host/database")
- # specified user, specified port
- DataObjects::Connection.new("postgres://user:pass@host:8888/database")
+```ruby
+# default user (postgres, postgres), default port (5432)
+DataObjects::Connection.new("postgres://host/database")
+# specified user, specified port
+DataObjects::Connection.new("postgres://user:pass@host:8888/database")
- @connection = DataObjects::Connection.new("postgres://localhost/employees")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+@connection = DataObjects::Connection.new("postgres://localhost/employees")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
## Requirements
@@ -38,7 +40,9 @@ Additionally you should have the following prerequisites:
To install the gem:
- gem install do_postgres
+```ruby
+gem install do_postgres
+```
To compile and install from source:
@@ -59,15 +63,15 @@ To compile and install from source:
* Run `rake-compiler cross-ruby`.
* Run `rake-compiler update-config`.
- * For JRuby extensions:
- * Install the Java Development Kit (provided if you are
- on a recent version of Mac OS X) from <http://java.sun.com>.
- * Install a recent version of JRuby. Ensure `jruby` is in your `PATH` and/or
- you have configured the `JRUBY_HOME` environment variable to point to your
- JRuby installation.
- * Install `data_objects` and `do_jdbc` with `jruby -S rake install`.
+* For JRuby extensions:
+ * Install the Java Development Kit (provided if you are
+ on a recent version of Mac OS X) from <http://java.sun.com>.
+ * Install a recent version of JRuby. Ensure `jruby` is in your `PATH` and/or
+ you have configured the `JRUBY_HOME` environment variable to point to your
+ JRuby installation.
+ * Install `data_objects` and `do_jdbc` with `jruby -S rake install`.
- * Then, install this driver with `(jruby -S) rake install`.
+* Then, install this driver with `(jruby -S) rake install`.
For more information, see the PostgreSQL driver wiki page:
<http://wiki.github.com/datamapper/do/postgresql>.
@@ -14,9 +14,11 @@ This driver implements the DataObjects API for the SQLite3 relational database.
An example of usage:
- @connection = DataObjects::Connection.new("sqlite3://employees")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+```ruby
+@connection = DataObjects::Connection.new("sqlite3://employees")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
## Requirements
@@ -20,14 +20,16 @@ Problems with MRI implementation (unreleased):
Examples of usage:
- # default port (using SQL Server Express Edition)
- DataObjects::Connection.new('sqlserver://user:pass@host/database;instance=SQLEXPRESS')
- # port specified (using SQL Server Express Edition)
- DataObjects::Connection.new('sqlserver://user:pass@host:1433/database;instance=SQLEXPRESS')
-
- @connection = DataObjects::Connection.new("sqlserver://john:p3$$@localhost:1433/userinfo")
- @reader = @connection.create_command('SELECT * FROM users').execute_reader
- @reader.next!
+```ruby
+# default port (using SQL Server Express Edition)
+DataObjects::Connection.new('sqlserver://user:pass@host/database;instance=SQLEXPRESS')
+# port specified (using SQL Server Express Edition)
+DataObjects::Connection.new('sqlserver://user:pass@host:1433/database;instance=SQLEXPRESS')
+
+@connection = DataObjects::Connection.new("sqlserver://john:p3$$@localhost:1433/userinfo")
+@reader = @connection.create_command('SELECT * FROM users').execute_reader
+@reader.next!
+```
* See also the accompanying `CONNECTING.markdown`.
@@ -7,7 +7,9 @@ gem for you, by virtue of the RubyGems requirement system.
If you want to load this driver directly:
- require 'do_jdbc/sqlserver'
+```ruby
+require 'do_jdbc/sqlserver'
+```
to make the driver accessible to JDBC and DataObjects code running in JRuby.

0 comments on commit c8e9afb

Please sign in to comment.