节点js SQL外化?

时间:2015-03-18 13:33:03

标签: sql node.js external

节点中是否有SQL外化的工具?

我想创建一个JSON文件来存储SQL语句,但我不认为这是最好的方法。

编辑:

例如,在Java中,您可以创建一个.properties文件,并为每个语句都有一个关键字。然后,将该文件导入到类中,并通过它的关键字访问每个语句。我在Javascript中寻找类似的东西。

EDIT2:

示例

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

}

谢谢

1 个答案:

答案 0 :(得分:2)

尝试使用npm packages它们是Node.js解决方案的有用来源或扩展。

要解析您可能感兴趣的.properties JAVA文件:

然后您可以使用例如:

处理SQL调用
相关问题