;
String fpath = directory + "/" + list;
File f = new File(fpath);
long len;
Date date;
String ftype;
String sqldate;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
if (f.isFile())
{
len = f.length();
date = new Date(f.lastModified());
sqldate = df.format(date) ;
ftype = "F";
}
else
{
len = 0;
sqldate = null;
ftype = "D";
}
try
{
#sql { INSERT INTO Toad_dir_listing (file_name, file_size, type, modified)
VALUES (:element, :len, :ftype, to_date(:sqldate,'YYYY-MM-DD HH24:MI:SS')) };
}
catch (OracleSQLException e)
{ /* Sometimes the date doesn't get translated propertly. Proceeed without it. */
#sql { INSERT INTO Toad_dir_listing (file_name, file_size, type, modified)
VALUES (:element, :len, :ftype, null) };
} /* try..catch */
} /* for loop */
} /* directory exists */
else
{
throw new IOException("Folder " + directory + " does not exist on server.");
}
} /* getlist */
};
SQL> show error
Errors for JAVA SOURCE "ToadDirList":
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 ToadDirList:11: incompatible types
0/0 found : boolean
0/0 required: java.lang.Boolean
0/0 Boolean exists = (new File(directory)).exists();
0/0 ^
0/0 2 errors
0/0 found : java.lang.Boolean
0/0 required: boolean
0/0 if (exists)
0/0 ^
0/0 ToadDirList:12: incompatible types
我把 import java.lang.Boolean;写入开头,依旧报错,我不熟悉java,那位知道错在那里.