Created model objects and DB layer.

This commit is contained in:
Jonathan Bernard
2015-02-20 01:08:17 -06:00
parent f2dc674181
commit 3e07dc20bf
14 changed files with 262 additions and 0 deletions

View File

@ -0,0 +1,32 @@
package com.jdbernard.nlsongs.db
public class GenerateQueries {
public static void main(String[] args) {
}
public static Map<String, Map<String, String> > generateQueries(String ddl) {
def tables = [:]
// Find the table definitions
String tableRegex = /(?ms)(?:CREATE TABLE (?:IF NOT EXISTS )?([^\s]+) \(([^\s]+);.+?)+/
ddl.eachMatch(tableRegex) { matchGroups ->
String tableName = matchGroups[1]
// Parse the column definitions.
// Create new record insert statements.
// Create insert queries.
// Create update queries.
// Create delete queries.
// Create ID lookup queries.
}
}