Class RuntimeDatabaseService

java.lang.Object
io.github.protasm.jvmud.storage.jdbc.RuntimeDatabaseService

public final class RuntimeDatabaseService extends Object
JDBC-backed database handle manager for JVMud-native database efuns.

The service intentionally exposes JVMud operations such as jvmud_db_exec rather than legacy driver names. Mudlib compatibility objects can translate spellings like db_exec onto these methods while JVMud owns only the generic runtime contract: handles identify open connections, one result cursor is retained per handle, SQL errors are queryable, and fetched rows are returned as LPC arrays. JDBC binary text values are decoded as UTF-8 LPC strings rather than exposing Java byte-array identities to mudlib code.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    close(int handle)
    Closes an open handle and returns LPC status.
    void
    configure(String jdbcUrl, String jdbcUser, String jdbcPassword)
    Configures the JDBC connection settings used by subsequent database connections.
    int
    connect(String databaseName, String user, String password)
    Opens a connection and returns its positive handle, or 0 when no JDBC URL is configured.
    error(int handle)
    Returns the last SQL error for an open handle, or LPC false when no error is pending.
    escape(String value)
    Escapes backslashes and single quotes for compatibility SQL text interpolation.
    int
    execute(int handle, String sql)
    Executes one SQL statement against an open handle and returns that handle on success.
    fetch(int handle)
    Fetches the next row from the handle's current result cursor, or LPC false when exhausted.
    Returns the currently open database handles as an LPC array.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RuntimeDatabaseService

      public RuntimeDatabaseService()
  • Method Details

    • configure

      public void configure(String jdbcUrl, String jdbcUser, String jdbcPassword)
      Configures the JDBC connection settings used by subsequent database connections.
    • connect

      public int connect(String databaseName, String user, String password)
      Opens a connection and returns its positive handle, or 0 when no JDBC URL is configured.
    • execute

      public int execute(int handle, String sql)
      Executes one SQL statement against an open handle and returns that handle on success.
    • fetch

      public Object fetch(int handle)
      Fetches the next row from the handle's current result cursor, or LPC false when exhausted.
    • error

      public Object error(int handle)
      Returns the last SQL error for an open handle, or LPC false when no error is pending.
    • close

      public int close(int handle)
      Closes an open handle and returns LPC status.
    • handles

      public List<Integer> handles()
      Returns the currently open database handles as an LPC array.
    • escape

      public String escape(String value)
      Escapes backslashes and single quotes for compatibility SQL text interpolation.