Skip to content

Instantly share code, notes, and snippets.

@bjhaid
Forked from askinss/ported.rb
Last active December 23, 2015 19:39
Show Gist options
  • Save bjhaid/6684000 to your computer and use it in GitHub Desktop.
Save bjhaid/6684000 to your computer and use it in GitHub Desktop.
require 'oci8'
f = File.open("/home/bblite/ported/portedmsisdn.txt")
conn = OCI8.new(DB_USER, DB_PASSWORD, DB_SERVER)
conn.autocommit = true
f.each_line do |msisdn|
#I think you would need to validate the MSISDN against a particular regular expression
next unless msisdn.match(/^233\d{9}/)
#replace the port with the SDP server port
`curl 127.0.0.1:8051/blackberry/smsservice?msisdn=#{msisdn.chomp}&msg=deactivate` #you need to deactivate the msisdn on Broker
conn.exec("delete from subscriber where = '#{msisdn.chomp}'") #msisdn would have a new line character behind it so you would want to remove the new line
conn.commit
end
conn.logoff
#you need to think of a folder they can drop into and we monitor it, or you would have to put this on cron job that runs every 5 minutes and they should be dropping them in a folder then you process all the files in a folder, and move failed and successfull as need be to where they should be.
@bjhaid
Copy link
Author

bjhaid commented Sep 24, 2013

ORA-00920: invalid relational operator (OCIError) there was = missing between where and msisdn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment