returned by the query.  In the case of an insert, returns null.
513898
public static List<List<Object>> runInsertSelect(
      DBConnectionFactory connectionFactory, String sql,
    List<Object> sqlParams, boolean isWrite, int numRetries,
    int retryMaxInternalSec, boolean insert, boolean getGeneratedKeys)
        throws IOException {
    int waitMS = 3000; // wait for at least 3s before next retry.
    for (int i = 0; i < numRetries; ++i) {
      Connection conn = null;
      ResultSet generatedKeys = null;
      PreparedStatement pstmt = null;
      String url = null;
      try {
        try {
          url = connectionFactory.getUrl(isWrite);
        } catch (IOException ioe) {
          LOG.warn("Cannot get DB URL, fall back to the default one", ioe);
          url = defaultUrls.get(isWrite);
          if (url == null) {
            throw ioe;
          }
        }
        LOG.info("Attepting connection with URL " + url);
        conn = connectionFactory.getConnection(url);
        defaultUrls.put(isWrite, url);
        pstmt = getPreparedStatement(conn, sql, sqlParams,
            getGeneratedKeys);
        if (insert) {
          int recordsUpdated = pstmt.executeUpdate();
          LOG.info("rows inserted: " + recordsUpdated + " sql: " + sql);
          List<List<Object>> results = null;
          if (getGeneratedKeys) {
            generatedKeys = pstmt.getGeneratedKeys();
            results = getResults(generatedKeys);
          }
          Thread.sleep(connectionFactory.getDBOpsSleepTime() +
              rand.nextInt(1000));
          return results;
        }
        else {
          generatedKeys = pstmt.executeQuery();
          List<List<Object>> results = getResults(generatedKeys);
          pstmt.clearBatch();
          LOG.info("rows selected: " + results.size() + " sql: " + sql);
          Thread.sleep(connectionFactory.getDBOpsSleepTime() +
              rand.nextInt(1000));
          return results;
        }
      } catch (Exception e) {
        // We should catch a better exception than Exception, but since
        // DBConnectionUrlFactory.getUrl() defines throws Exception, it's hard
        // for us to figure out the complete set it can throw. We follow
        // DBConnectionUrlFactory.getUrl()'s definition to catch Exception.
        // It shouldn't be a big problem as after numRetries, we anyway exit.
        LOG.info("Exception " + e + ". Will retry " + (numRetries - i)
            + " times.");
        // Introducing a random factor to the wait time before another retry.
        // The wait time is dependent on # of failures and a random factor.
        // At the first time of getting a SQLException, the wait time
        // is a random number between [0,300] msec. If the first retry
        // still fails, we will wait 300 msec grace period before the 2nd retry.
        // Also at the second retry, the waiting window is expanded to 600 msec
        // alleviating the request rate from the server. Similarly the 3rd retry
        // will wait 600 msec grace period before retry and the waiting window
        // is
        // expanded to 1200 msec.

        waitMS += waitMS;
        if (waitMS > retryMaxInternalSec * 1000) {
          waitMS = retryMaxInternalSec * 1000;
        }
        double waitTime = waitMS + waitMS * rand.nextDouble();
        if (i + 1 == numRetries) {
          LOG.error("Still got Exception after " + numRetries + "  retries.",
              e);
          throw new IOException(e);
        }
        try {
          Thread.sleep((long) waitTime);
        } catch (InterruptedException ie) {
          throw new IOException(ie);
        }
      } finally {
        DBUtils.close(generatedKeys, new PreparedStatement[]{pstmt}, conn);
      }
    }
    return null;
  }
1090996
function () {
            var values = this.__opts.values, ret = [];
            if (isArray(values)) {
                ret.push(values.length === 0 ? " DEFAULT VALUES" : " VALUES " + this.literal(values));
            } else if (isInstanceOf(values, Dataset)) {
                ret.push(" " + this._subselectSql(values));
            } else if (isInstanceOf(values, LiteralString)) {
                ret.push(" " + values.toString(this));
            } else {
                throw new QueryError("Unsupported INSERT values type, should be an array or dataset");
            }
            return ret.join("");
        }
746436
@Override
  public MtasSpanQuery getQuery() throws ParseException {
    MtasSpanQuery q = null;
    // match any word (try to avoid...)
    if (wordCondition.isEmpty()) {
      q = new MtasSpanMatchAllQuery(wordCondition.field());
      // only positive queries
    } else if (wordCondition.isSimplePositive()) {
      if (wordCondition.isSingle()) {
        q = wordCondition.getPositiveQuery(0);
      } else {
        if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
          q = new MtasSpanAndQuery(wordCondition.getPositiveQuery().toArray(
              new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        } else if (wordCondition.type()
            .equals(MtasCQLParserWordCondition.TYPE_OR)) {
          q = new MtasSpanOrQuery(wordCondition.getPositiveQuery().toArray(
              new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        } else {
          throw new ParseException("unknown type " + wordCondition.type());
        }
      }
      // only negative queries
    } else if (wordCondition.isSimpleNegative()) {
      throw new ParseException("shouldn't be simple negative");
      // both positive and negative queries
    } else {
      if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
        MtasSpanQuery qPositive;
        MtasSpanQuery qNegative;
        if (wordCondition.getPositiveQuery().size() == 1) {
          qPositive = wordCondition.getPositiveQuery(0);
        } else {
          qPositive = new MtasSpanAndQuery(
              wordCondition.getPositiveQuery().toArray(
                  new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        }
        if (wordCondition.getNegativeQuery().size() == 1) {
          qNegative = wordCondition.getNegativeQuery(0);
        } else {
          qNegative = new MtasSpanOrQuery(
              wordCondition.getNegativeQuery().toArray(
                  new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
        }
        q = new MtasSpanNotQuery(qPositive, qNegative);
      } else if (wordCondition.type()
          .equals(MtasCQLParserWordCondition.TYPE_OR)) {
        MtasSpanQuery qPositive;
        MtasSpanQuery qNegative;
        if (wordCondition.getPositiveQuery().size() == 1) {
          qPositive = wordCondition.getPositiveQuery(0);
        } else {
          qPositive = new MtasSpanOrQuery(
              wordCondition.getPositiveQuery().toArray(
                  new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
        }
        if (wordCondition.getNegativeQuery().size() == 1) {
          qNegative = wordCondition.getNegativeQuery(0);
        } else {
          qNegative = new MtasSpanAndQuery(
              wordCondition.getNegativeQuery().toArray(
                  new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
        }
        q = new MtasSpanNotQuery(qPositive, qNegative);
      } else {
        throw new ParseException("unknown type " + wordCondition.type());
      }
    }
    if (not) {
      MtasSpanQuery qPositive = new MtasSpanMatchAllQuery(
          wordCondition.field());
      q = new MtasSpanNotQuery(qPositive, q);
    }
    return q;
  }
886275
public void executeInsert(ClassDescriptor cld, Object obj) throws PersistenceBrokerException
    {
        if (logger.isDebugEnabled())
        {
            logger.debug("executeInsert: " + obj);
        }
        final StatementManagerIF sm = broker.serviceStatementManager();
        PreparedStatement stmt = null;
        try
        {
            stmt = sm.getInsertStatement(cld);
            if (stmt == null)
            {
                logger.error("getInsertStatement returned a null statement");
                throw new PersistenceBrokerException("getInsertStatement returned a null statement");
            }
            // before bind values perform autoincrement sequence columns
            assignAutoincrementSequences(cld, obj);
            sm.bindInsert(stmt, cld, obj);
            if (logger.isDebugEnabled())
                logger.debug("executeInsert: " + stmt);
            stmt.executeUpdate();
            // after insert read and assign identity columns
            assignAutoincrementIdentityColumns(cld, obj);

            // Harvest any return values.
            harvestReturnValues(cld.getInsertProcedure(), obj, stmt);
        }
        catch (PersistenceBrokerException e)
        {
            logger.error("PersistenceBrokerException during the execution of the insert: " + e.getMessage(), e);
            throw e;
        }
        catch(SequenceManagerException e)
        {
            throw new PersistenceBrokerException("Error while try to assign identity value", e);
        }
        catch (SQLException e)
        {
            final String sql = broker.serviceSqlGenerator().getPreparedInsertStatement(cld).getStatement();
            throw ExceptionHelper.generateException(e, sql, cld, logger, obj);
        }
        finally
        {
            sm.closeResources(stmt, null);
        }
    }
769782
def insert(self):
        """"""
        self.default_val = 0
        #fields = self.fields
        #fields = self.orm_class.depart(self.fields, is_update=False)
        #self.set_fields(fields)
        return self.interface.insert(
            self.schema,
            self.fields
        )

        return self.interface.insert(self.schema, self.fields)
360016
function(element, query) {
        if (!query) {
            return null;
        }

        element = $(element);

        if ($.type(query) === 'function') {
            return query.call(this, element);
        }

        return element.attr(query);
    }
824251
function insertQueryError(err, tx) {
        CRUD.stats.writesExecuted++;
        console.error("Insert query error: ", err);
        return err;
    }
1178267
public static int getGeneratedKey(PreparedStatement statement) throws DatabaseException {
        ResultSet rs = null;
        int id = 0;
        try {
            rs = statement.getGeneratedKeys();
            if (!rs.next()) {
                throw new DatabaseException("Unable to get primary key for inserted row");
            }
            id = rs.getInt(1);
        } catch (SQLException ex) {
            throw new DatabaseException("Unable to get primary key for inserted row");
        } finally {
            closeResultSet(rs);
        }
        return id;
    }
569573
@NotNull
    public T queryNN() throws SQLException {
        T res = null;
        try (ResultSet r = statement.executeQuery()) {
            if (r.next()) {
                res = resultMapper.map(r);
            }
            Objects.requireNonNull(res);
            return res;
        }
    }
428342
protected T getSingleResult(Query q) {
		try {
			@SuppressWarnings("unchecked")
			T retVal = (T) q.getSingleResult();
			return retVal;
		} catch (NoResultException e) {
			return null;
		}
	}
119351
protected final Object getValueFromResultSet( ResultSet pResultSet ) throws SQLException
  {
    if( !pResultSet.next() )
    {
      if( _returnNullInsteadOfNoDataFoundException )
      {
        return null;
      }

      throw new NoDataFoundException();
    }

    return pResultSet.getObject( getObjectIndex() );
  }
1051049
private boolean query()
		throws SQLException
	{
		statement = this.connection.createStatement();

		String query = "SELECT PrimaryKey, RevisionCounter,"
				+ " RevisionID, ArticleID, Timestamp, FullRevisionID "
				+ "FROM revisions";

		if (primaryKey > 0) {
			query += " WHERE PrimaryKey > " + primaryKey;
		}

		if (MAX_NUMBER_RESULTS > 0) {
			query += " LIMIT " + MAX_NUMBER_RESULTS;
		}

		result = statement.executeQuery(query);
		return result.next();
	}
722874
public String getSQLInsert(boolean bUseCurrentValues)
    {
        String strRecordset = this.getBaseRecord().makeTableNames(false);
        String strFields = this.getBaseRecord().getSQLFields(DBConstants.SQL_INSERT_TABLE_TYPE, bUseCurrentValues);
        String strValues = this.getBaseRecord().getSQLFields(DBConstants.SQL_INSERT_VALUE_TYPE, bUseCurrentValues);

        strRecordset = "INSERT INTO " + strRecordset + "(" + strFields + ") VALUES (" + strValues + ")";

        return strRecordset;
    }
5630
def _simpleQuery(self, query):
        
        cur = self._conn.cursor()
        cur.execute(query)
        row = cur.fetchone()
        return util.parse_value(row[0])
273981
private function getInsertQuery()
    {
        return 'INSERT INTO '.$this->parts['from'][0]['table'].
               ' ('.implode(', ', array_keys($this->parts['set'])).')'.
               ' VALUES'.
               ' ('.implode(', ', $this->parts['set']).')';
    }
1289008
public void bindInsert(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws java.sql.SQLException
    {
        ValueContainer[] values;
        cld.updateLockingValues(obj); // BRJ : provide useful defaults for locking fields

        if (cld.getInsertProcedure() != null)
        {
            this.bindProcedure(stmt, cld, obj, cld.getInsertProcedure());
        }
        else
        {
            values = getAllValues(cld, obj);
            for (int i = 0; i < values.length; i++)
            {
                setObjectForStatement(stmt, i + 1, values[i].getValue(), values[i].getJdbcType().getType());
            }
        }
    }
356083
@Override
  protected void insertEntity(DbEntityOperation operation) {

    final DbEntity dbEntity = operation.getEntity();

    // get statement
    String insertStatement = dbSqlSessionFactory.getInsertStatement(dbEntity);
    insertStatement = dbSqlSessionFactory.mapStatement(insertStatement);
    ensureNotNull("no insert statement for " + dbEntity.getClass() + " in the ibatis mapping files", "insertStatement", insertStatement);

    // execute the insert
    executeInsertEntity(insertStatement, dbEntity);

    // perform post insert actions on entity
    entityInserted(dbEntity);
  }