'prepareStatement'使用Google Apps脚本将数据从Google Spreadsheet导入Mysql数据库

时间:2019-03-15 22:20:19

标签: sql jdbc google-apps-script

以下是JDBC Google Apps脚本文档中的示例文档

/**
 * Write one row of data to a table.
 */
function writeOneRecord() {
  var conn = Jdbc.getCloudSqlConnection(dbUrl, user, userPwd);

  var stmt = conn.prepareStatement('INSERT INTO entries '
      + '(guestName, content) values (?, ?)');
  stmt.setString(1, 'First Guest');
  stmt.setString(2, 'Hello, world');
  stmt.execute();
}

有人可以向我解释这一行conn.prepareStatement('INSERT INTO entries ' + '(guestName, content) values (?, ?)');

尤其是如果我想更新以下数据集该怎么做

ID   dimension1   dimension2   Metrics1   Metrics2
111  foo          foofoo       10         1,4
222  bar          barbar       11         1,7
333  foobar       foobarbar    12         10,1
444  barfoo       barbarfoo    13         12,3

谢谢

0 个答案:

没有答案