UniFileTest: Difference between revisions

From Pickwiki
Jump to navigationJump to search
No edit summary
 
m link fix
 
Line 1: Line 1:
Back to JavaSource
Back to [[JavaSource]]


ReadNamedField works if you call the method that takes both the key and the field name together, but does NOT work if you set the key with setRecordID and then call it with only the field name.  Any ideas?  This is using the asjava.zip file that came with UV10PE, which is reporting itself as Version 1.1.1.  Thanks!  [[Wendy]]
[[ReadNamedField]] works if you call the method that takes both the key and the field name together, but does NOT work if you set the key with set[[RecordID]] and then call it with only the field name.  Any ideas?  This is using the asjava.zip file that came with [[UV10PE]], which is reporting itself as Version 1.1.1.  Thanks!  [[Wendy]]
----
----
I've got independent confirmation from two sources on this one, so I think it's an official bug.  Thanks to Mark and Louis from the U2-Users list! -- [[Wendy]] 08/13/2002
I've got independent confirmation from two sources on this one, so I think it's an official bug.  Thanks to Mark and Louis from the U2-Users list! -- [[Wendy]] 08/13/2002
----
----
You were right! it was a bug and the readNamedField(fieldName) method has been fixed (Call No: 346996) for the "next" release. -- [[Stuart]] 2003-11-06
You were right! it was a bug and the read[[NamedField]](fieldName) method has been fixed (Call No: 346996) for the "next" release. -- [[Stuart]] 2003-11-06
----
----


Line 13: Line 13:
import asjava.uniclientlibs.*;
import asjava.uniclientlibs.*;


public class TestUniFile2
public class [[TestUniFile2]]
{
{


Line 19: Line 19:
     {
     {


           UniJava uJava = new UniJava();
           [[UniJava]] uJava = new [[UniJava]]();


           try {
           try {
               UniSession uSession = uJava.openSession();
               [[UniSession]] uSession = uJava.openSession();


               uSession.setHostName("HostName");
               uSession.set[[HostName]]("[[HostName]]");
               uSession.setUserName("UserName");
               uSession.set[[UserName]]("[[UserName]]");
               uSession.setPassword("Password");
               uSession.setPassword("Password");
               uSession.setAccountPath("AccountPath");
               uSession.set[[AccountPath]]("[[AccountPath]]");
               uSession.connect();
               uSession.connect();


               UniFile fImage = uSession.open("IMAGE");
               [[UniFile]] fImage = uSession.open("IMAGE");


               String key = "P6080010.JPG";
               String key = "P6080010.JPG";


               fImage.setRecordID(key);
               fImage.set[[RecordID]](key);
               System.out.println("1 " + fImage.read());
               System.out.println("1 " + fImage.read());


Line 41: Line 41:
               System.out.println("3 " + fImage.readField(key, 2));
               System.out.println("3 " + fImage.readField(key, 2));


               //This one doesn't work:
               /[[/This]] one doesn't work:
               fImage.setRecordID(key);
               fImage.set[[RecordID]](key);
               System.out.println("4 " + fImage.readNamedField("IMAGE.PATH"));
               System.out.println("4 " + fImage.read[[NamedField]]("IMAGE.PATH"));


               System.out.println("5 " + fImage.readNamedField(key, "IMAGE.PATH"));
               System.out.println("5 " + fImage.read[[NamedField]](key, "IMAGE.PATH"));


               fImage.close();
               fImage.close();
Line 51: Line 51:
               uSession.disconnect();
               uSession.disconnect();


           } catch (UniSessionException e) {
           } catch ([[UniSessionException]] e) {
               System.out.println("Error: " + e);
               System.out.println("Error: " + e);
           } catch (UniFileException e) {
           } catch ([[UniFileException]] e) {
               System.out.println("File Error: " + e);
               System.out.println("File Error: " + e);
           }
           }

Latest revision as of 23:48, 26 February 2015

Back to JavaSource

ReadNamedField works if you call the method that takes both the key and the field name together, but does NOT work if you set the key with setRecordID and then call it with only the field name. Any ideas? This is using the asjava.zip file that came with UV10PE, which is reporting itself as Version 1.1.1. Thanks! Wendy


I've got independent confirmation from two sources on this one, so I think it's an official bug. Thanks to Mark and Louis from the U2-Users list! -- Wendy 08/13/2002


You were right! it was a bug and the readNamedField(fieldName) method has been fixed (Call No: 346996) for the "next" release. -- Stuart 2003-11-06



import asjava.uniobjects.*;
import asjava.uniclientlibs.*;

public class [[TestUniFile2]]
{

     public static void main(String args[])
     {

          [[UniJava]] uJava = new [[UniJava]]();

          try {
               [[UniSession]] uSession = uJava.openSession();

               uSession.set[[HostName]]("[[HostName]]");
               uSession.set[[UserName]]("[[UserName]]");
               uSession.setPassword("Password");
               uSession.set[[AccountPath]]("[[AccountPath]]");
               uSession.connect();

               [[UniFile]] fImage = uSession.open("IMAGE");

               String key = "P6080010.JPG";

               fImage.set[[RecordID]](key);
               System.out.println("1 " + fImage.read());

               System.out.println("2 " + fImage.read(key));

               System.out.println("3 " + fImage.readField(key, 2));

               /[[/This]] one doesn't work:
               fImage.set[[RecordID]](key);
               System.out.println("4 " + fImage.read[[NamedField]]("IMAGE.PATH"));

               System.out.println("5 " + fImage.read[[NamedField]](key, "IMAGE.PATH"));

               fImage.close();

               uSession.disconnect();

          } catch ([[UniSessionException]] e) {
               System.out.println("Error: " + e);
          } catch ([[UniFileException]] e) {
               System.out.println("File Error: " + e);
          }
     }
}