当前位置: 首页>>代码示例>>Java>>正文


Java FBSValueVector类代码示例

本文整理汇总了Java中com.ibm.jscript.types.FBSValueVector的典型用法代码示例。如果您正苦于以下问题:Java FBSValueVector类的具体用法?Java FBSValueVector怎么用?Java FBSValueVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FBSValueVector类属于com.ibm.jscript.types包,在下文中一共展示了FBSValueVector类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doUpdate

import com.ibm.jscript.types.FBSValueVector; //导入依赖的package包/类
public static FBSValue doUpdate(FBSValueVector args, IExecutionContext context) throws SQLException, InterpretException {
    if (args.size() >= 3) {
        Connection c = getConnection(args.get(0));
        String tbName = args.get(1).stringValue();
        FBSValue values = args.get(2);
        String where = args.size() > 3 && !args.get(3).isNull() ? args.get(3).stringValue() : null;
        FBSValue params = args.size() > 4 && !args.get(4).isNull() ? args.get(4) : null;
        Boolean colToUpperCase = args.size() > 5 && !args.get(5).isNull() ? args.get(5).booleanValue() : true;
        
        StringBuilder b = new StringBuilder();
        b.append("UPDATE "); // $NON-NLS-1$
        JdbcUtil.appendTableName(b, tbName);
        List<Object> v = initUpdateValues(b, values, colToUpperCase);
        if (StringUtil.isNotEmpty(where)) {
            b.append(" WHERE "); // $NON-NLS-1$
            b.append(where);
        }
        String sql = b.toString();
        PreparedStatement st = c.prepareStatement(sql);
        try {
            for (int i = 0; i < v.size(); i++) {
                st.setObject(i + 1, v.get(i));
            }
            if (params != null) {
                initParameters(st, params, v.size());
            }
            int count = st.executeUpdate();
            return FBSUtility.wrap(context.getJSContext(), count);
        } finally {
            st.close();
        }
    }
    return null;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:35,代码来源:JdbcFunctions.java

示例2: doInsert

import com.ibm.jscript.types.FBSValueVector; //导入依赖的package包/类
protected static FBSValue doInsert(FBSValueVector args, IExecutionContext context) throws SQLException, InterpretException {
    if (args.size() >= 2) {
        Connection c = getConnection(args.get(0));
        String tbName = args.get(1).stringValue();
        FBSValue values = args.get(2);
        FBSValue idColumnNames = args.size() > 3 && !args.get(3).isNull() ? args.get(3) : null;
        Boolean colToUpperCase = args.size() > 4 && !args.get(4).isNull() ? args.get(4).booleanValue() : null;

        StringBuilder b = new StringBuilder();
        b.append("INSERT INTO "); // $NON-NLS-1$
        JdbcUtil.appendTableName(b, tbName);
        List<Object> v = initInsertValues(b, values, colToUpperCase);
        b.append(" VALUES("); // $NON-NLS-1$
        for (int i = 0; i < v.size(); i++) {
            if (i != 0) {
                b.append(',');
            }
            b.append('?');
        }
        b.append(")");
        String sql = b.toString();
        PreparedStatement st = null;
        if (idColumnNames == null) {
            st = c.prepareStatement(sql);
        } else {
            List<Object> vNames = initInsertValues(null, idColumnNames, colToUpperCase);
            String[] columnNames = new String[vNames.size()];
            for (int i = 0; i < vNames.size(); i++) {
                columnNames[i] = (String) vNames.get(i);
            }
            st = c.prepareStatement(sql, columnNames);
        }
        try {
            for (int i = 0; i < v.size(); i++) {
                st.setObject(i + 1, v.get(i));
            }
            int count = st.executeUpdate();
            if (idColumnNames != null) {
                ResultSet rs = st.getGeneratedKeys();
                if (rs.next()) {
                    Object value = rs.getBigDecimal(1);
                    return FBSUtility.wrap(context.getJSContext(), value);
                }
            }
            return FBSUtility.wrap(context.getJSContext(), count);
        } finally {
            st.close();
        }
    }
    return null;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:52,代码来源:JdbcFunctions.java

示例3: toJavaArguments

import com.ibm.jscript.types.FBSValueVector; //导入依赖的package包/类
/**
 * Converts the SSJS parameters to a Java Object containing the parameters
 * 
 * @param crystal
 *            Meth(od) being called
 * @param vec
 *            FBSValueVector
 * @return Object containing parameters
 * @throws InterpretException
 * @since org.openntf.domino.xsp 2.5.0
 */
private Object[] toJavaArguments(final Method crystal, final FBSValueVector vec) throws InterpretException {
	Object[] result = new Object[vec.size()];
	Class<?>[] params = crystal.getParameterTypes();
	for (int i = 0; i < vec.size(); i++) {
		FBSValue val = vec.get(i);
		result[i] = val.toJavaObject(params[i]);
	}
	return result;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:21,代码来源:WrapperOpenDomino.java


注:本文中的com.ibm.jscript.types.FBSValueVector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。