节点中是否有用于SQL外部化的工具?
我曾想过创建一个JSON文件来存储SQL语句,但我认为这不是最好的方法。
编辑:
例如,在Java中,您可以创建一个.properties
文件,并为每个语句指定一个关键字。然后,将此文件导入到一个类中,并通过其关键字访问每个语句。我正在寻找类似的Java语言。
编辑2:
例子
sql.properties:
insertProduct = INSERT INTO products VALUES (?, ?, ?, ?)
我的课:
public class Example {
private Properties sqlProperties = // load file according to its location
//sqlProperties.getProperty('insertProduct'); will return the SQL from the sql.properties file
}
谢谢
尝试使用npm packages
它们是您Node.js
解决方案的有用来源或扩展。
对于解析.properties
JAVA文件,您可能会感兴趣:
然后,您可以使用以下命令处理SQL调用:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句