ODBC Driver for IBM Cloud Data Engine

Build 23.0.8839

パラメータ化されたステートメント

次のコード例は、パラメータをバインドしてパラメータ化されたステートメントを作成する方法を示します。

シングルユース ステートメント

RODBCext のsqlExecute 関数は、クエリパラメータを値にバインドするための追加のデータフレームを受け入れます。

sqlExecute(
    cnx,
    query = "SELECT Id, Status FROM [CloudObjectStorage_1].[SampleBucket_1].Jobs WHERE UserId = ?",
    data = data.frame("gentit@cdata.com")
)

results <- sqlGetResults(cnx, max = 1000)
while (is.data.frame(results)) {
    for (row in 1:nrow(results)) {
        cat(paste("Id = ", results[row,]$Id, "\n"))
        cat(paste("Status = ", results[row,]$Status, "\n"))
    }
    results <- sqlGetResults(cnx, max = 1000)
}

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839