InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: InstantDB: HELP URGENT


here it is, you just need to compile it
it's called value() and returns a double

 jp

>

package org.enhydra.instantdb.db;

import org.enhydra.instantdb.db.SqlFunction;
import java.sql.SQLException;


class value implements SqlFunction {
  String usage = "value requires a single string parameter";

 public int checkParameters (int[] parameterTypes) throws SQLException {
  int paramCount = parameterTypes.length;    // get number of parameters
  if (paramCount != 1) {        // check parameter count
   throw new SQLException (usage);
  }
  return TYPE_DOUBLE;         // our return type
 }

 public void setSpecialValue (int type, Object value) throws SQLException {
 } // setSpecialValue

 public Object getSpecialValue (int type) throws SQLException {
  return null;
 } // getSpecialValue


 public Object evaluate(Object[] parameters) throws SQLException {
  String tString = (String)parameters[0];
  double tDbl = 0;
  try {
   tDbl =Double.parseDouble(tString);
  } catch (NumberFormatException nfe) {

  }
  Double tDouble = new Double(tDbl);
  return tDouble;
 }
}

--
-[ ]-/\-( )---------------------------------------EasternGraphics-------

Jens Panse

http://www.EasternGraphics.com
phone:            03677 678267
private:     jens.panse@gmx.de


-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.