从po对象中分析出insert语句
@param po
@return
@throws NoSuchMethodException
@throws SecurityException
974848
public static <T> SqlParamsPairs getInsertFromObject(T po) throws Exception{
		
		//用来存放insert语句
		StringBuffer insertSql = new StringBuffer();
		//用来存放?号的语句
		StringBuffer paramsSql = new StringBuffer();
		
		//用来存放参数值
		List<Object> params = new ArrayList<Object>();
		
		//分析表名
		String tableName = getTableName(po.getClass());
		
		insertSql.append("insert into " + tableName + " (");
		
		//计数器
		int count=0;
		
		//分析列
		Field[] fields = po.getClass().getDeclaredFields();
		for (int i = 0; i < fields.length; i++) {
			Field f = fields[i];
			
			if("serialVersionUID".equals(f.getName())){
				continue;
			}
			
			//获取具体参数值
			Method getter = getGetter(po.getClass(), f);
			
			if(getter == null){
				continue;
			}
			
			Object value = getter.invoke(po);
			if(value == null){
				//如果参数值是null就直接跳过（不允许覆盖为null值，规范要求更新的每个字段都要有值，没有值就是空字符串）
				continue;
			}
			
			Transient tranAnno = getter.getAnnotation(Transient.class);
			if(tranAnno != null){
				//如果有 Transient 标记直接跳过
				continue;
			}
			
			//获取字段名
			String columnName = getColumnNameFromGetter(getter, f);
			
			if(count!=0){
				insertSql.append(",");
			}
			insertSql.append(columnName);
			
			if(count!=0){
				paramsSql.append(",");
			}
			paramsSql.append("?");
			
			params.add(value);
			count++;
		}
		
		insertSql.append(") values (");
		insertSql.append(paramsSql + ")");
		
		SqlParamsPairs sqlAndParams = new SqlParamsPairs(insertSql.toString(), params.toArray());
		logger.debug(sqlAndParams.toString());
		
		return sqlAndParams;
		
	}
1367656
public JSONObject insert(Map<String, String> params) throws Exception {
		OperationAccess operationAccess = tableSchema.getInsertAccess();
		if( false == operationAccess.isAllowed() ) {
			throw new Exception("Attempting to insert a record while the privilege is not allowed: "+tableSchema.getLogicalName()+" ("+tableSchema.getPhysicalName()+")");
		}
		
		// Create a list of parameters to retrieve the row after it is
		// inserted
		List<RecordSelector> whereClauses = new Vector<RecordSelector>();

		// Create a list of all writable columns where a value is specified in
		// the parameters
		List<ColumnData> columnsWithParam = new Vector<ColumnData>();
		for(String columnName : params.keySet()) {
			ColumnData columnData = tableSchema.getColumnFromName(columnName);
			
			if( null != columnData && false == columnData.isWriteable() ) {
				columnData = null;
			}
			if( null != columnData && columnData.isAutoIncrementInteger() ) {
				columnData = null;
			}
			
			if( null == columnData ) {
				throw new Exception("No write access to column "+columnName+" in table "+tableSchema.getLogicalName()+" ("+tableSchema.getPhysicalName()+")");
			} else {
				columnsWithParam.add(columnData);
			}
		}
		
		// Get all columns that are auto fill
		List<ColumnData> autoIncrementIntegerColumns = new Vector<ColumnData>();
		for( ColumnData columnData : tableSchema.getColumns() ) {
			if( columnData.isAutoIncrementInteger() ) {
				autoIncrementIntegerColumns.add(columnData);
			}
		}
		
		// Get all columns that are assigned a value on insert
		List<ColumnData> valueAssignedColumns = new Vector<ColumnData>();
		for( ColumnData columnData : tableSchema.getColumns() ) {
			if( null != columnData.getAssignValueOnInsert() ) {
				valueAssignedColumns.add(columnData);
			} else if( null != columnData.getAssignVariableOnInsert() ) {
				valueAssignedColumns.add(columnData);
			}
		}
		
		// Sort according to column name. This offers greater reusability
		// of the prepared statement.
		Collections.sort(autoIncrementIntegerColumns,new ColumnDataComparator());
		Collections.sort(columnsWithParam,new ColumnDataComparator());
		Collections.sort(valueAssignedColumns,new ColumnDataComparator());
		
		// Obtain all auto increment integers
		List<Integer> autoIncrementIntegerValues = new Vector<Integer>();
		for( ColumnData autoIncrementIntegerColumn : autoIncrementIntegerColumns ) {
			int nextValue = ColumnDataUtils.obtainNextIncrementInteger(connection, autoIncrementIntegerColumn);
			Integer value = new Integer(nextValue);
			autoIncrementIntegerValues.add( value );
			whereClauses.add(
				new RecordSelectorComparison(
					autoIncrementIntegerColumn.getColumnName()
					,RecordSelectorComparison.Comparison.EQUAL
					,new ExpressionConstantImpl(value.toString()) ) );
		}
		
		// Create SQL command
		String sqlQuery = null;
		PreparedStatement pstmt = null;
		{
			StringWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			pw.print("INSERT INTO ");
			pw.print(tableSchema.getPhysicalName());
			pw.print(" (");
			boolean first = true;
			for(ColumnData columnData : autoIncrementIntegerColumns) {
				if( first ) {
					first = false;
				} else {
					pw.print(",");
				}
				pw.print(columnData.getColumnName());
			}
			for(ColumnData columnData : columnsWithParam) {
				if( first ) {
					first = false;
				} else {
					pw.print(",");
				}
				pw.print(columnData.getColumnName());
			}
			for(ColumnData columnData : valueAssignedColumns) {
				if( first ) {
					first = false;
				} else {
					pw.print(",");
				}
				pw.print(columnData.getColumnName());
			}
			pw.print(") VALUES (");
			first = true;
			for(ColumnData columnData : autoIncrementIntegerColumns) {
				if( first ) {
					first = false;
				} else {
					pw.print(",");
				}
				pw.print(columnData.getInsertWildcard());
			}
			for(ColumnData columnData : columnsWithParam) {
				if( first ) {
					first = false;
				} else {
					pw.print(",");
				}
				pw.print(columnData.getInsertWildcard());
			}
			for(ColumnData columnData : valueAssignedColumns) {
				if( first ) {
					first = false;
				} else {
					pw.print(",");
				}
				pw.print(columnData.getInsertWildcard());
			}
			pw.print(");");
			pw.flush();
			
			sqlQuery = sw.toString();
			pstmt = connection.prepareStatement(sqlQuery);
			
			// Populate prepared statement
			int index = 1;
			for(Integer integerValue : autoIncrementIntegerValues) {
				pstmt.setInt(index, integerValue.intValue());
				
				++index;
			}
			for(ColumnData columnData : columnsWithParam) {
				// Compute value
				String value = params.get(columnData.getColumnName());
				
				ColumnDataUtils.writeToPreparedStatement(pstmt, index, value, columnData.getColumnType());
				
				++index;
			}
			for(ColumnData columnData : valueAssignedColumns) {
				String value = columnData.getAssignValueOnInsert();
				if( null == value && null != columnData.getAssignVariableOnInsert() ) {
					value = variables.getVariableValue( columnData.getAssignVariableOnInsert() );
				}
				ColumnDataUtils.writeToPreparedStatement(pstmt, index, value, columnData.getColumnType());
				
				++index;
			}
		}
		
		// If there are no selector, there is no point in inserting the data since
		// we will not be able to retrieve it
		if( whereClauses.size() < 1 ) {
			throw new Exception("Refusing to insert data since it can not be selected: "+sqlQuery);
		}
		
		// Execute insert
		pstmt.execute();

		// Now, we need to retrieve the object
		JSONArray array = query(whereClauses, null, null,null,null,null);
		
		// In INSERT, we expect only one element in array
		if( 1 != array.length() ) {
			throw new Exception("Expected only one element returned in an INSERT. Returned size:"+array.length()+" sql: "+sqlQuery);
		}
		
		return array.getJSONObject(0);
	}
941399
public StringBuffer format(Object pObj, StringBuffer pToAppendTo,
			       FieldPosition pPos) {
	if (!(pObj instanceof Time)) {
	    throw new IllegalArgumentException("Must be instance of " + Time.class);
	}

	return pToAppendTo.append(format(pObj));
    }
569683
public Location save(Location o) {
		final String update = "update Location set name = ?, address = ?";
		if (o.getId() != null) {
			// this is an update
			getSimpleJdbcTemplate().update(update, o.getName(), o.getAddress());
		}
		else {
			// this is an insert
			Map<String, Object> args = new HashMap<String, Object>(2);
			args.put("name", o.getName());
			args.put("address", o.getAddress());
			Number id = insertLocation.executeAndReturnKey(args);
			o.setId(id.longValue());
		}
		return o;
	}
497038
@Override
    public BoundStatement bindInsert(PreparedStatement statement, P pojo, int ttl) {
        List<Object> parameters = new LinkedList<>();
        keyBinding.collectParameters(pojo, parameters);
        facetBindings.forEach(facetBinding -> facetBinding.collectParameters(pojo, parameters));
        parameters.add(ttl);
        return bind(statement, parameters);
    }
581272
private void generateInsert(M2MEntity entity, String packageName) {
		if (!isMethodAlreadyDefined(entity, "insert")) {
			// @formatter:off
			MethodSpec methodSpec = MethodSpec.methodBuilder("insert").addModifiers(Modifier.PUBLIC)
					.addModifiers(Modifier.ABSTRACT).addAnnotation(AnnotationSpec.builder(BindSqlInsert.class).build())
					.addParameter(ParameterSpec.builder(TypeUtility.className(packageName, entity.name), "bean")
							.addAnnotation(
									AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", "bean").build())
							.build())
					.returns(Integer.TYPE).build();
			// @formatter:on
			classBuilder.addMethod(methodSpec);
		}
	}
692683
public void order_orderId_pay_POST(Long orderId, OvhPayWithPaymentMethod paymentMethod) throws IOException {
		String qPath = "/me/order/{orderId}/pay";
		StringBuilder sb = path(qPath, orderId);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "paymentMethod", paymentMethod);
		exec(qPath, "POST", sb.toString(), o);
	}
549072
@Override
	public <P extends ParaObject> String create(P so) {
		return create(Config.getRootAppIdentifier(), so);
	}
972144
private static Object invokeJavaOptionalOf(Object o) {
    try {
      return JAVA_OPTIONAL_OF_METHOD.invoke(null, o);
    } catch (IllegalAccessException e) {
      throw new SecurityException(e);
    } catch (IllegalArgumentException e) {
      throw new IllegalStateException(e);
    } catch (InvocationTargetException e) {
      throw Throwables.propagate(e.getCause());
    }
  }
429401
public int insert(String sql, Object value) {
        Class<?> parameterType = value != null ? value.getClass() : null;
        String msId = msUtils.insertDynamic(sql, parameterType);
        return sqlSession.insert(msId, value);
    }
239651
public static String insert(final String str, final String c, final int pos) {
    if (str.length() < pos) { return str; }
    return str.substring(0, pos - 1) + c + str.substring(pos);
  }
651182
public int insertOutput(byte[] str, int strP, int strLen, byte[] strEncoding) {
        byte[] insertEncoding = encodingToInsertOutput();
        byte[] insertBuf = null;

        started = true;

        if (strLen == 0) return 0;

        final byte[] insertStr;
        final int insertP;
        final int insertLen;
        if (caseInsensitiveEquals(insertEncoding, strEncoding)) {
            insertStr = str;
            insertP = 0;
            insertLen = strLen;
        } else {
            Ptr insertLenP = new Ptr();
            insertBuf = new byte[4096]; // FIXME: wasteful
            insertStr = allocateConvertedString(strEncoding, insertEncoding, str, strP, strLen, insertBuf, insertLenP);
            insertLen = insertLenP.p;
            insertP = insertStr == str ? strP : 0;
            if (insertStr == null) return -1;
        }

        int need = insertLen;

        final int lastTranscodingIndex = numTranscoders - 1;
        final Transcoding transcoding;

        Buffer buf;

        if (numTranscoders == 0) {
            transcoding = null;
            buf = inBuf;
        } else if (elements[lastTranscodingIndex].transcoding.transcoder.compatibility.isEncoder()) {
            transcoding = elements[lastTranscodingIndex].transcoding;
            need += transcoding.readAgainLength;
            if (need < insertLen) return -1;

            if (lastTranscodingIndex == 0) {
                buf = inBuf;
            } else {
                buf = elements[lastTranscodingIndex - 1];
            }
        } else {
            transcoding = elements[lastTranscodingIndex].transcoding;
            buf = elements[lastTranscodingIndex];
        }

        if (buf == null) {
            buf = new Buffer();
            buf.allocate(need);
        } else if (buf.bytes == null) {
            buf.allocate(need);
        } else if ((buf.bufEnd - buf.dataEnd) < need) {
            // try to compact buffer by moving data portion back to bufStart
            System.arraycopy(buf.bytes, buf.dataStart, buf.bytes, buf.bufStart, buf.dataEnd - buf.dataStart);
            buf.dataEnd = buf.bufStart + (buf.dataEnd - buf.dataStart);
            buf.dataStart = buf.bufStart;

            if ((buf.bufEnd - buf.dataEnd) < need) {
                // still not enough room; use a separate buffer
                int s = (buf.dataEnd - buf.bufStart) + need;
                if (s < need) return -1;
                Buffer buf2 = buf = new Buffer();
                buf2.allocate(s);
                System.arraycopy(buf.bytes, buf.bufStart, buf2.bytes, 0, s); // ??
                buf2.dataStart = 0;
                buf2.dataEnd = buf.dataEnd - buf.bufStart;
            }
        }

        System.arraycopy(insertStr, insertP, buf.bytes, buf.dataEnd, insertLen);
        buf.dataEnd += insertLen;
        if (transcoding != null && transcoding.transcoder.compatibility.isEncoder()) {
            System.arraycopy(transcoding.readBuf, transcoding.recognizedLength, buf.bytes, buf.dataEnd, transcoding.readAgainLength);
            buf.dataEnd += transcoding.readAgainLength;
            transcoding.readAgainLength = 0;
        }

        return 0;
    }
49988
public static void setAutoIncreamentIdValue(Object po,String autoGeneratedId,Object idValue) throws Exception, NoSuchMethodException{
		String setterName = "set" + StringUtils.capitalize(autoGeneratedId);
		Method setter = po.getClass().getDeclaredMethod(setterName, idValue.getClass());
		setter.invoke(po, idValue);
	}
316789
protected <V> V execute (Operation<V> op)
        throws PersistenceException
    {
        return execute(op, true, true);
    }
635343
public static String insertColumns(Class<?> entityClass, boolean skipId, boolean notNull, boolean notEmpty) {
        StringBuilder sql = new StringBuilder();
        sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">");
        //获取全部列
        Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass);
        //当某个列有主键策略时，不需要考虑他的属性是否为空，因为如果为空，一定会根据主键策略给他生成一个值
        for (EntityColumn column : columnSet) {
            if (!column.isInsertable()) {
                continue;
            }
            if (skipId && column.isId()) {
                continue;
            }
            if (notNull) {
                sql.append(SqlHelper.getIfNotNull(column, column.getColumn() + ",", notEmpty));
            } else {
                sql.append(column.getColumn() + ",");
            }
        }
        sql.append("</trim>");
        return sql.toString();
    }
342869
public static String post(
      String serverUrl, String realData, int connectTimeout, int readTimeout, String charset)
      throws NoSuchAlgorithmException, KeyManagementException, IOException {
    if (serverUrl == null || "".equals(serverUrl.trim())) {
      throw new NullPointerException("请求地址为空!");
    }
    if (realData == null || "".equals(realData.trim())) {
      throw new NullPointerException("请求数据为空!");
    }
    URLConnection conn;
    // 分别调用http或https请求
    if (serverUrl.startsWith(HTTPS_PREFIX)) {
      SSLContext sslContext = SSLContext.getInstance("TLS");
      X509TrustManager[] xtmArray = new X509TrustManager[] {xtm};
      sslContext.init(null, xtmArray, new java.security.SecureRandom());
      HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
      HttpsURLConnection.setDefaultHostnameVerifier(hnv);
      HttpsURLConnection httpsUrlConn = (HttpsURLConnection) (new URL(serverUrl)).openConnection();
      httpsUrlConn.setRequestMethod("POST");
      conn = httpsUrlConn;
    } else {
      URL url = new URL(serverUrl);
      conn = url.openConnection();
    }
    conn.setConnectTimeout(connectTimeout * 1000);
    conn.setReadTimeout(readTimeout * 1000);
    conn.setRequestProperty("Content-Type", "application/json;charset=" + charset);

    conn.setDoOutput(true);
    conn.setDoInput(true);

    OutputStream out = conn.getOutputStream();
    try {
      out.write(realData.getBytes(charset));
      out.flush();
    } finally {
      out.close();
    }

    InputStream is = conn.getInputStream();
    // 返回收到的响应数据
    return getResponseStringData(is, charset);
  }
323418
public static void insert (@Nonnull final CharSequence aSeq, final int nIndex, final int nCodepoint)
  {
    if (!(aSeq instanceof StringBuilder))
    {
      insert (new StringBuilder (aSeq), nIndex, nCodepoint);
    }
    else
    {
      int nI = nIndex;
      if (nI > 0 && nI < aSeq.length ())
      {
        final char ch = aSeq.charAt (nI);
        final boolean low = Character.isLowSurrogate (ch);
        if (low && Character.isHighSurrogate (aSeq.charAt (nI - 1)))
        {
          nI--;
        }
      }
      ((StringBuilder) aSeq).insert (nI, Character.toChars (nCodepoint));
    }
  }