Package org.xBaseJ.micro

Examples of org.xBaseJ.micro.xBaseJException


public MDX createTag(String Name, String Index, boolean unique) throws IOException,  xBaseJException
{

  Name = Name.toUpperCase();
  if (anchor.indexes >= maxTags)
     throw new xBaseJException("Can't create another tag. Maximum of " + maxTags + " reached");

  try
    {
       getTagDescriptor(Name);
       throw new xBaseJException("Tag name already in use");
    }
  catch (xBaseJException e)
    {
       if (!e.getMessage().startsWith("Unknown tag named"))
         throw e;
View Full Code Here


nfile.writeInt(Util.x86(prev_page));
ll -= 4; // sizeof(int)
   for (i=0; i < keys_in_a_Node && key_expression[i] != null; i++)
   {
   if (key_expression[i] == null)
     throw new xBaseJException("Missing Node Key expression at " + i);
    if ((branch && (i <= keys_in_this_Node)) || (!branch && (i<keys_in_this_Node)))
       nfile.writeInt(Util.x86(key_record_number[i]));
    else
       nfile.writeInt(0);
    ll -= 4;
View Full Code Here

  file = new File(filename);


  if (!file.exists() || !file.isFile())
  {
    throw new xBaseJException("Unknown Index file");
  } //                               /* endif */

  if (readonly == 'r')
     nfile = new RandomAccessFile(filename, "r");
  else
View Full Code Here

  dosname = name;
  database = indatabase;

  if (destroy == false)
    if (file.exists())
       throw new xBaseJException("NDX file already exists");

  if (destroy == true)
    if (file.exists())
       if (file.delete() == false)
            throw new xBaseJException("Can't delete old NDX file");

  key_length = 0;
  stringKey = new String(NDXString);
  set_key_definition(NDXString);
  unique_key = (byte) (unique ? 64 : 0);
  while (strtok.hasMoreElements())
  {
    char type;
    tempch1 = (String) strtok.nextElement();
    Field Field = database.getField(tempch1);
    type = Field.getType();
     if (type == 'M')
  throw new xBaseJException("Can't make memo field part of a key");
      if (type == 'L')
  throw new xBaseJException("Can't make logical ield part of a key");
      if (type == 'F')
  throw new xBaseJException("Can't make float field part of a key");

    if (key_type == ' ')
      key_type = type;
    else
    if (key_type == 'D' && type == 'N')
      key_type = 'N';
    else
    if (key_type == 'N' && type == 'D')
      key_type = 'N';   // date key type really doesn't change
    else
    if (key_type != type)
  key_type = 'C';

     key_length += Field.getLength();
     keyControl.addElement(Field);
  }

  if (key_type == 'D' || key_type == 'N')
    {
     keyType = 'N';
     key_length = 16;
     }
  else
    {
       keyType = 'C';
    }

  len = (((key_length - 1) / 4) + 1) * 4;
  if (len < 1)
  {
    throw new xBaseJException("key length too short");
  }        /* endif */
  if (len > 100)
  {
    throw new xBaseJException("key length too int");
  }        /* endif */


   len += 8;
   next_available = 1;
View Full Code Here

public int  find_entry(NodeKey findKey, int rec) throws   xBaseJException, IOException
{
  if (topNode == null)
  {        /* no keys yet */
    throw new xBaseJException("No keys built");
  }        /* endif */
  topNode.set_pos(0);
  record =  find_entry(findKey, topNode, rec);
  return record;
}
View Full Code Here

  Node Node_2;
  workNode = aNode;

  if (aNode == null)
  {        /* no keys yet */
    throw new xBaseJException("No keys built");
  }        /* endif */

  leaf = aNode.get_lower_level();
  if (leaf != 0)      /* leaf pointers usually have one more pointer than shown */
    until = aNode.get_keys_in_this_Node() + 1;
View Full Code Here


public void validateName(String iName) throws xBaseJException
{

if (iName == null) throw new xBaseJException("Missing field name");
if (iName.length() == 0) throw new xBaseJException("Missing field name");
if (iName.length() > 10) throw new xBaseJException("Invalid field name " + iName);

for (int i = 0; i < iName.length(); i++)
  {
   if (Character.isLetter(iName.charAt(i))) continue;
   if (Character.isDigit(iName.charAt(i))) continue;
   if (iName.charAt(i) == '_') continue;

   throw new xBaseJException("Invalid field name " + iName + ", character invalid at " + i );
}

}
View Full Code Here

*                       undefined field type
*/
public char type() throws xBaseJException
{
  if (true)
      throw new xBaseJException("Undefined field");
  return '_';
}
View Full Code Here

*                       undefined field type
*/
public char getType() throws xBaseJException
{
  if (true)
      throw new xBaseJException("Undefined field");
  return '_';
}
View Full Code Here

  {
    byte b[];
    int i;

    if (inValue.length() > Length)
      throw new xBaseJException("Field length too long");

    i = Math.min(inValue.length(),Length);

    try {b = inValue.getBytes(DBF.encodedType);}
    catch (UnsupportedEncodingException UEE){ b = inValue.getBytes();}
View Full Code Here

TOP

Related Classes of org.xBaseJ.micro.xBaseJException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.