com.joanju.cg.db
Class BytecodeTable

java.lang.Object
  extended by com.joanju.cg.db.BytecodeTable

public class BytecodeTable
extends java.lang.Object


Constructor Summary
BytecodeTable()
           
 
Method Summary
static void delete(int cuid, int addr)
          Delete bytecode (should only be one) for cuID and address.
static void deleteAll(int cuid)
          Delete all bytecode for cuID.
static Bytecode fetch(int cuid, int address)
          This does not populate the bytecode data field.
static java.util.ArrayList<java.lang.Integer> fetchAddressesFor(int cuid, Opcode opcode)
          Fetch addresses for a particular Opcode in a cu.
static java.util.TreeMap<java.lang.Integer,Bytecode> fetchAll(int cuid)
          Fetch all for a CU.
static java.util.TreeMap<java.lang.Integer,Bytecode> fetchAllWithData(int cuid)
          Fetch all for a CU, with data bytes.
static byte[] fetchData(int cuid, int address)
          Fetch the data bytes[] into a Bytecode object.
static Opcode fetchOpcode(int cuid, int address)
          This fetches the matching record and returns the Opcode enum.
static java.util.TreeMap<java.lang.Integer,java.lang.Integer> fetchOpcodes(int cuid)
          Fetch a TreeMap of a compile unit's opcodes, sorted by address.
static Bytecode fetchWithData(int cuid, int address)
          Fetch the entire bytecode record, including the data in the bytes field.
static void insert(Bytecode bytecode)
          Store one Bytecode record.
static void insert(java.util.Collection<Bytecode> list)
          Store a collection of Bytecode objects into the database.
static void updateData(Bytecode bytecode)
          Store changes to the parameters/data byte[] for an instruction that is already in the DB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BytecodeTable

public BytecodeTable()
Method Detail

delete

public static void delete(int cuid,
                          int addr)
                   throws java.sql.SQLException
Delete bytecode (should only be one) for cuID and address.

Throws:
java.sql.SQLException

deleteAll

public static void deleteAll(int cuid)
                      throws java.sql.SQLException
Delete all bytecode for cuID.

Throws:
java.sql.SQLException

fetchAddressesFor

public static java.util.ArrayList<java.lang.Integer> fetchAddressesFor(int cuid,
                                                                       Opcode opcode)
                                                                throws java.sql.SQLException
Fetch addresses for a particular Opcode in a cu.

Throws:
java.sql.SQLException

fetchAll

public static java.util.TreeMap<java.lang.Integer,Bytecode> fetchAll(int cuid)
                                                              throws java.sql.SQLException
Fetch all for a CU.

Throws:
java.sql.SQLException

fetchAllWithData

public static java.util.TreeMap<java.lang.Integer,Bytecode> fetchAllWithData(int cuid)
                                                                      throws java.sql.SQLException,
                                                                             java.io.IOException
Fetch all for a CU, with data bytes.

Throws:
java.sql.SQLException
java.io.IOException

fetchData

public static byte[] fetchData(int cuid,
                               int address)
                        throws java.sql.SQLException
Fetch the data bytes[] into a Bytecode object.

Throws:
java.sql.SQLException

fetch

public static Bytecode fetch(int cuid,
                             int address)
                      throws java.sql.SQLException
This does not populate the bytecode data field. That field is lazy-loaded.

Returns:
null if no matching record or if there is a bad Opcode.
Throws:
java.sql.SQLException

fetchOpcode

public static Opcode fetchOpcode(int cuid,
                                 int address)
                          throws java.sql.SQLException
This fetches the matching record and returns the Opcode enum. You might use this if you just need the Opcode for the address, but don't need to fetch the Bytecode object (a small amount less overhead).

Returns:
null if no matching record or if there is a bad Opcode.
Throws:
java.sql.SQLException

fetchOpcodes

public static java.util.TreeMap<java.lang.Integer,java.lang.Integer> fetchOpcodes(int cuid)
                                                                           throws java.sql.SQLException
Fetch a TreeMap of a compile unit's opcodes, sorted by address.

Throws:
java.sql.SQLException

fetchWithData

public static Bytecode fetchWithData(int cuid,
                                     int address)
                              throws java.sql.SQLException,
                                     java.io.IOException
Fetch the entire bytecode record, including the data in the bytes field.

Returns:
null if no matching record or if there is a bad Opcode.
Throws:
java.sql.SQLException
java.io.IOException

insert

public static void insert(java.util.Collection<Bytecode> list)
                   throws java.sql.SQLException,
                          java.io.IOException
Store a collection of Bytecode objects into the database. If the bytecode was originally from the database, then just the data segment is written (if modified). It is otherwise up to the application to make sure that it's not creating duplicate entries.

Throws:
java.io.IOException
java.sql.SQLException

insert

public static void insert(Bytecode bytecode)
                   throws java.sql.SQLException,
                          java.io.IOException
Store one Bytecode record. If this was originally from the database, then just the data segment is written (if modified). It otherwise is up to the application to make sure it's not creating duplicate entries.

Throws:
java.io.IOException
java.sql.SQLException

updateData

public static void updateData(Bytecode bytecode)
                       throws java.sql.SQLException,
                              java.io.IOException
Store changes to the parameters/data byte[] for an instruction that is already in the DB.

Throws:
java.io.IOException
java.sql.SQLException


Copyright © 2008 Joanju Software. All Rights Reserved.