Skip to content

ccouzens/activerecord-sqlanywhere-adapter

 
 

Repository files navigation

SQL Anywhere ActiveRecord Driver

This is a SQL Anywhere driver for Ruby ActiveRecord. This driver requires the native SQL Anywhere Ruby driver. To get the native driver, use:

   gem install sqlanywhere

This driver is designed for use with ActiveRecord 3.0.3 and greater.

This driver is licensed under the Apache License, Version 2.

Making a Connection

The following code is a sample database configuration object.

  ActiveRecord::Base.configurations = {
    'arunit' => {
      :adapter  => 'sqlanywhere', 
      :database => 'arunit',       #equivalent to the "DatabaseName" parameter
      :server   => 'arunit',       #equivalent to the "ServerName" parameter
      :username => 'dba',          #equivalent to the "UserID" parameter
      :password => 'sql',          #equivalent to the "Password" parameter
      :encoding => 'Windows-1252', #equivalent to the "CharSet" parameter
      :commlinks => 'TCPIP()',     #equivalent to the "Commlinks" parameter
      :connection_name => 'Rails'  #equivalent to the "ConnectionName" parameter
  }

Running the ActiveRecord Unit Test Suite

  1. Download https://github.com/ccouzens/rails and checkout the sqlanywhere_testing branch.

  2. Create the two test databases. These can be created in any directory.

    #!/usr/bin/env bash
    source /opt/sqlanywhere12/bin64/sa_config.sh
    if [ ! -e arunit.db ]
    then
        dbinit -c arunit
    fi
    if [ ! -e arunit2.db ]
    then
        dbinit -c arunit2
    fi
    dbsrv12 arunit arunit2 >/dev/null &
  1. Enter the custom Rails repository.

  2. Run bundle with SQLANYWHERE

      SQLANYWHERE=sqlanywhere bundle
  1. Enter the activerecord directory.

  2. Run the unit test suite from the ActiveRecord install directory:

      SQLANYWHERE=sqlanywhere rake test_sqlanywhere

If the migration tests fail, make sure you have set up the SQL Anywhere environment variables correctly. For more information review the online documentation here.

About

An adapter that allows ActiveRecord to communicate with SQL Anywhere

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 98.7%
  • Shell 1.3%