////////////////////////////////////////////////////// /////// wait for schema creation ///////////////////// //////////////////////////////////////////////////////
768705
function waitForSchemaCreation(handle, apiId, callback){
    if(isWaitNeededForSchema(handle)){
        let appsyncClient = awsClient.AppSync(handle.awsDetails)
        let param = {
            apiId: apiId,
        }
        schemaCreationWaitLoop(appsyncClient, param, handle, 1, callback)
    }else{
        callback(null, handle)
    }
}
1011341
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {

		final PropertyMap getOrCreateProperties = new PropertyMap();
		final PropertyMap updateProperties      = new PropertyMap();

		getOrCreateProperties.put(SchemaProperty.name, getName());
		getOrCreateProperties.put(SchemaProperty.schemaNode, schemaNode);

		SchemaProperty property = app.nodeQuery(SchemaProperty.class).and(getOrCreateProperties).getFirst();
		if (property == null) {

			getOrCreateProperties.put(SchemaProperty.compound, isCompoundUnique());
			getOrCreateProperties.put(SchemaProperty.unique, isUnique());
			getOrCreateProperties.put(SchemaProperty.indexed, isIndexed());
			getOrCreateProperties.put(SchemaProperty.notNull, isRequired());
			getOrCreateProperties.put(SchemaProperty.readOnly, isReadOnly());
			getOrCreateProperties.put(SchemaProperty.format, getFormat());
			getOrCreateProperties.put(SchemaProperty.hint, getHint());
			getOrCreateProperties.put(SchemaProperty.category, getCategory());
			getOrCreateProperties.put(SchemaProperty.validators, validators.toArray(new String[0]));
			getOrCreateProperties.put(SchemaProperty.transformers, transformers.toArray(new String[0]));
			getOrCreateProperties.put(SchemaProperty.defaultValue, defaultValue);

			property = app.create(SchemaProperty.class, getOrCreateProperties);
		}

		if (parent != null) {

			final JsonSchema root = parent.getSchema();
			if (root != null) {

				if (SchemaService.DynamicSchemaRootURI.equals(root.getId())) {

					updateProperties.put(SchemaProperty.isPartOfBuiltInSchema, true);
				}
			}
		}

		// update properties
		property.setProperties(SecurityContext.getSuperUserInstance(), updateProperties);

		// return modified property
		return property;
	}
860161
void createPublicSchema() {

        HsqlName name = database.nameManager.newHsqlName(null,
            SqlInvariants.PUBLIC_SCHEMA, SchemaObject.SCHEMA);
        Schema schema = new Schema(name,
                                   database.getGranteeManager().getDBARole());

        defaultSchemaHsqlName = schema.name;

        schemaMap.put(schema.name.name, schema);
    }
952828
private void registerSchemas(Configuration conf, SchemaManager schemaManager)
      throws InterruptedException {
    HBaseAdmin admin;
    try {
      // Construct an HBaseAdmin object (required by schema tool), and delete it
      // if it exists so we start fresh.
      admin = new HBaseAdmin(conf);
      if (admin.tableExists("kite_example_user_profiles")) {
        admin.disableTable("kite_example_user_profiles");
        admin.deleteTable("kite_example_user_profiles");
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    // Use the SchemaTool to create the schemas that are in the example-models
    // directory, and create the table and column families required by those
    // schemas.
    SchemaTool tool = new SchemaTool(admin, schemaManager);
    tool.createOrMigrateSchemaDirectory("classpath:example-models", true);
  }
1192529
function SqliteSchemaSyncer( db, schema ) {
    this.db = db;
    this.schema = {};
    this.toSync = {};
    this.analyzed = {};
    if ( schema ) {
        this.toSync = schema;
        if ( this.toSync ) {
            for ( var k in this.toSync ) {
                if (this.toSync.hasOwnProperty(k) ) {
                    var value = this.toSync[k];
                    delete this.toSync[k];
                    this.toSync[k.toLowerCase()] = value;
                }
            }
        }
    }
}
607244
function () {
    var str = '{';
    for (var i in this.schema){
      if (i == 'preset') continue;
      str += i + ': ';
      var type = this.schema[i].type;
      if (type == 'vec3') {
        str += '{ x: ' + this.data[i].x + ', y: ' + this.data[i].y + ', z: ' + this.data[i].z + '}';
      }
      else if (type == 'string' || type == 'color') {
        str += '"' + this.data[i] + '"';
      }
      else {
        str += this.data[i];
      }
      str += ', ';
    }
    str += '}';
    console.log(str);
  }
47473
private Deferred<Object> resolveUIDs() {
    
    class TagsCB implements Callback<Object, ArrayList<Object>> {
      @Override
      public Object call(final ArrayList<Object> ignored) throws Exception {
        rowkey_regex = getRowKeyRegex();
        return null;
      }
    }
    
    class PairResolution implements Callback<Object, ArrayList<byte[]>> {
      @Override
      public Object call(final ArrayList<byte[]> tags) throws Exception {
        if (tags.size() < 2) {
          throw new IllegalArgumentException("Somehow we received an array "
              + "that wasn't two bytes in size! " + tags);
        }
        pairs.add(new ByteArrayPair(tags.get(0), tags.get(1)));
        return Deferred.fromResult(null);
      }
    }
    
    class TagResolution implements Callback<Deferred<Object>, Object> {
      @Override
      public Deferred<Object> call(final Object unused) throws Exception {
        if (query.getTags() == null || query.getTags().isEmpty()) {
          return Deferred.fromResult(null);
        }
        
        pairs = Collections.synchronizedList(
            new ArrayList<ByteArrayPair>(query.getTags().size()));
        final ArrayList<Deferred<Object>> deferreds = 
            new ArrayList<Deferred<Object>>(pairs.size());
        
        for (final Pair<String, String> tags : query.getTags()) {
          final ArrayList<Deferred<byte[]>> deferred_tags = 
              new ArrayList<Deferred<byte[]>>(2);
          if (tags.getKey() != null && !tags.getKey().equals("*")) {
            deferred_tags.add(tsdb.getUIDAsync(UniqueIdType.TAGK, tags.getKey()));
          } else {
            deferred_tags.add(Deferred.<byte[]>fromResult(null));
          }
          if (tags.getValue() != null && !tags.getValue().equals("*")) {
            deferred_tags.add(tsdb.getUIDAsync(UniqueIdType.TAGV, tags.getValue()));
          } else {
            deferred_tags.add(Deferred.<byte[]>fromResult(null));
          }
          deferreds.add(Deferred.groupInOrder(deferred_tags)
              .addCallback(new PairResolution()));
        }
        return Deferred.group(deferreds).addCallback(new TagsCB());
      }
    }
    
    class MetricCB implements Callback<Deferred<Object>, byte[]> {
      @Override
      public Deferred<Object> call(final byte[] uid) throws Exception {
        metric_uid = uid;
        LOG.debug("Found UID (" + UniqueId.uidToString(metric_uid) + 
            ") for metric (" + query.getMetric() + ")");
        return new TagResolution().call(null);
      }
    }
    
    if (query.getMetric() != null && !query.getMetric().isEmpty() && 
        !query.getMetric().equals("*")) {
      return tsdb.getUIDAsync(UniqueIdType.METRIC, query.getMetric())
          .addCallbackDeferring(new MetricCB());
    } else {
      try {
        return new TagResolution().call(null);
      } catch (Exception e) {
        return Deferred.fromError(e);
      } 
    }
  }
517522
function createDatabase (name) {
  var deferred = q.defer();

  // Make sure the database location exists
  ready.then(function () {
    // Check if database exists
    fs.exists(globalConfig.db.location + name + '.db.json', function (exists) {
      if(exists) return deferred.resolve();

      // If database is non-existent, simply write an empty object as placeholder
      fs.writeFile(globalConfig.db.location + name + '.db.json', '{}', function (err) {
        if(err) return deferred.reject('Database couldn\'t create table');

        return deferred.resolve();
      });
    });
  }, function () {
    deferred.reject('Database couldn\'t instantiate');
  });

  return deferred.promise;
}
174521
@Override
    public <P> void pojoDaoCreated(PojoDaoFactoryEvent<P> event) {
        Schema schema = new Schema();
        event.getPojoBinding().describe(schema.createTable(event.getTableName()), schema);
        List<SchemaStatement> statements = schema.items().map(SchemaItem::createStatement).collect(Collectors.toList());
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Creating table(s) to support \"{}\":\n\t{}\n", event.getPojoBinding().getPojoType().getSimpleName(), statements.stream().map(SchemaStatement::getQueryString).collect(Collectors.joining("\n\t")));
        }
        statements.forEach(session::execute);
    }
515531
function Schema (sc, size) {
  if (!(this instanceof Schema)) return new Schema(sc);
  debug('======BUILDING PHASE======');
  helpers.validate(sc);
  debug('schema size=%d being built', size);
  this._schema = this;
  this._document = helpers.build(sc, '$root', this);
  this._state = { // serve as global state
    index: -1,
    size: size,
    counter: []
  };
  debug('======BUILDING ENDS======');
}
364475
private void createOrUpdateSchema(Boolean isUpdate)

    {
        createNamespace(isUpdate);
        readExternalProperties();
        Map<Class<?>, EntityType<?>> entityMap = kunderaMetadata.getApplicationMetadata()
                .getMetaModelBuilder(puMetadata.getPersistenceUnitName()).getManagedTypes();
        // iterating all classes of pu to generate schema
        for (Class<?> clazz : entityMap.keySet())
        {
            EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, clazz);
            if (m != null)
            {
                String tablename = m.getTableName();
                HTableDescriptor hTableDescriptor = getTableDescriptor(clazz, entityMap.get(clazz), tablename);
                String hTableName = HBaseUtils.getHTableName(databaseName, tablename);
                createOrUpdateTable(hTableName, hTableDescriptor);
            }
        }
    }
1202035
public static void createSchema(DataSource dataSource, String name) {
        try (Connection connection = dataSource.getConnection();
             Statement statement = connection.createStatement()) {
            statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name));
        } catch (SQLException e) {
            throw new RuntimeException("Can not connect to database", e);
        }
    }
427546
@InterfaceAudience.Public
    public void waitForRows() throws CouchbaseLiteException {
        start();

        while (true) {
            try {
                queryFuture.get();
                break;
            } catch (InterruptedException e) {
                continue;
            } catch (Exception e) {
                lastError = e;
                throw new CouchbaseLiteException(e, Status.INTERNAL_SERVER_ERROR);
            }
        }
    }
857029
def create_schema(self, connection):
        
        if '.' not in self.table:
            return

        query = 'CREATE SCHEMA IF NOT EXISTS {schema_name};'.format(schema_name=self.table.split('.')[0])
        connection.cursor().execute(query)
303763
function requireAll(schemaDir, options, callback) {
  debug("loading schemas");
  if (!callback) {
    callback = options;
    options = {};
  }
  const opts = _.assign({
    extensions: ["json"],
  }, options);

  let files;
  try {
    files = fs.readdirSync(schemaDir);
  } catch(errReaddir) {
    return callback(errReaddir);
  }

  let schemas = [];

  for (let index = 0; index < files.length; index++) {
    const file = files[index];
    const ext = path.extname(file).slice(1);

    if (opts.extensions.indexOf(ext) === -1) {
      continue;
    }

    const abspath = path.join(schemaDir, file);
    let schema;

    // try load the schema! If it fails, stop immediately
    try {
      schema = require(abspath);
    } catch (errRequire) {
      return callback(errRequire);
    }

    schema.filepath = abspath;
    schemas.push(schema);
  }

  return callback(null, schemas);
}
733939
function init(config, cb) {
    connection = mongoose.createConnection(config.mongoUrl);

    var firstCallback = true;

    connection.on('error', function(err) {
      log.logger.error('Mongo error: ' + util.inspect(err));
      if (firstCallback) {
        firstCallback = false;
        return cb(err);
      } else {
        log.logger.error('Mongo error: ' + util.inspect(err));
        return cb(err);
      }
    });

    connection.once('open', function callback() {
      if (firstCallback) {
        log.logger.debug('Mongoose connected.');
        firstCallback = false;
        return cb(null,connection);
      }
      else {
        return cb();
      }
    });

    connection.on('disconnected', function() {
      log.logger.debug('Mongoose event - disconnect');
    });
    
    // Load schemas
    models.Mbaas = connection.model('Mbaas', require('./models/mbaas.js'));
    models.AppMbaas = connection.model('AppMbaas', require('./models/appMbaas.js'));
    models.Event = connection.model('Events', require('./models/events.js').EventSchema);
    models.Alert = connection.model('Alerts', require('./models/alerts.js').AlertSchema);
    models.Notification = connection.model("Notification",require('./models/notifications').NotificationSchema);
    models.Crash = connection.model("Crash",require('./models/crash').CrashSchema);
}
588679
function (values, schema, options, callback) {
    var newValues = {}
        , errors = []
        , modelList = find(schema)
        , val;

    for (var model in modelList) {
        if (_.isArray(modelList[model])) {

            if (values === undefined) {
                val = undefined;
            }
            else {
                val = values[model];
            }

            // Empty array defined in schema
            if (_.isEmpty(modelList[model])) {
                if (val) {
                    newValues[model] = val;
                }
            }
            else {
                // Set value to empty array if empty given
                if (val == undefined) {
                    if (options && options.partial == true) {
                        // Do nothing
                    }
                    else {
                        newValues[model] = [];
                    }
                }
                else {
                    // Sub model defined in schema
                    for (var thisSubSchema in modelList[model]) {
                        if (_.isArray(val)) {
                            for (var thisValue in val) {

                                // Check if type array or plain array
                                if (typeof val[thisValue] == "object") {
                                    modelCompare(val[thisValue], modelList[model][thisSubSchema], options, function (err, data) {
                                        if (err) {
                                            errors = _.union(errors, err);
                                        }
                                        if (data !== null) {
                                            if (!newValues[model]) {
                                                newValues[model] = [];
                                            }
                                            newValues[model][thisValue] = data;
                                        }
                                    });
                                }
                                else {
                                    rulesMatch(thisValue, val[thisValue], modelList[model][thisSubSchema], options, function (err, data) {
                                        if (err) {
                                            errors.push(err);
                                        }
                                        if (data !== undefined) {
                                            if (!newValues[model]) {
                                                newValues[model] = [];
                                            }
                                            newValues[model][thisValue] = data;
                                        }
                                    });
                                }
                            }
                        }
                        else {
                            modelCompare(val, modelList[model][thisSubSchema], options, function (err, data) {
                                if (err) {
                                    errors = _.union(errors, err);
                                }
                                if (data !== null) {
                                    newValues[model] = data;
                                }
                            });
                        }
                    }
                }
            }
        } else {
            // Check for definition of {} in model to allow any data for this node without validation
            if (_.isEmpty(modelList[model])) {
                for (var index in values) {
                    var filter = new RegExp("^" + model);
                    if (index.match(filter)) {
                        newValues[index] = values[index];
                    }
                }
            }
            else {
                if (values === undefined) {
                    val = undefined;
                }
                else {
                    val = values[model];
                }

                rulesMatch(model, val, modelList[model], options, function (err, data) {
                    if (err) {
                        errors.push(err);
                    }
                    if (data !== undefined) {
                        newValues[model] = data;
                    }
                });
            }
        }
    }

    if (_.isEmpty(errors)) {
        errors = null;
    }
    else {
        errors = {name: 'ValidationError', err: errors};
    }
    if (_.isEmpty(newValues)) {
        newValues = null;
    }
    callback(errors, newValues);
}