static void Test(int prebind) { ODBC_BUF *odbc_buf = NULL; SQLLEN ind; int i; char buf[100]; /* build a string longer than 80 character (80 it's the default) */ buf[0] = 0; for (i = 0; i < 21; ++i) strcat(buf, "miao"); odbc_command("DELETE FROM #tmp1"); CHKAllocStmt(&stmt, "S"); SWAP_STMT(stmt); if (prebind) CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 1, 0, buf, 1, &ind, "S"); CHKPrepare(T("INSERT INTO #tmp1(c) VALUES(?)"), SQL_NTS, "S"); /* try to insert an empty string, should not fail */ /* NOTE this is currently the only test for insert a empty string using rpc */ if (odbc_db_is_microsoft()) TestInsert(""); TestInsert("a"); TestInsert("bb"); TestInsert(buf); CHKFreeStmt(SQL_DROP, "S"); odbc_stmt = SQL_NULL_HSTMT; SWAP_STMT(stmt); ODBC_FREE(); }
int main(int argc, char** argv) { TestInsert(); TestFindOrInsert(); return 0; }