diff --git a/calexium_lib b/calexium_lib index 977d6b0..8b1c73d 160000 --- a/calexium_lib +++ b/calexium_lib @@ -1 +1 @@ -Subproject commit 977d6b04a745ecdf22e97a494197b52ad86cf87a +Subproject commit 8b1c73d0a94bf27dcdd331455006dd3ae13aea76 diff --git a/hayamiki_lib b/hayamiki_lib index 1ea67eb..67283d2 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit 1ea67eb55022aaaa2c37b180530fa8d72e71f142 +Subproject commit 67283d2acf36bae89805163ecebbec67fa677e3f diff --git a/src/generation/SQL_get_all.anubis b/src/generation/SQL_get_all.anubis index a792999..2b45473 100644 --- a/src/generation/SQL_get_all.anubis +++ b/src/generation/SQL_get_all.anubis @@ -110,34 +110,21 @@ public define Maybe(One) " success(cursor) then _get_all_"+name+"(cursor, [])\n"+ " }\n"+ ".\n"+ -// "public define List(JsonValue)\n"+ -// " _get_all_"+name+"_to_json\n"+ -// " (\n"+ -// " SQLite3DataBase db,\n"+ -// " One -> SQLite3Row table_cursor,\n"+ -// " List(JsonValue) so_far\n"+ -// " ) =\n"+ -// " if extract_"+name+"_cursor_to_json(db, table_cursor) is\n"+ -// " {\n"+ -// " failure then reverse(so_far),\n"+ -// " success(data) then _get_all_"+name+"_to_json(db, table_cursor, [data . so_far])\n"+ -// " }\n"+ -// ".\n"+ -"public define List(JsonValue)\n"+ -" _get_all_"+name+"_to_json\n"+ -" (\n"+ -" SQLite3DataBase db,\n"+ -" List(((Int -> SQLite3Datum) -> JsonMember)) extractors,\n"+ -" One -> SQLite3Row table_cursor,\n"+ -" List(JsonValue) so_far\n"+ -" ) =\n"+ -" if extract_"+name+"_cursor_to_json(db, extractors, table_cursor) is\n"+ -" {\n"+ -" failure then reverse(so_far),\n"+ -" success(data) then _get_all_"+name+"_to_json(db, extractors, table_cursor, [data . so_far])\n"+ -" }\n"+ -".\n"+ +//"public define List(JsonValue)\n"+ +//" _get_all_"+name+"_to_json\n"+ +//" (\n"+ +//" SQLite3DataBase db,\n"+ +//" List(((Int -> SQLite3Datum) -> JsonMember)) extractors,\n"+ +//" One -> SQLite3Row table_cursor,\n"+ +//" List(JsonValue) so_far\n"+ +//" ) =\n"+ +//" if extract_"+name+"_cursor_to_json(db, extractors, table_cursor) is\n"+ +//" {\n"+ +//" failure then reverse(so_far),\n"+ +//" success(data) then _get_all_"+name+"_to_json(db, extractors, table_cursor, [data . so_far])\n"+ +//" }\n"+ +//".\n"+ "public define JsonValue\n"+ " get_all_"+name+"_by_clause_to_json\n"+ @@ -157,10 +144,8 @@ public define Maybe(One) " failure then json_array([]),\n"+ " success(cursor) then\n"+ " json_array(\n"+ -//" if length(columns) = 0 then\n"+ -//" _get_all_"+name+"_to_json(db, cursor, [])\n"+ -//" else\n"+ -" _get_all_"+name+"_to_json(db, make_json_extractor(db, final_columns, resolve_fk), cursor, [])\n"+ +//" _get_all_"+name+"_to_json(db, make_"+name+"_json_extractor(db, final_columns, resolve_fk), cursor, [])\n"+ +" get_all_to_json(db, make_"+name+"_json_extractor(db, final_columns, resolve_fk), cursor, [])\n"+ " )\n"+ " }\n"+ ".\n" diff --git a/src/generation/extractor.anubis b/src/generation/extractor.anubis index ba267d9..d98daba 100644 --- a/src/generation/extractor.anubis +++ b/src/generation/extractor.anubis @@ -177,10 +177,12 @@ public define Maybe(One) //generate the type of the table that contain all components if write_string(stream, "\n\n"+ + // "public define Maybe(JsonValue)\n"+ // " extract_"+name+"_cursor_to_json\n"+ // " (\n"+ // " SQLite3DataBase db,\n"+ +// " List(((Int -> SQLite3Datum) -> JsonMember)) extractors,\n"+ // " One -> SQLite3Row table_cursor\n"+ // " ) =\n"+ // " if table_cursor(unique) is\n"+ @@ -188,26 +190,11 @@ public define Maybe(One) // " error(sql_error) then println(db_error(sql_error, \"extract_"+name+"\")); failure,\n"+ // " no_more_row then failure,\n"+ // " row(cursor) then\n"+ -// " success("+generate_json_object_from_cursor(name, "cursor", columns, " ")+")\n"+ //generate type construction with values got from web arg -// " }\n.\n"+ -// "\n\n"+ - "public define Maybe(JsonValue)\n"+ - " extract_"+name+"_cursor_to_json\n"+ - " (\n"+ - " SQLite3DataBase db,\n"+ - " List(((Int -> SQLite3Datum) -> JsonMember)) extractors,\n"+ - " One -> SQLite3Row table_cursor\n"+ - " ) =\n"+ - " if table_cursor(unique) is\n"+ - " {\n"+ - " error(sql_error) then println(db_error(sql_error, \"extract_"+name+"\")); failure,\n"+ - " no_more_row then failure,\n"+ - " row(cursor) then\n"+ - " success(\n"+ - " json_object(\n"+ - " map(((Int -> SQLite3Datum) -> JsonMember extractor) |-> extractor(cursor) , extractors)\n"+ - " ))\n"+ - " }\n.\n\n"+ +// " success(\n"+ +// " json_object(\n"+ +// " map(((Int -> SQLite3Datum) -> JsonMember extractor) |-> extractor(cursor) , extractors)\n"+ +// " ))\n"+ +// " }\n.\n\n"+ "public define String get_"+name+"_show_string(SQLite3DataBase db, DB_id _idx).\n\n"+ "define (Int -> SQLite3Datum) -> JsonMember\n"+ @@ -219,8 +206,8 @@ public define Maybe(One) " )=\n"+generate_json_extractor(name, "cursor", columns, " ")+ "\n.\n\n"+ -"define List(((Int -> SQLite3Datum) -> JsonMember))\n"+ -" make_json_extractor\n"+ +"public define List(((Int -> SQLite3Datum) -> JsonMember))\n"+ +" make_"+name+"_json_extractor\n"+ " (\n"+ " SQLite3DataBase db,\n"+ " List(String) columns,\n"+ diff --git a/src/generation/files.anubis b/src/generation/files.anubis index e1f92e8..8731f77 100644 --- a/src/generation/files.anubis +++ b/src/generation/files.anubis @@ -208,11 +208,15 @@ define One // with delete = "tm_delete(\""+name+"\", delete_"+name+")", with controller = "hk_table_controller(\""+name+"\", + //Column's name + "+name+"_columns, + "+name+"_select_fields, //Create update_"+name+"_from_type, update_"+name+"_from_fields, //Read (SQLite3DataBase db, String clause) |-> get_count_by_clause(db, \""+name+"\", clause), + make_"+name+"_json_extractor, get_one_"+name+"_to_json, get_all_"+name+"_by_clause_to_json, //Delete diff --git a/src/generation/types.anubis b/src/generation/types.anubis index c70319a..db15fae 100644 --- a/src/generation/types.anubis +++ b/src/generation/types.anubis @@ -231,14 +231,8 @@ public define Maybe(One) " {\n"+ " failure then error,\n"+ " success(cursor) then\n"+ -//" if length(columns) = 0 then\n"+ -//" if extract_"+name+"_cursor_to_json(db, cursor) is\n"+ -//" {\n"+ -//" failure then error,\n"+ -//" success(result) then result\n"+ -//" }\n"+ -//" else\n"+ -" if extract_"+name+"_cursor_to_json(db, make_json_extractor(db, final_columns, resolve_fk), cursor) is\n"+ +//" if extract_"+name+"_cursor_to_json(db, make_"+name+"_json_extractor(db, final_columns, resolve_fk), cursor) is\n"+ +" if extract_cursor_to_json(db, make_"+name+"_json_extractor(db, final_columns, resolve_fk), cursor) is\n"+ " {\n"+ " failure then error,\n"+ " success(result) then result\n"+ -- libgit2 0.21.4