Creates a term.
@param name The term name.
@param slug The term slug.
@return The created term.
@throws SQLException on database error.
163711
public Term createTerm(final String name, final String slug) throws SQLException {

      Connection conn = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      Timer.Context ctx = metrics.createTermTimer.time();
      try {
         conn = connectionSupplier.getConnection();
         stmt = conn.prepareStatement(insertTermSQL, Statement.RETURN_GENERATED_KEYS);
         stmt.setString(1, name);
         stmt.setString(2, slug);
         stmt.executeUpdate();
         rs = stmt.getGeneratedKeys();
         if(rs.next()) {
            return new Term(rs.getLong(1), name, slug);
         } else {
            throw new SQLException("Problem creating term (no generated id)");
         }
      } finally {
         ctx.stop();
         closeQuietly(conn, stmt, rs);
      }
   }
780978
protected function _createListTerm( $name, $type )
	{
		switch( $this->getOperator() )
		{
			case '==':

				$list = array();
				foreach( (array) $this->getValue() as $value ) {
					$list[] = $this->_createTerm( $name, $type, $value );
				}
				return '( ' . implode( ' || ', $list ) . ' )';

			case '!=':

				$list = array();
				foreach( (array) $this->getValue() as $value ) {
					$list[] = $this->_createTerm( $name, $type, $value );
				}
				return '( ' . implode( ' && ', $list ) . ' )';

			default:
				throw new MW_Common_Exception( sprintf( 'List Term not allowed for operator "%1$s"', $this->getOperator() ) );
		}
	}
1021720
public static Application create(final String name) throws Exception{
    	final Map<String, Object> params = new HashMap<String, Object>();
    	params.put("name", name);
    	
    	return create(params);
    }
874960
@Override
    public SqlQuery createSqlQuery(String sql) {
        Assert.hasText(sql, "sql must has text");
        return ebeanServer.createSqlQuery(sql);
    }
637712
@NotNull
    public DbPreparedStatement<T> setNull(@NotNull String name, @NotNull SQLType type) throws SQLException {
        for (int i : getIndexes(name)) {
            statement.setNull(i, type.getVendorTypeNumber());
        }
        return this;
    }
645216
public static RelationType create(@NonNull String name) {
      RelationType toReturn = DynamicEnum.register(new RelationType(name));
      values.add(toReturn);
      return toReturn;
   }
80977
public function createVocabulary($name) {
    if ($this->vocabulary->where('name', $name)->count()) {
      throw new Exceptions\VocabularyExistsException();
    }

		return $this->vocabulary->create(['name' => $name]);
	}
394215
private T createOrThrow(String name) {
        T constant = constants.get(name);
        if (constant == null) {
            final T tempConstant = newConstant(nextId(), name);
            constant = constants.putIfAbsent(name, tempConstant);
            if (constant == null) {
                return tempConstant;
            }
        }

        throw new IllegalArgumentException(String.format("'%s' is already in use", name));
    }
997929
public function createDb($name)
    {
        $sql = $this->query->createDb($name);
        $this->db->exec($sql);

        return true;
    }
305935
private void createTables() throws SQLException {
        Statement stmt = this.conn.createStatement();

        stmt.execute(DbConstants.DROP_METADATA_STATEMENT);
        stmt.execute(DbConstants.DROP_INDEX_STATEMENT);
        stmt.execute(DbConstants.DROP_CATEGORY_MAP_STATEMENT);
        stmt.execute(DbConstants.DROP_DATA_STATEMENT);
        stmt.execute(DbConstants.DROP_CATEGORIES_STATEMENT);

        stmt.execute(DbConstants.CREATE_CATEGORIES_STATEMENT);
        stmt.execute(DbConstants.CREATE_DATA_STATEMENT);
        stmt.execute(DbConstants.CREATE_CATEGORY_MAP_STATEMENT);
        stmt.execute(DbConstants.CREATE_INDEX_STATEMENT);
        stmt.execute(DbConstants.CREATE_METADATA_STATEMENT);

        stmt.close();
    }
533785
public static DbColumn.Builder dbColumn(String name, DbColumnType type, boolean autoInc) {
        return new DbColumn.Builder().name(name).type(type).autoInc(autoInc);
    }
733846
public static Integer create(DbConn cnx, String name, String description, boolean defaultQ)
    {
        QueryResult r = cnx.runUpdate("q_insert", defaultQ, description, name);
        Queue res = new Queue();
        res.id = r.getGeneratedId();
        res.name = name;
        res.description = description;
        res.defaultQueue = defaultQ;
        return res.id;
    }
838429
public Extensions getOrCreate(String tableName, String columnName) {
		return getOrCreate(EXTENSION_NAME, tableName, columnName, DEFINITION,
				ExtensionScopeType.WRITE_ONLY);
	}
666548
public Term selectTerm(final long id) throws SQLException {
      Connection conn = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      Timer.Context ctx = metrics.selectTermTimer.time();
      try {
         conn = connectionSupplier.getConnection();
         stmt = conn.prepareStatement(selectTermIdSQL);
         stmt.setLong(1, id);
         rs = stmt.executeQuery();
         return rs.next() ? new Term(id, rs.getString(1), rs.getString(2)) : null;
      } finally {
         ctx.stop();
         closeQuietly(conn, stmt, rs);
      }
   }
1085349
public static function create($name)
    {
        $title = Inflector::titleize($name, true);
        $slug = Inflector::slug($name);
        $model = new self(['name' => $slug, 'title' => $title, 'status_id' => self::STATUS_ENABLED]);

        if ($model->save()) {
            return $model;
        } else {
            throw new ErrorException(implode(' ', $model->getFirstErrors()));
        }
    }
323123
public boolean setTaxonomyTermDescription(final String taxonomy, final String name,
                                             final String description) throws SQLException {

      TaxonomyTerm term = selectTaxonomyTerm(taxonomy, name);
      if(term == null || term.term == null) {
         return false;
      }

      Connection conn = null;
      PreparedStatement stmt = null;
      Timer.Context ctx = metrics.updateTaxonomyTermTimer.time();
      try {
         conn = connectionSupplier.getConnection();
         stmt = conn.prepareStatement(updateTaxonomyTermDescriptionSQL);
         stmt.setString(1, Strings.nullToEmpty(description));
         stmt.setLong(2, term.term.id);
         stmt.setString(3, taxonomy);
         return stmt.executeUpdate() > 0;
      } finally {
         ctx.stop();
         closeQuietly(conn, stmt);
      }
   }
1339697
public function createTerm($vocabulary, $name)
    {
        // @todo make this easily extensible.
        $term = (object) array(
        'name' => $name,
        'vocabulary_machine_name' => $vocabulary,
        'description' => $this->getRandom()->name(255),
        );
        $saved = $this->termCreate($term);

        // Set internal page on the term.
        $this->getSession()->visit($this->locatePath('/taxonomy/term/' . $saved->tid));
    }