-
-
Save iquad/72072ebbe6986202d9b598ff68357505 to your computer and use it in GitHub Desktop.
parser.rb
This file contains 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
<?php | |
// if i use \\'public\\' result is => | |
$version = floatval($this->_conn->getWrappedConnection()->getServerVersion()); | |
if ($version >= 10) { | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = |
This file contains 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
<?php | |
$version = floatval($this->_conn->getWrappedConnection()->getServerVersion()); | |
if ($version >= 10) { | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = \'public\' AND sequencename = '.$this->_conn->quote($sequenceName)); | |
} else { | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); | |
} |
This file contains 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
#!/usr/bin/env ruby | |
text = File.read('foo.php') | |
temp = <<-CODE | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); | |
CODE | |
replaceWith = <<-CODE | |
$version = floatval($this->_conn->getWrappedConnection()->getServerVersion()); | |
if ($version >= 10) { | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = \'public\' AND sequencename = '.$this->_conn->quote($sequenceName)); | |
} else { | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); | |
} | |
CODE | |
new_content = text.gsub(temp, replaceWith) | |
File.open('yeni.php', "w") {|file| file.puts new_content } |
This file contains 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
<?php | |
$version = floatval($this->_conn->getWrappedConnection()->getServerVersion()); | |
if ($version >= 10) { | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = 'public' AND sequencename = '.$this->_conn->quote($sequenceName)); | |
} else { | |
$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment