mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Db: Add exec reader by prepared statement
This commit is contained in:
@@ -48,4 +48,13 @@ public class Db_sql_ {
|
||||
}
|
||||
return dirty ? bfr.To_bry_and_clear() : raw;
|
||||
}
|
||||
public static String Prep_in_from_ary(Object ary) {
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
int len = Array_.Len(ary);
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (i != 0) bfr.Add_byte(Byte_ascii.Comma);
|
||||
bfr.Add_byte(Byte_ascii.Question);
|
||||
}
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ public class Db_stmt_ {
|
||||
public static Db_stmt new_select_as_rdr(Db_conn conn, String sql) {
|
||||
return conn.Stmt_new(Db_qry_sql.rdr_(sql));
|
||||
}
|
||||
public static Db_stmt New_sql_lines(Db_conn conn, String... lines) {
|
||||
Db_qry qry = Db_qry_sql.sql_(String_.Concat_with_str("\n", lines));
|
||||
return conn.Stmt_new(qry);
|
||||
}
|
||||
public static Err err_(Exception e, Db_stmt stmt, String proc) {
|
||||
throw Err_.new_exc(e, "db", "db stmt failed", "proc", proc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user