add view result to environment variable

This commit is contained in:
EricTYL 2019-09-24 15:22:20 +08:00
parent 0aa2edc09d
commit 30327df425
2 changed files with 3 additions and 1 deletions

View File

@ -9,5 +9,6 @@ ENV['NTNU_DB_HOST'] = 'database host'
ENV['NTNU_DB_PORT'] = 'database port'
ENV['TDS_VERSION'] = '5.0'
ENV['DB_NAME'] = 'database name'
ENV['VIEW_RESULT'] = 'database view result'
```
* set cron job to run `bundle exec rake sync_personal_plugins:sync` everyday

View File

@ -15,7 +15,8 @@ namespace :sync_personal_plugins do
end
# Query data and store them to local memory
tds_result = sybase_client.execute 'SELECT * FROM VIEW_RESULTS_0001'
view = ENV['VIEW_RESULT']
tds_result = sybase_client.execute "SELECT * FROM #{view}"
query_result = tds_result.entries
# Close the NTNU SyBase connection