描述项目思路:
我正在开发在 Oracle 数据库 8i 版本上运行的系统。我想执行一个每月自动运行的查询(使用php或java)以检索下个月某些用户的到期付款数据,然后将这些数据发布到google Firebase。
描述我的问题:
我不想通过单击按钮手动运行代码或手动运行脚本,而是想知道如何在每个月的特定日期自动执行查询。用于从 Oracle 检索数据和将数据发布到 Firebase。但不要通过永远循环来过度使用服务器上的处理器。
我不知道它是否可以在 php 代码中完成,或者我应该使用外部程序或服务在特定时间自动运行我的函数
一个示例伪代码:
一个非常简单的例子来解释我的过程,实际的代码会更有条理。非常感谢您的想法
// some Proramming language API to call myFunction() automatically
/* this is what I need */
// check date
if (today() = 20-currentMonth-currentYear)
(
myFunction()
)
function myFunction()
{
//conneting to database
connect to oracle(connectionURL, username, password)
// running connection
run connection
// executing updated query
execute query(Select * from tableName where date 01-nextMonth-currentYear)
// fetching query results
Loop throw query result
// prepare JSON format
add result to json(object or array)
// close database connection
close oracle connection
// sending json to firebase
send json result to Firebase RestAPI
}
编程语言:
PHP