1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

v2.11.1.1

This commit is contained in:
gnosygnu
2015-11-01 20:50:05 -05:00
parent 4f43f51b18
commit b990ec409f
858 changed files with 6758 additions and 4187 deletions

View File

@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.bldrs.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
import gplx.core.flds.*; import gplx.ios.*;
import gplx.core.flds.*; import gplx.core.ios.*;
public class Sql_file_parser {
public Io_url Src_fil() {return src_fil;} public Sql_file_parser Src_fil_(Io_url v) {src_fil = v; return this;} Io_url src_fil;
public int Src_len() {return src_len;} public Sql_file_parser Src_len_(int v) {src_len = v; return this;} private int src_len = 8 * Io_mgr.Len_mb;
@@ -54,7 +54,7 @@ public class Sql_file_parser {
public void Parse(Gfo_usr_dlg usr_dlg) {
Io_buffer_rdr rdr = Io_buffer_rdr.Null;
try {
rdr = Io_buffer_rdr.new_(gplx.ios.Io_stream_rdr_.new_by_url_(src_fil), src_len);
rdr = Io_buffer_rdr.new_(gplx.core.ios.Io_stream_rdr_.new_by_url_(src_fil), src_len);
Bry_bfr fil_bfr = Bry_bfr.new_(), val_bfr = Bry_bfr.new_();
byte[] bfr = rdr.Bfr(); int bfr_len = rdr.Bfr_len(), fld_idx = 0, cur_pos = 0;
if (flds_req != null) Identify_flds(bfr);
@@ -73,9 +73,9 @@ public class Sql_file_parser {
switch (mode) {
case Mode_sql_bgn:
cur_pos = Bry_find_.Find_fwd(bfr, Bry_insert_into, cur_pos);
if (cur_pos == Bry_.NotFound || cur_pos > bfr_len) {reading_file = false; continue;}
if (cur_pos == Bry_find_.Not_found || cur_pos > bfr_len) {reading_file = false; continue;}
cur_pos = Bry_find_.Find_fwd(bfr, Bry_values, cur_pos);
if (cur_pos == Bry_.NotFound || cur_pos > bfr_len) throw Err_.new_wo_type("VALUES not found"); // something went wrong;
if (cur_pos == Bry_find_.Not_found || cur_pos > bfr_len) throw Err_.new_wo_type("VALUES not found"); // something went wrong;
mode = Mode_fld;
cur_pos += Bry_values.length;
break;

View File

@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.bldrs.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
import org.junit.*; import gplx.ios.*;
import org.junit.*; import gplx.core.ios.*;
public class Sql_file_parser_tst {
Sql_file_parser_fxt fxt = new Sql_file_parser_fxt();
@Before public void init() {fxt.Clear();}

View File

@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.bldrs.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
import gplx.ios.*;
import gplx.core.ios.*;
class Sql_fld_mgr {
public int Count() {return hash.Count();}
public Sql_fld_itm Get_by_key(String fld) {return Get_by_key(Bry_.new_u8(fld));}
@@ -25,11 +25,11 @@ class Sql_fld_mgr {
} private Ordered_hash hash = Ordered_hash_.New_bry();
public Sql_fld_mgr Parse(byte[] raw) {
hash.Clear();
int bgn = Bry_find_.Find_fwd(raw, Tkn_create_table); if (bgn == Bry_.NotFound) throw Err_.new_wo_type("could not find 'CREATE TABLE'");
bgn = Bry_find_.Find_fwd(raw, Byte_ascii.Nl, bgn); if (bgn == Bry_.NotFound) throw Err_.new_wo_type("could not find new line after 'CREATE TABLE'");
int bgn = Bry_find_.Find_fwd(raw, Tkn_create_table); if (bgn == Bry_find_.Not_found) throw Err_.new_wo_type("could not find 'CREATE TABLE'");
bgn = Bry_find_.Find_fwd(raw, Byte_ascii.Nl, bgn); if (bgn == Bry_find_.Not_found) throw Err_.new_wo_type("could not find new line after 'CREATE TABLE'");
bgn += Int_.Const_position_after_char;
int end = Bry_find_.Find_fwd(raw, Tkn_unique_index); if (end == Bry_.NotFound) throw Err_.new_wo_type("could not find 'UNIQUE KEY'");
end = Bry_find_.Find_bwd(raw, Byte_ascii.Nl, end); if (bgn == Bry_.NotFound) throw Err_.new_wo_type("could not find new line before 'UNIQUE KEY'");
int end = Bry_find_.Find_fwd(raw, Tkn_unique_index); if (end == Bry_find_.Not_found) throw Err_.new_wo_type("could not find 'UNIQUE KEY'");
end = Bry_find_.Find_bwd(raw, Byte_ascii.Nl, end); if (bgn == Bry_find_.Not_found) throw Err_.new_wo_type("could not find new line before 'UNIQUE KEY'");
Parse_lines(Bry_.Mid(raw, bgn, end));
return this;
}
@@ -39,9 +39,9 @@ class Sql_fld_mgr {
int fld_idx = 0;
for (int i = 0; i < lines_len; i++) {
byte[] line = lines[i];
int bgn = Bry_find_.Find_fwd(line, Byte_ascii.Tick); if (bgn == Bry_.NotFound) continue; // skip blank lines
int bgn = Bry_find_.Find_fwd(line, Byte_ascii.Tick); if (bgn == Bry_find_.Not_found) continue; // skip blank lines
bgn += Int_.Const_position_after_char;
int end = Bry_find_.Find_fwd(line, Byte_ascii.Tick, bgn); if (end == Bry_.NotFound) continue; // skip blank lines
int end = Bry_find_.Find_fwd(line, Byte_ascii.Tick, bgn); if (end == Bry_find_.Not_found) continue; // skip blank lines
byte[] key = Bry_.Mid(line, bgn, end);
Sql_fld_itm fld = new Sql_fld_itm(fld_idx++, key);
hash.Add(fld.Key(), fld);