Created
December 12, 2010 19:42
-
-
Save libc/738267 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Connecting directly to the postgresql server | |
| Setting standard_conforming_strings to off | |
| standard_conforming_strings = off | |
| escape of \" is \\" | |
| Setting standard_conforming_strings to on | |
| standard_conforming_strings = on | |
| escape of \" is \" | |
| -------------------------------------------------------------------------------- | |
| Connecting to the postgresql server via pgpool-II | |
| Setting standard_conforming_strings to off | |
| standard_conforming_strings = off | |
| escape of \" is \\" | |
| Setting standard_conforming_strings to on | |
| standard_conforming_strings = on | |
| escape of \" is \\" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'pg' | |
| def print_stuff_about_standard_conforming_strings | |
| print "standard_conforming_strings = " | |
| puts @connection.query("SHOW standard_conforming_strings").entries[0]["standard_conforming_strings"] | |
| print %(escape of \\" is ) | |
| puts @connection.escape(%(\\")) | |
| end | |
| def perform_testing_on_the_connection | |
| puts "Setting standard_conforming_strings to off" | |
| @connection.query("SET standard_conforming_strings = off") | |
| print_stuff_about_standard_conforming_strings | |
| puts "Setting standard_conforming_strings to on" | |
| @connection.query("SET standard_conforming_strings = on") | |
| print_stuff_about_standard_conforming_strings | |
| end | |
| puts "Connecting directly to the postgresql server" | |
| @connection = PGconn.connect("localhost", 5432, nil, nil, "postgres", "libc", "") | |
| perform_testing_on_the_connection | |
| puts '-'*80 | |
| puts "Connecting to the postgresql server via pgpool-II" | |
| @connection = PGconn.connect("localhost", 9977, nil, nil, "postgres", "libc", "") | |
| perform_testing_on_the_connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment