Package org.jruby

Examples of org.jruby.Ruby.newBoolean()


                            IRubyObject indexDefinition = indexDefinitionClass.callMethod(context, "new",
                                    new IRubyObject[] {
                                RubyString.newUnicodeString(runtime, tableName),
                                RubyString.newUnicodeString(runtime, indexName),
                                runtime.newBoolean(!nonUnique),
                                runtime.newArray()
                            });

                            // empty list for column names, we'll add to that in just a bit
                            indexes.add(indexDefinition);
View Full Code Here


                            getInstanceVariable("@config"),
                            RubyString.newUnicodeString(runtime,
                                    caseConvertIdentifierForRails(metadata, colName)),
                            defaultValueFromResultSet(runtime, rs),
                            RubyString.newUnicodeString(runtime, typeFromResultSet(rs, isOracle)),
                            runtime.newBoolean(!rs.getString(IS_NULLABLE).trim().equals("NO"))
                        });
                columns.add(column);

                IRubyObject tp = (IRubyObject)types.fastARef(column.callMethod(context,"type"));
                if (tp != null && !tp.isNil() && tp.callMethod(context, "[]", runtime.newSymbol("limit")).isNil()) {
View Full Code Here

                    standard_conforming_strings = executeQueryImpl(context, self,
                        "SHOW standard_conforming_strings", 1, false, new WithResultSet<IRubyObject>() {
                        public IRubyObject call(final ResultSet resultSet) throws SQLException {
                            if ( resultSet != null && resultSet.next() ) {
                                final String result = resultSet.getString(1);
                                return runtime.newBoolean( "on".equals(result) );
                            }
                            return context.nil;
                        }
                    });
                }
View Full Code Here

            else value = "on";
            // NOTE: we no longer log this query as before ... with :
            // execute("SET standard_conforming_strings = #{value}", 'SCHEMA')
            executeImpl(context, self, "SET standard_conforming_strings = " + value);

            standard_conforming_strings = runtime.newBoolean( value == (Object) "on" );
        }
        catch (RaiseException e) {
            // unsupported
        }
        finally {
View Full Code Here

                            final boolean nonUnique = keySet.getBoolean("non_unique");

                            IRubyObject[] args = new IRubyObject[] {
                                rubyTableName, // table_name
                                RubyString.newUnicodeString(runtime, keyName), // index_name
                                runtime.newBoolean( ! nonUnique ), // unique
                                runtime.newArray(), // [] for column names, we'll add to that in just a bit
                                runtime.newArray() // lengths
                            };

                            indexes.append( indexDefinition.callMethod(context, "new", args) ); // IndexDefinition.new
View Full Code Here

        final String defaultSchema, final String tableName) {
        final Ruby runtime = context.runtime;
        return withConnection(context, new Callable<RubyBoolean>() {
            public RubyBoolean call(final Connection connection) throws SQLException {
                final TableName components = extractTableName(connection, defaultSchema, tableName);
                return runtime.newBoolean( tableExists(runtime, connection, components) );
            }
        });
    }

    @JRubyMethod(name = {"columns", "columns_internal"}, required = 1, optional = 2)
View Full Code Here

                            final boolean nonUnique = indexInfoSet.getBoolean(INDEX_INFO_NON_UNIQUE);

                            IRubyObject[] args = new IRubyObject[] {
                                RubyString.newUnicodeString(runtime, indexTableName), // table_name
                                RubyString.newUnicodeString(runtime, indexName), // index_name
                                runtime.newBoolean( ! nonUnique ), // unique
                                runtime.newArray() // [] for column names, we'll add to that in just a bit
                                // orders, (since AR 3.2) where, type, using (AR 4.0)
                            };

                            indexes.add( indexDefinition.callMethod(context, "new", args) ); // IndexDefinition.new
View Full Code Here

                new IRubyObject[] {
                    config,
                    RubyString.newUnicodeString( runtime, caseConvertIdentifierForRails(metaData, colName) ),
                    defaultValueFromResultSet( runtime, results ),
                    RubyString.newUnicodeString( runtime, typeFromResultSet(results) ),
                    runtime.newBoolean( ! results.getString(IS_NULLABLE).trim().equals("NO") )
                });
            columns.append(column);

            if ( primaryKeyNames.contains(colName) ) {
                column.callMethod(context, "primary=", runtime.getTrue());
View Full Code Here

  }

  @JRubyMethod(name = "included_class?")
  public static IRubyObject isIncludedClass(ThreadContext context, IRubyObject self, IRubyObject object) {
    Ruby runtime = context.getRuntime();
    return runtime.newBoolean(object instanceof IncludedModuleWrapper);
  }

  @JRubyMethod(name = "singleton_class?")
  public static IRubyObject isSingletonClass(ThreadContext context, IRubyObject self, IRubyObject object) {
    Ruby runtime = context.getRuntime();
View Full Code Here

  }

  @JRubyMethod(name = "singleton_class?")
  public static IRubyObject isSingletonClass(ThreadContext context, IRubyObject self, IRubyObject object) {
    Ruby runtime = context.getRuntime();
    return runtime.newBoolean(object instanceof MetaClass);
  }

  @JRubyMethod(name = "singleton_instance")
  public static IRubyObject singletonInstance(ThreadContext context, IRubyObject self, IRubyObject singleton_class) {
    Ruby runtime = context.getRuntime();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.