Convenience method for inserting a row into the database.

@param dto any object
@return T object with the
@throws android.database.sqlite.SQLiteException Error inserting
968321
@Override
    public synchronized T create(T dto) throws Exception {
        long rowid = db.insert(transformer.getTableName(),null,transformer.transform(dto));
        Log.i(this.getClass().getName(), "ROW ID: " + rowid);

        if (rowid == -1) throw new SQLiteException("Error inserting "+dto.getClass().toString());

        return transformer.setId(dto, (int)rowid);
    }
332071
@Override
    public synchronized T read(T dto) throws Exception {
        Cursor cursor = db.query(transformer.getTableName(), transformer.getFields(), transformer.getWhereClause(dto),null, null,null,null);
        T object = null;
        if (cursor.moveToFirst()){
            object = transformer.transform(cursor);
        }
        return object;
    }
1219220
@NonNull
  public static InsertInto insertInto(
      @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier table) {
    return new DefaultInsert(keyspace, table);
  }
109750
@NonNull
  public static InsertInto insertInto(@NonNull String table) {
    return insertInto(CqlIdentifier.fromCql(table));
  }
991239
@Help(help = "Create the object of type {#}")
  public T create(final T object) throws SDKException {
    return (T) requestPost(object);
  }
421317
public static <T> String getInsertSQL(T t, List<Object> values, boolean isWithNullValue) {
        StringBuilder sql = new StringBuilder("INSERT INTO ");

        Table table = DOInfoReader.getTable(t.getClass());
        List<Field> fields = DOInfoReader.getColumns(t.getClass());

        sql.append(getTableName(table)).append(" (");
        List<Object> _values = new ArrayList<Object>(); // 之所以增加一个临时变量，是避免values初始不是空的易错情况
        String fieldSql = joinAndGetValue(fields, ",", _values, t, isWithNullValue);
        sql.append(fieldSql);
        sql.append(") VALUES ");
        String dotSql = "(" + join("?", _values.size(), ",") + ")";
        sql.append(dotSql);
        values.addAll(_values);

        return sql.toString();
	}
29532
public List<Object> insertForGeneratedKeys(Entity record) throws SQLException {
		Connection conn = null;
		try {
			conn = this.getConnection();
			return runner.insertForGeneratedKeys(conn, record);
		} catch (SQLException e) {
			throw e;
		} finally {
			this.closeConnection(conn);
		}
	}
948380
static IDataModel toDataModel(final DataModelDto dto) {
        IDataModel dataModel = new DataModel(dto.name);
        dataModel.setDataModelId(new DataModelId(dto.dataModelId));
        
        for (Entry<String, Object> cell : dto.table.entrySet()) {
            ICellAddress address = new CellAddress(dataModel.getDataModelId(), fromA1Address(cell.getKey()));
            Object content = cell.getValue();
            
            DmCell dmcell = new DmCell();
            dmcell.setAddress(address);
            dmcell.setContent(CellValue.from(content));
            
            dataModel.setCell(address, dmcell);
        }
        
        for (Entry<String, Object> cell : dto.result.entrySet()) {
            Object value = cell.getValue();
            if (value == null) { continue; }
            
            ICellAddress address = new CellAddress(dataModel.getDataModelId(), fromA1Address(cell.getKey()));
            
            ((DmCell) dataModel.getCell(address)).setValue(Optional.of(CellValue.from(value)));
        }

        for (Entry<String, Object> entry : dto.getNames().entrySet()) {
            Object aliasValue = entry.getValue();
            
            if (isAddress(aliasValue)) {
                dataModel.setNamedAddress(entry.getKey(), fromA1Address((String) aliasValue));
            } else {
                dataModel.setNamedValue(entry.getKey(), CellValue.from(aliasValue));
            }
        }

        return dataModel;
    }
750818
public int insert(Entity record) throws SQLException {
		Connection conn = null;
		try {
			conn = this.getConnection();
			return runner.insert(conn, record);
		} catch (SQLException e) {
			throw e;
		} finally {
			this.closeConnection(conn);
		}
	}
1285403
def insert(self, **data):
        
        if self.where_clause:
            raise Invalid("Cannot insert with 'where' clause.")
        # Ensure that order is preserved
        data = data.items()
        cmd = "insert into {table} ({attrs}) values ({values})".format(
            table=self.table_name,
            attrs=", ".join(entry[0] for entry in data),
            values=", ".join(["?"] * len(data)),
        )
        handle = Repo.db.execute(cmd, [entry[1] for entry in data])
        # Return the id of the added row
        return handle.lastrowid
240501
public ConnectedCrud<T, K> table(DataSource dataSource, String table) throws SQLException {
        Connection connection = dataSource.getConnection();
        try {
            return new ConnectedCrud<T, K>(new DataSourceTransactionTemplate(dataSource), table(connection, table));
        } finally {
            connection.close();
        }
    }
918496
protected int doInsert(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) {
        //Setup the insert parameters and setter
        final List<Phrase> parametersInUse = insert_parameters != null ? insert_parameters : parameters;
        final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res);
        
        //Get the insert sql and execute the insert
        final String fInsertSql = (String) insert_sql.evaluate(req, res);
        return jdbcTemplate.update(fInsertSql, preparedStatementSetter);
    }
1321577
private Key insert(Entity entity) throws DatastoreException {
    CommitRequest req = CommitRequest.newBuilder()
	.addMutations(Mutation.newBuilder()
	    .setInsert(entity))
        .setMode(CommitRequest.Mode.NON_TRANSACTIONAL)
	.build();
    return datastore.commit(req).getMutationResults(0).getKey();
  }
679903
public synchronized void insert (Connection conn, T[] objects)
        throws SQLException
    {
        StringBuilder sql = new StringBuilder(
            "insert into " + name + " (" + listOfFields + ") values (?");
        for (int i = 1; i < nColumns; i++) {
            sql.append(",?");
        }
        sql.append(")");
        PreparedStatement insertStmt = conn.prepareStatement(sql.toString());
        for (int i = 0; i < objects.length; i++) {
            bindUpdateVariables(insertStmt, objects[i], null);
            insertStmt.addBatch();
        }
        insertStmt.executeBatch();
        insertStmt.close();
    }
454668
public ConnectedCrud<T, K> to(DataSource dataSource) throws SQLException {
        Connection connection = dataSource.getConnection();
        try {
            return new ConnectedCrud<T, K>(new DataSourceTransactionTemplate(dataSource), to(connection));
        } finally {
            connection.close();
        }
    }
641948
@NonNull
  public static InsertInto insertInto(@Nullable String keyspace, @NonNull String table) {
    return insertInto(
        keyspace == null ? null : CqlIdentifier.fromCql(keyspace), CqlIdentifier.fromCql(table));
  }
651015
protected void bufferInsertRow(String table, Object[][] row) throws IOException {
		StringBuffer sql = (StringBuffer)insertBuffers.get(table);
		if (sql != null) {
			if (traits.supportsMultiRowInsert() && (sql.length() < blockSize)) {
				sql.append(',');
				appendInsertValues(sql, row);
				return;
			} else {
				flushInsertBuffer(table);
			}
		}
		sql = new StringBuffer(blockSize);
		synchronized (sql) { //only for StringBuffer
			appendInsertStatement(sql, table, row);
			insertBuffers.put(table, sql);
		}
	}