@@ -79,6 +79,7 @@ public abstract class SQLiteServer implements AutoCloseable {
7979 public static final int MAX_CONNS_DEFAULT = 50 ;
8080 public static final int MAX_WORKER_COUNT = 128 ;
8181 public static final int CONNECT_TIMEOUT_DEFAULT = 30000 ;
82+ public static final long MAX_ALLOWED_PACKET_DEFAULT = 16L << 20 ;
8283 // SQLite settings
8384 public static final int BUSY_TIMEOUT_DEFAULT = 50000 ;
8485 public static final JournalMode JOURNAL_MODE_DEFAULT = JournalMode .WAL ;
@@ -126,6 +127,10 @@ public abstract class SQLiteServer implements AutoCloseable {
126127 protected TimestampFunc clockTimestampFunc ;
127128 protected TimestampFunc sysdateFunc ;
128129
130+ // Resource limit since v0.3.29 2019-12-14
131+ protected long maxAllowedPacket = MAX_ALLOWED_PACKET_DEFAULT ;
132+
133+ // Life-cycle states
129134 private final AtomicBoolean inited = new AtomicBoolean (false );
130135 private volatile boolean stopped ;
131136
@@ -416,7 +421,9 @@ public void init(String... args) {
416421 this .workerCount = Math .min (MAX_WORKER_COUNT , n );
417422 } else if ("--auth-method" .equals (a ) || "-A" .equals (a )) {
418423 this .authMethod = toLowerEnglish (args [++i ]);
419- } else if ("--help" .equals (a ) || "-h" .equals (a ) || "-?" .equals (a )) {
424+ } else if ("--max-allowed-packet" .equals (a )) {
425+ this .maxAllowedPacket = Long .decode (args [++i ]);
426+ } if ("--help" .equals (a ) || "-h" .equals (a ) || "-?" .equals (a )) {
420427 help = true ;
421428 }
422429 }
@@ -773,6 +780,10 @@ public int getMaxConns() {
773780 return this .maxConns ;
774781 }
775782
783+ public long getMaxAllowedPacket () {
784+ return maxAllowedPacket ;
785+ }
786+
776787 public String getVersion () {
777788 return VERSION ;
778789 }
@@ -1003,7 +1014,7 @@ protected String getInitDbHelp() {
10031014 " --journal-mode <mode> SQLite journal mode, default " +JOURNAL_MODE_DEFAULT +"\n " +
10041015 " --synchronous|-S<sync> SQLite synchronous mode, default " +SYNCHRONOUS_DEFAULT + "\n " +
10051016 " --protocol <pg> SQLite server protocol, default pg\n " +
1006- " --auth-method|-A<authMethod> Available auth methods(" +getAuthMethods ()+"), default ' " +getAuthDefault ()+ "'" ;
1017+ " --auth-method|-A<authMethod> Available auth methods(" +getAuthMethods ()+"), default " +getAuthDefault ();
10071018 }
10081019
10091020 protected String getBootHelp () {
@@ -1020,7 +1031,8 @@ protected String getBootHelp() {
10201031 " --busy-timeout <millis> SQL statement busy timeout, default " +BUSY_TIMEOUT_DEFAULT +"\n " +
10211032 " --journal-mode <mode> SQLite journal mode, default " +JOURNAL_MODE_DEFAULT +"\n " +
10221033 " --synchronous|-S<sync> SQLite synchronous mode, default " +SYNCHRONOUS_DEFAULT + "\n " +
1023- " --protocol <pg> SQLite server protocol, default pg" ;
1034+ " --protocol <pg> SQLite server protocol, default pg\n " +
1035+ " --max-allowed-packet <number> Max allowed packet size, default " + MAX_ALLOWED_PACKET_DEFAULT ;
10241036 }
10251037
10261038 protected static void doHelp (int status , String message ) {
0 commit comments