mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.8.5.1'
This commit is contained in:
@@ -39,6 +39,7 @@ public class Db_conn {
|
||||
public void Env_vacuum() {Exec_sql_plog_ntx("vacuuming: url=" + this.Conn_info().Db_api(), "VACUUM;");}
|
||||
public void Meta_tbl_create(Dbmeta_tbl_itm meta) {engine.Meta_tbl_create(meta); engine.Meta_idx_create(Gfo_usr_dlg_.Noop, meta.Idxs().To_ary());}
|
||||
public void Meta_tbl_delete(String tbl) {engine.Meta_tbl_delete(tbl);}
|
||||
public void Meta_tbl_remake_many(Db_tbl... tbls) {for (Db_tbl tbl : tbls) Meta_tbl_remake(tbl);}
|
||||
public void Meta_tbl_remake(Db_tbl tbl) {engine.Meta_tbl_delete(tbl.Tbl_name()); tbl.Create_tbl();}
|
||||
public void Meta_tbl_remake(Dbmeta_tbl_itm meta) {engine.Meta_tbl_delete(meta.Name()); engine.Meta_tbl_create(meta);}
|
||||
public void Meta_idx_assert(String tbl, String suffix, String... flds) {if (engine.Meta_idx_exists(tbl + "__" + suffix)) return; this.Meta_idx_create(tbl, suffix, flds);}
|
||||
@@ -110,6 +111,14 @@ public class Db_conn {
|
||||
Gfo_usr_dlg_.Instance.Plog_many("", "", "done:" + msg);
|
||||
return rv;
|
||||
}
|
||||
public int Exec_select_max_as_int (String tbl_name, String fld_name, int or) {
|
||||
Object rv = Exec_select_as_obj(String_.Format("SELECT Max({0}) FROM {1}", fld_name, tbl_name));
|
||||
return rv == null ? or : Int_.cast(rv);
|
||||
}
|
||||
public int Exec_select_count_as_int(String tbl_name, int or) {
|
||||
Object rv = Exec_select_as_obj(String_.Format("SELECT Count(*) FROM {0}", tbl_name));
|
||||
return rv == null ? or : Int_.cast(rv);
|
||||
}
|
||||
public int Exec_select_as_int (String sql, int or) {Object rv = Exec_select_as_obj(sql); return rv == null ? or : Int_.cast(rv);}
|
||||
public double Exec_select_as_double (String sql, double or) {Object rv = Exec_select_as_obj(sql); return rv == null ? or : Double_.cast(rv);}
|
||||
private Object Exec_select_as_obj(String sql) {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.dbs;
|
||||
import gplx.*; import gplx.core.consoles.*; import gplx.core.envs.Env_;
|
||||
import gplx.core.envs.System_;
|
||||
import gplx.dbs.engines.sqlite.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@@ -49,7 +50,7 @@ public class SqliteDbMain {
|
||||
// }
|
||||
// }
|
||||
private void CreateMany(int number, int base_val) {
|
||||
long time_bgn = Env_.TickCount();
|
||||
long time_bgn = System_.Ticks();
|
||||
Db_conn provider = Db_conn_pool.Instance.Get_or_new(Db_conn_info_.sqlite_(Io_url_.new_fil_("E:\\test.sqlite3")));
|
||||
String tbl_sql = String_.Concat_lines_nl
|
||||
( "CREATE TABLE fsdb_xtn_thm"
|
||||
@@ -80,7 +81,7 @@ public class SqliteDbMain {
|
||||
.Val_str("")
|
||||
.Exec_insert();
|
||||
}
|
||||
long time_elapsed = (Env_.TickCount() - time_bgn);
|
||||
long time_elapsed = (System_.Ticks() - time_bgn);
|
||||
// provider.Txn_mgr().Txn_end();
|
||||
provider.Rls_conn();
|
||||
Tfds.Write(time_elapsed, number / time_elapsed);
|
||||
|
||||
Reference in New Issue
Block a user