com.joanju.cg.db
Class StringTable

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

public class StringTable
extends java.lang.Object

Provides inter-package cached access to the String table.

Not part of the public API. Callgraph is mostly only interested in names for call targets, which are mostly only case-insensitive in OpenEdge. So, Callgraph only works with the lowercase value of each string.

Anything over the maximum string storage size is given UNRESOLVED value.


Field Summary
static int MAX_LEN
          We limit the strings to this max number of chars.
 
Constructor Summary
StringTable()
           
 
Method Summary
static java.lang.String get(int id)
          Returns the string for an ID, null if it's not there.
static int get(java.lang.String str)
          Returns the ID for a string, creates it if it's not already there.
static int getForQString(java.lang.String inputString)
          Given the text from a quoted string, returns a string ID.
static int lookup(java.lang.String str)
          Looks up the ID for a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LEN

public static final int MAX_LEN
We limit the strings to this max number of chars. It's very unlikely that Callgraph would really be interested in strings longer than that. Anything over 255 would require another byte of storage per row in some databases.

See Also:
Constant Field Values
Constructor Detail

StringTable

public StringTable()
Method Detail

getForQString

public static int getForQString(java.lang.String inputString)
                         throws java.sql.SQLException
Given the text from a quoted string, returns a string ID. Note that a node like FILENAME can also be a Progress quoted string. This deals with stripping the attributes and quotes before looking it up in the strings table. Goes through get(String), which uses the cache.

Throws:
java.sql.SQLException

get

public static int get(java.lang.String str)
               throws java.sql.SQLException
Returns the ID for a string, creates it if it's not already there. Uses the string cache.

Returns:
Layout.UNRESOLVED_VALUE if the string size is larger than MAX_LEN.
Throws:
java.sql.SQLException

get

public static java.lang.String get(int id)
                            throws java.sql.SQLException
Returns the string for an ID, null if it's not there. This is not cached, since it is usually only used for reporting and debugging. It would also be used for operators like strcat and substr, but those are low overhead and infrequent operations, compared to the overhead of the build process.

Throws:
java.sql.SQLException

lookup

public static int lookup(java.lang.String str)
                  throws java.sql.SQLException
Looks up the ID for a string. Unlike the get() functions, this does not add the string to the database if it's not already there. Does not use the cache.

Returns:
zero if it does not exist.
Throws:
java.sql.SQLException


Copyright © 2008 Joanju Software. All Rights Reserved.