Libraryless. Click here for Pure Java version (2083L/16K/48K).
!636 !modern main { static Map<String, List> tables; static Map<String, List> tableFields; psvm { importMySQLDump(gunzipToText("#1000673")); printStats(); // Try a search! searchSnippet("hotwire"); } static void importMySQLDump(String dump) { System.out.println("Importing " + dump.length() + " chars."); Class importer = hotwire("#1000660"); set(importer, "in", dump); callMain(importer); tables = (Map) get(importer, "tables"); tableFields = (Map) get(importer, "tableFields"); print("Total rows imported: " + get(importer, "totalRows")); } static void printStats() { print(structure(tables.keySet())); print(structure(tableFields)); } static void searchSnippet(String pat) { // preparation List<List> table = tables.get("snippets_public"); List fields = tableFields.get("snippets_public"); int iID = fields.indexOf("sn_id"); int iTitle = fields.indexOf("sn_title"); // search System.out.println("\nResult of search for " + quote(pat) + ":\n"); for (List row : table) { if (indexOfIgnoreCase(row.get(iTitle), pat) >= 0) print("#" + row.get(iID) + " - " + row.get(iTitle)); } } }
Began life as a copy of #1000667
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000678 |
Snippet name: | Searching directly in a MySQL dump |
Eternal ID of this version: | #1000678/1 |
Text MD5: | c0399eb8933ded3331a4b39450da80a9 |
Transpilation MD5: | 8166f368ffd144365089e07dee27135a |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-09-14 02:11:05 |
Source code size: | 1269 bytes / 45 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 670 / 714 |
Referenced in: | [show references] |