2
0

OdbcCommandBuilderTest.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. // OdbcCommandBuilderTest.cs - NUnit Test Cases for testing the
  2. // OdbcCommandBuilder Test.
  3. //
  4. // Authors:
  5. // Sureshkumar T ([email protected])
  6. //
  7. // Copyright (c) 2004 Novell Inc., and the individuals listed on the
  8. // ChangeLog entries.
  9. //
  10. //
  11. // Permission is hereby granted, free of charge, to any person
  12. // obtaining a copy of this software and associated documentation
  13. // files (the "Software"), to deal in the Software without
  14. // restriction, including without limitation the rights to use, copy,
  15. // modify, merge, publish, distribute, sublicense, and/or sell copies
  16. // of the Software, and to permit persons to whom the Software is
  17. // furnished to do so, subject to the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  26. // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29. // SOFTWARE.
  30. using System;
  31. using System.Data;
  32. using System.Data.Common;
  33. using System.Data.Odbc;
  34. using Mono.Data;
  35. using NUnit.Framework;
  36. namespace MonoTests.System.Data
  37. {
  38. [TestFixture]
  39. [Category ("odbc")]
  40. public class OdbcCommandBuilderTest
  41. {
  42. [Test]
  43. public void GetInsertCommandTest ()
  44. {
  45. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  46. OdbcCommand cmd = null;
  47. try {
  48. string selectQuery = "select id, lname from employee where id = 3";
  49. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  50. DataSet ds = new DataSet ();
  51. da.Fill (ds, "IntTest");
  52. Assert.AreEqual (1, ds.Tables.Count);
  53. OdbcCommandBuilder cb;
  54. cb = new OdbcCommandBuilder (da);
  55. cmd = cb.GetInsertCommand ();
  56. #if NET_2_0
  57. Assert.AreEqual ("INSERT INTO employee (id, lname) VALUES (?, ?)",
  58. cmd.CommandText, "#A1");
  59. #else
  60. Assert.AreEqual ("INSERT INTO employee( id , lname ) VALUES ( ? , ? )",
  61. cmd.CommandText, "#A1");
  62. #endif
  63. Assert.AreSame (conn, cmd.Connection, "#A2");
  64. AssertInsertParameters (cmd, "#A3:");
  65. cb = new OdbcCommandBuilder (da);
  66. cb.QuotePrefix = "\"";
  67. cmd = cb.GetInsertCommand ();
  68. #if NET_2_0
  69. Assert.AreEqual ("INSERT INTO \"employee (\"id, \"lname) VALUES (?, ?)",
  70. cmd.CommandText, "#B1");
  71. #else
  72. Assert.AreEqual ("INSERT INTO \"employee( \"id , \"lname ) VALUES ( ? , ? )",
  73. cmd.CommandText, "#B1");
  74. #endif
  75. Assert.AreSame (conn, cmd.Connection, "#B2");
  76. AssertInsertParameters (cmd, "#B3:");
  77. cb = new OdbcCommandBuilder (da);
  78. cb.QuoteSuffix = "´";
  79. cmd = cb.GetInsertCommand ();
  80. #if NET_2_0
  81. Assert.AreEqual ("INSERT INTO employee´ (id´, lname´) VALUES (?, ?)",
  82. cmd.CommandText, "#C1");
  83. #else
  84. Assert.AreEqual ("INSERT INTO employee´( id´ , lname´ ) VALUES ( ? , ? )",
  85. cmd.CommandText, "#C1");
  86. #endif
  87. Assert.AreSame (conn, cmd.Connection, "#C2");
  88. AssertInsertParameters (cmd, "#C3:");
  89. cb = new OdbcCommandBuilder (da);
  90. cb.QuotePrefix = "\"";
  91. cb.QuoteSuffix = "´";
  92. cmd = cb.GetInsertCommand ();
  93. #if NET_2_0
  94. Assert.AreEqual ("INSERT INTO \"employee´ (\"id´, \"lname´) VALUES (?, ?)",
  95. cmd.CommandText, "#D1");
  96. #else
  97. Assert.AreEqual ("INSERT INTO \"employee´( \"id´ , \"lname´ ) VALUES ( ? , ? )",
  98. cmd.CommandText, "#D1");
  99. #endif
  100. Assert.AreSame (conn, cmd.Connection, "#D2");
  101. AssertInsertParameters (cmd, "#D3:");
  102. } finally {
  103. if (cmd != null)
  104. cmd.Dispose ();
  105. ConnectionManager.Singleton.CloseConnection ();
  106. }
  107. }
  108. [Test]
  109. public void GetInsertCommandTestWithExpression ()
  110. {
  111. if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
  112. Assert.Ignore ("Schema info from MySQL is incomplete");
  113. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  114. OdbcCommand cmd = null;
  115. try {
  116. string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
  117. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  118. DataSet ds = new DataSet ();
  119. da.Fill (ds, "IntTest");
  120. Assert.AreEqual (1, ds.Tables.Count);
  121. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  122. cmd = cb.GetInsertCommand ();
  123. #if NET_2_0
  124. Assert.AreEqual ("INSERT INTO employee (id, lname) VALUES (?, ?)",
  125. cmd.CommandText, "#1");
  126. #else
  127. Assert.AreEqual ("INSERT INTO employee( id , lname ) VALUES ( ? , ? )",
  128. cmd.CommandText, "#1");
  129. #endif
  130. Assert.AreSame (conn, cmd.Connection, "#2");
  131. AssertInsertParameters (cmd, "#3:");
  132. } finally {
  133. if (cmd != null)
  134. cmd.Dispose ();
  135. ConnectionManager.Singleton.CloseConnection ();
  136. }
  137. }
  138. [Test]
  139. public void GetUpdateCommandTest ()
  140. {
  141. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  142. OdbcCommand cmd = null;
  143. try {
  144. string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
  145. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  146. DataSet ds = new DataSet ();
  147. da.Fill (ds, "IntTest");
  148. Assert.AreEqual (1, ds.Tables.Count);
  149. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  150. cmd = cb.GetUpdateCommand ();
  151. #if NET_2_0
  152. Assert.AreEqual ("UPDATE employee SET id = ?, lname = ? WHERE ((id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)))",
  153. cmd.CommandText, "#A1");
  154. #else
  155. Assert.AreEqual ("UPDATE employee SET id = ? , lname = ? WHERE ( (id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)) )",
  156. cmd.CommandText, "#A1");
  157. #endif
  158. Assert.AreSame (conn, cmd.Connection, "#A2");
  159. AssertUpdateParameters (cmd, "#A3:");
  160. cb = new OdbcCommandBuilder (da);
  161. cb.QuotePrefix = "\"";
  162. cmd = cb.GetUpdateCommand ();
  163. #if NET_2_0
  164. Assert.AreEqual ("UPDATE \"employee SET \"id = ?, \"lname = ? WHERE ((\"id = ?) AND ((? = 1 AND \"lname IS NULL) OR (\"lname = ?)))",
  165. cmd.CommandText, "#B1");
  166. #else
  167. Assert.AreEqual ("UPDATE \"employee SET \"id = ? , \"lname = ? WHERE ( (\"id = ?) AND ((? = 1 AND \"lname IS NULL) OR (\"lname = ?)) )",
  168. cmd.CommandText, "#B1");
  169. #endif
  170. Assert.AreSame (conn, cmd.Connection, "#B2");
  171. AssertUpdateParameters (cmd, "#B3:");
  172. cb = new OdbcCommandBuilder (da);
  173. cb.QuoteSuffix = "´";
  174. cmd = cb.GetUpdateCommand ();
  175. #if NET_2_0
  176. Assert.AreEqual ("UPDATE employee´ SET id´ = ?, lname´ = ? WHERE ((id´ = ?) AND ((? = 1 AND lname´ IS NULL) OR (lname´ = ?)))",
  177. cmd.CommandText, "#C1");
  178. #else
  179. Assert.AreEqual ("UPDATE employee´ SET id´ = ? , lname´ = ? WHERE ( (id´ = ?) AND ((? = 1 AND lname´ IS NULL) OR (lname´ = ?)) )",
  180. cmd.CommandText, "#C1");
  181. #endif
  182. Assert.AreSame (conn, cmd.Connection, "#C2");
  183. AssertUpdateParameters (cmd, "#C3:");
  184. cb = new OdbcCommandBuilder (da);
  185. cb.QuotePrefix = "\"";
  186. cb.QuoteSuffix = "´";
  187. cmd = cb.GetUpdateCommand ();
  188. #if NET_2_0
  189. Assert.AreEqual ("UPDATE \"employee´ SET \"id´ = ?, \"lname´ = ? WHERE ((\"id´ = ?) AND ((? = 1 AND \"lname´ IS NULL) OR (\"lname´ = ?)))",
  190. cmd.CommandText, "#D1");
  191. #else
  192. Assert.AreEqual ("UPDATE \"employee´ SET \"id´ = ? , \"lname´ = ? WHERE ( (\"id´ = ?) AND ((? = 1 AND \"lname´ IS NULL) OR (\"lname´ = ?)) )",
  193. cmd.CommandText, "#D1");
  194. #endif
  195. Assert.AreSame (conn, cmd.Connection, "#D2");
  196. AssertUpdateParameters (cmd, "#D3:");
  197. } finally {
  198. if (cmd != null)
  199. cmd.Dispose ();
  200. ConnectionManager.Singleton.CloseConnection ();
  201. }
  202. }
  203. [Test]
  204. [Ignore ("FIXME: Auto SQL generation during Update requires a valid SelectCommand")]
  205. public void GetUpdateCommandDBConcurrencyExceptionTest ()
  206. {
  207. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  208. try {
  209. string selectQuery = "select id, lname from employee where id = 3";
  210. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  211. DataSet ds = new DataSet ();
  212. da.Fill (ds, "IntTest");
  213. Assert.AreEqual (1, ds.Tables.Count);
  214. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  215. Assert.IsNotNull (cb);
  216. DataRow [] rows = ds.Tables [0].Select ("id=1");
  217. rows [0] [0] = 6660; // non existent
  218. ds.Tables [0].AcceptChanges (); // moves 6660 to original value
  219. rows [0] [0] = 1; // moves 6660 as search key into db table
  220. try {
  221. da.Update (rows);
  222. Assert.Fail ("#1");
  223. } catch (DBConcurrencyException ex) {
  224. // Concurrency violation: the UpdateCommand
  225. // affected 0 records
  226. Assert.AreEqual (typeof (DBConcurrencyException), ex.GetType (), "#2");
  227. Assert.IsNull (ex.InnerException, "#3");
  228. Assert.IsNotNull (ex.Message, "#4");
  229. Assert.AreSame (rows [0], ex.Row, "#5");
  230. #if NET_2_0
  231. Assert.AreEqual (1, ex.RowCount, "#6");
  232. #endif
  233. }
  234. } finally {
  235. ConnectionManager.Singleton.CloseConnection ();
  236. }
  237. }
  238. #if NET_2_0
  239. [Test]
  240. public void GetInsertCommandTest_option_true ()
  241. {
  242. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  243. try {
  244. string selectQuery = "select id, lname from employee where id = 3";
  245. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  246. DataSet ds = new DataSet ();
  247. da.Fill (ds, "IntTest");
  248. Assert.AreEqual (1, ds.Tables.Count);
  249. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  250. OdbcCommand cmd = cb.GetInsertCommand (true);
  251. Assert.AreEqual ("INSERT INTO employee (id, lname) VALUES (?, ?)",
  252. cmd.CommandText, "#1");
  253. Assert.AreSame (conn, cmd.Connection, "#2");
  254. AssertInsertParameters (cmd, "#3:");
  255. } finally {
  256. ConnectionManager.Singleton.CloseConnection ();
  257. }
  258. }
  259. [Test]
  260. public void GetInsertCommandTest_option_false ()
  261. {
  262. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  263. try {
  264. string selectQuery = "select id, lname from employee where id = 3";
  265. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  266. DataSet ds = new DataSet ();
  267. da.Fill (ds, "IntTest");
  268. Assert.AreEqual (1, ds.Tables.Count);
  269. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  270. OdbcCommand cmd = cb.GetInsertCommand (false);
  271. Assert.AreEqual ("INSERT INTO employee (id, lname) VALUES (?, ?)",
  272. cmd.CommandText, "#1");
  273. Assert.AreSame (conn, cmd.Connection, "#2");
  274. AssertInsertParameters (cmd, "#3:");
  275. } finally {
  276. ConnectionManager.Singleton.CloseConnection ();
  277. }
  278. }
  279. [Test]
  280. public void GetUpdateCommandTest_option_true ()
  281. {
  282. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  283. try {
  284. string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
  285. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  286. DataSet ds = new DataSet ();
  287. da.Fill (ds, "IntTest");
  288. Assert.AreEqual (1, ds.Tables.Count);
  289. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  290. OdbcCommand cmd = cb.GetUpdateCommand (true);
  291. Assert.AreEqual ("UPDATE employee SET id = ?, lname = ? WHERE ((id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)))",
  292. cmd.CommandText, "#1");
  293. Assert.AreSame (conn, cmd.Connection, "#2");
  294. AssertUpdateParameters (cmd, "#3:");
  295. } finally {
  296. ConnectionManager.Singleton.CloseConnection ();
  297. }
  298. }
  299. [Test]
  300. public void GetUpdateCommandTest_option_false ()
  301. {
  302. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  303. try {
  304. string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
  305. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  306. DataSet ds = new DataSet ();
  307. da.Fill (ds, "IntTest");
  308. Assert.AreEqual (1, ds.Tables.Count);
  309. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  310. OdbcCommand cmd = cb.GetUpdateCommand (false);
  311. Assert.AreEqual ("UPDATE employee SET id = ?, lname = ? WHERE ((id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)))",
  312. cmd.CommandText, "#1");
  313. Assert.AreSame (conn, cmd.Connection, "#2");
  314. AssertUpdateParameters (cmd, "#3:");
  315. } finally {
  316. ConnectionManager.Singleton.CloseConnection ();
  317. }
  318. }
  319. [Test]
  320. public void GetDeleteCommandTest_option_true ()
  321. {
  322. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  323. try {
  324. string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
  325. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  326. DataSet ds = new DataSet ();
  327. da.Fill (ds, "IntTest");
  328. Assert.AreEqual (1, ds.Tables.Count);
  329. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  330. OdbcCommand cmd = cb.GetDeleteCommand (true);
  331. Assert.AreEqual ("DELETE FROM employee WHERE ((id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)))",
  332. cmd.CommandText, "#1");
  333. Assert.AreSame (conn, cmd.Connection, "#2");
  334. AssertDeleteParameters (cmd, "#3:");
  335. } finally {
  336. ConnectionManager.Singleton.CloseConnection ();
  337. }
  338. }
  339. [Test]
  340. public void GetDeleteCommandTest_option_false ()
  341. {
  342. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  343. try {
  344. string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
  345. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  346. DataSet ds = new DataSet ();
  347. da.Fill (ds, "IntTest");
  348. Assert.AreEqual (1, ds.Tables.Count);
  349. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  350. OdbcCommand cmd = cb.GetDeleteCommand (false);
  351. Assert.AreEqual ("DELETE FROM employee WHERE ((id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)))",
  352. cmd.CommandText, "#1");
  353. Assert.AreSame (conn, cmd.Connection, "#2");
  354. AssertDeleteParameters (cmd, "#3:");
  355. } finally {
  356. ConnectionManager.Singleton.CloseConnection ();
  357. }
  358. }
  359. #endif
  360. [Test]
  361. public void GetDeleteCommandTest ()
  362. {
  363. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  364. OdbcCommand cmd = null;
  365. try {
  366. string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
  367. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  368. DataSet ds = new DataSet ();
  369. da.Fill (ds, "IntTest");
  370. Assert.AreEqual (1, ds.Tables.Count);
  371. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  372. cmd = cb.GetDeleteCommand ();
  373. #if NET_2_0
  374. Assert.AreEqual ("DELETE FROM employee WHERE ((id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)))",
  375. cmd.CommandText, "#A1");
  376. #else
  377. Assert.AreEqual ("DELETE FROM employee WHERE ( (id = ?) AND ((? = 1 AND lname IS NULL) OR (lname = ?)) )",
  378. cmd.CommandText, "#A1");
  379. #endif
  380. Assert.AreSame (conn, cmd.Connection, "#A2");
  381. AssertDeleteParameters (cmd, "#A3:");
  382. cb = new OdbcCommandBuilder (da);
  383. cb.QuotePrefix = "\"";
  384. cmd = cb.GetDeleteCommand ();
  385. #if NET_2_0
  386. Assert.AreEqual ("DELETE FROM \"employee WHERE ((\"id = ?) AND ((? = 1 AND \"lname IS NULL) OR (\"lname = ?)))",
  387. cmd.CommandText, "#B1");
  388. #else
  389. Assert.AreEqual ("DELETE FROM \"employee WHERE ( (\"id = ?) AND ((? = 1 AND \"lname IS NULL) OR (\"lname = ?)) )",
  390. cmd.CommandText, "#B1");
  391. #endif
  392. Assert.AreSame (conn, cmd.Connection, "#B2");
  393. AssertDeleteParameters (cmd, "#B3:");
  394. cb = new OdbcCommandBuilder (da);
  395. cb.QuoteSuffix = "´";
  396. cmd = cb.GetDeleteCommand ();
  397. #if NET_2_0
  398. Assert.AreEqual ("DELETE FROM employee´ WHERE ((id´ = ?) AND ((? = 1 AND lname´ IS NULL) OR (lname´ = ?)))",
  399. cmd.CommandText, "#C1");
  400. #else
  401. Assert.AreEqual ("DELETE FROM employee´ WHERE ( (id´ = ?) AND ((? = 1 AND lname´ IS NULL) OR (lname´ = ?)) )",
  402. cmd.CommandText, "#C1");
  403. #endif
  404. Assert.AreSame (conn, cmd.Connection, "#C2");
  405. AssertDeleteParameters (cmd, "#C3:");
  406. cb = new OdbcCommandBuilder (da);
  407. cb.QuotePrefix = "\"";
  408. cb.QuoteSuffix = "´";
  409. cmd = cb.GetDeleteCommand ();
  410. #if NET_2_0
  411. Assert.AreEqual ("DELETE FROM \"employee´ WHERE ((\"id´ = ?) AND ((? = 1 AND \"lname´ IS NULL) OR (\"lname´ = ?)))",
  412. cmd.CommandText, "#D1");
  413. #else
  414. Assert.AreEqual ("DELETE FROM \"employee´ WHERE ( (\"id´ = ?) AND ((? = 1 AND \"lname´ IS NULL) OR (\"lname´ = ?)) )",
  415. cmd.CommandText, "#D1");
  416. #endif
  417. Assert.AreSame (conn, cmd.Connection, "#D2");
  418. AssertDeleteParameters (cmd, "#D3:");
  419. } finally {
  420. if (cmd != null)
  421. cmd.Dispose ();
  422. ConnectionManager.Singleton.CloseConnection ();
  423. }
  424. }
  425. [Test]
  426. #if NET_2_0
  427. [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
  428. #endif
  429. public void QuotePrefix_DeleteCommand_Generated ()
  430. {
  431. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  432. OdbcCommand cmd = null;
  433. try {
  434. string selectQuery = "select id, lname from employee where id = 3";
  435. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  436. DataSet ds = new DataSet ();
  437. da.Fill (ds, "IntTest");
  438. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  439. cmd = cb.GetDeleteCommand ();
  440. Assert.AreEqual (string.Empty, cb.QuotePrefix, "#1");
  441. try {
  442. cb.QuotePrefix = "";
  443. Assert.Fail ("#2");
  444. } catch (InvalidOperationException ex) {
  445. // The QuotePrefix and QuoteSuffix properties
  446. // cannot be changed once an Insert, Update, or
  447. // Delete command has been generated
  448. Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#3");
  449. Assert.IsNull (ex.InnerException, "#4");
  450. Assert.IsNotNull (ex.Message, "#5");
  451. }
  452. Assert.AreEqual (string.Empty, cb.QuotePrefix, "#6");
  453. cb.RefreshSchema ();
  454. cb.QuotePrefix = "";
  455. } finally {
  456. if (cmd != null)
  457. cmd.Dispose ();
  458. ConnectionManager.Singleton.CloseConnection ();
  459. }
  460. }
  461. [Test]
  462. #if NET_2_0
  463. [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
  464. #endif
  465. public void QuotePrefix_InsertCommand_Generated ()
  466. {
  467. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  468. OdbcCommand cmd = null;
  469. try {
  470. string selectQuery = "select id, lname from employee where id = 3";
  471. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  472. DataSet ds = new DataSet ();
  473. da.Fill (ds, "IntTest");
  474. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  475. cmd = cb.GetInsertCommand ();
  476. Assert.AreEqual (string.Empty, cb.QuotePrefix, "#1");
  477. try {
  478. cb.QuotePrefix = "";
  479. Assert.Fail ("#2");
  480. } catch (InvalidOperationException ex) {
  481. // The QuotePrefix and QuoteSuffix properties
  482. // cannot be changed once an Insert, Update, or
  483. // Delete command has been generated
  484. Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#3");
  485. Assert.IsNull (ex.InnerException, "#4");
  486. Assert.IsNotNull (ex.Message, "#5");
  487. }
  488. Assert.AreEqual (string.Empty, cb.QuotePrefix, "#6");
  489. cb.RefreshSchema ();
  490. cb.QuotePrefix = "";
  491. } finally {
  492. if (cmd != null)
  493. cmd.Dispose ();
  494. ConnectionManager.Singleton.CloseConnection ();
  495. }
  496. }
  497. [Test]
  498. #if NET_2_0
  499. [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
  500. #endif
  501. public void QuotePrefix_UpdateCommand_Generated ()
  502. {
  503. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  504. OdbcCommand cmd = null;
  505. try {
  506. string selectQuery = "select id, lname from employee where id = 3";
  507. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  508. DataSet ds = new DataSet ();
  509. da.Fill (ds, "IntTest");
  510. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  511. cmd = cb.GetUpdateCommand ();
  512. Assert.AreEqual (string.Empty, cb.QuotePrefix, "#1");
  513. try {
  514. cb.QuotePrefix = "";
  515. Assert.Fail ("#2");
  516. } catch (InvalidOperationException ex) {
  517. // The QuotePrefix and QuoteSuffix properties
  518. // cannot be changed once an Insert, Update, or
  519. // Delete command has been generated
  520. Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#3");
  521. Assert.IsNull (ex.InnerException, "#4");
  522. Assert.IsNotNull (ex.Message, "#5");
  523. }
  524. Assert.AreEqual (string.Empty, cb.QuotePrefix, "#6");
  525. cb.RefreshSchema ();
  526. cb.QuotePrefix = "";
  527. } finally {
  528. if (cmd != null)
  529. cmd.Dispose ();
  530. ConnectionManager.Singleton.CloseConnection ();
  531. }
  532. }
  533. [Test]
  534. #if NET_2_0
  535. [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
  536. #endif
  537. public void QuoteSuffix_DeleteCommand_Generated ()
  538. {
  539. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  540. OdbcCommand cmd = null;
  541. try {
  542. string selectQuery = "select id, lname from employee where id = 3";
  543. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  544. DataSet ds = new DataSet ();
  545. da.Fill (ds, "IntTest");
  546. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  547. cmd = cb.GetDeleteCommand ();
  548. Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#1");
  549. try {
  550. cb.QuoteSuffix = "";
  551. Assert.Fail ("#2");
  552. } catch (InvalidOperationException ex) {
  553. // The QuotePrefix and QuoteSuffix properties
  554. // cannot be changed once an Insert, Update, or
  555. // Delete command has been generated
  556. Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#3");
  557. Assert.IsNull (ex.InnerException, "#4");
  558. Assert.IsNotNull (ex.Message, "#5");
  559. }
  560. Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#6");
  561. cb.RefreshSchema ();
  562. cb.QuoteSuffix = "";
  563. } finally {
  564. if (cmd != null)
  565. cmd.Dispose ();
  566. ConnectionManager.Singleton.CloseConnection ();
  567. }
  568. }
  569. [Test]
  570. #if NET_2_0
  571. [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
  572. #endif
  573. public void QuoteSuffix_InsertCommand_Generated ()
  574. {
  575. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  576. OdbcCommand cmd = null;
  577. try {
  578. string selectQuery = "select id, lname from employee where id = 3";
  579. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  580. DataSet ds = new DataSet ();
  581. da.Fill (ds, "IntTest");
  582. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  583. cmd = cb.GetInsertCommand ();
  584. Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#1");
  585. try {
  586. cb.QuoteSuffix = "";
  587. Assert.Fail ("#2");
  588. } catch (InvalidOperationException ex) {
  589. // The QuotePrefix and QuoteSuffix properties
  590. // cannot be changed once an Insert, Update, or
  591. // Delete command has been generated
  592. Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#3");
  593. Assert.IsNull (ex.InnerException, "#4");
  594. Assert.IsNotNull (ex.Message, "#5");
  595. }
  596. Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#6");
  597. cb.RefreshSchema ();
  598. cb.QuoteSuffix = "";
  599. } finally {
  600. if (cmd != null)
  601. cmd.Dispose ();
  602. ConnectionManager.Singleton.CloseConnection ();
  603. }
  604. }
  605. [Test]
  606. #if NET_2_0
  607. [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
  608. #endif
  609. public void QuoteSuffix_UpdateCommand_Generated ()
  610. {
  611. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  612. OdbcCommand cmd = null;
  613. try {
  614. string selectQuery = "select id, lname from employee where id = 3";
  615. OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
  616. DataSet ds = new DataSet ();
  617. da.Fill (ds, "IntTest");
  618. OdbcCommandBuilder cb = new OdbcCommandBuilder (da);
  619. cmd = cb.GetUpdateCommand ();
  620. Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#1");
  621. try {
  622. cb.QuoteSuffix = "";
  623. Assert.Fail ("#2");
  624. } catch (InvalidOperationException ex) {
  625. // The QuotePrefix and QuoteSuffix properties
  626. // cannot be changed once an Insert, Update, or
  627. // Delete command has been generated
  628. Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#3");
  629. Assert.IsNull (ex.InnerException, "#4");
  630. Assert.IsNotNull (ex.Message, "#5");
  631. }
  632. Assert.AreEqual (string.Empty, cb.QuotePrefix, "#6");
  633. cb.RefreshSchema ();
  634. cb.QuoteSuffix = "";
  635. } finally {
  636. if (cmd != null)
  637. cmd.Dispose ();
  638. ConnectionManager.Singleton.CloseConnection ();
  639. }
  640. }
  641. #if NET_2_0
  642. [Test] // QuoteIdentifier (String, OdbcConnection)
  643. public void QuoteIdentifier2 ()
  644. {
  645. OdbcCommandBuilder cb;
  646. OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
  647. ConnectionManager.Singleton.OpenConnection ();
  648. string quote_char = ConnectionManager.Singleton.Engine.QuoteCharacter;
  649. try {
  650. cb = new OdbcCommandBuilder ();
  651. Assert.AreEqual (quote_char + "mono" + quote_char, cb.QuoteIdentifier ("mono", conn), "#A1");
  652. Assert.AreEqual (quote_char + "Z" + quote_char, cb.QuoteIdentifier ("Z", conn), "#A2");
  653. Assert.AreEqual (quote_char + "abc" + quote_char, cb.QuoteIdentifier ("abc", conn), "#A3");
  654. Assert.AreEqual (quote_char + quote_char, cb.QuoteIdentifier (string.Empty, conn), "#A4");
  655. Assert.AreEqual (quote_char + " " + quote_char, cb.QuoteIdentifier (" ", conn), "#A5");
  656. Assert.AreEqual (quote_char + "\r" + quote_char, cb.QuoteIdentifier ("\r", conn), "#A6");
  657. cb.QuoteSuffix = "def";
  658. Assert.AreEqual (quote_char + "mono" + quote_char, cb.QuoteIdentifier ("mono", conn), "#A7");
  659. Assert.AreEqual (quote_char + "Z" + quote_char, cb.QuoteIdentifier ("Z", conn), "#A8");
  660. Assert.AreEqual (quote_char + "abc" + quote_char, cb.QuoteIdentifier ("abc", conn), "#A9");
  661. Assert.AreEqual (quote_char + quote_char, cb.QuoteIdentifier (string.Empty, conn), "#A10");
  662. Assert.AreEqual (quote_char + " " + quote_char, cb.QuoteIdentifier (" ", conn), "#A11");
  663. Assert.AreEqual (quote_char + "\r" + quote_char, cb.QuoteIdentifier ("\r", conn), "#A12");
  664. cb = new OdbcCommandBuilder ();
  665. cb.QuotePrefix = "abc";
  666. Assert.AreEqual ("abcmono", cb.QuoteIdentifier ("mono", conn), "#B1");
  667. Assert.AreEqual ("abcZ", cb.QuoteIdentifier ("Z", conn), "#B2");
  668. Assert.AreEqual ("abcabc", cb.QuoteIdentifier ("abc", conn), "#B3");
  669. Assert.AreEqual ("abc", cb.QuoteIdentifier (string.Empty, conn), "#B4");
  670. Assert.AreEqual ("abc ", cb.QuoteIdentifier (" ", conn), "#B5");
  671. Assert.AreEqual ("abc\r", cb.QuoteIdentifier ("\r", conn), "#B6");
  672. cb.QuoteSuffix = "def";
  673. Assert.AreEqual ("abcmonodef", cb.QuoteIdentifier ("mono", conn), "#B7");
  674. Assert.AreEqual ("abcZdef", cb.QuoteIdentifier ("Z", conn), "#B8");
  675. Assert.AreEqual ("abcabcdef", cb.QuoteIdentifier ("abc", conn), "#B9");
  676. Assert.AreEqual ("abcdef", cb.QuoteIdentifier (string.Empty, conn), "#B10");
  677. Assert.AreEqual ("abc def", cb.QuoteIdentifier (" ", conn), "#B11");
  678. Assert.AreEqual ("abc\rdef", cb.QuoteIdentifier ("\r", conn), "#B12");
  679. cb.QuotePrefix = string.Empty;
  680. cb = new OdbcCommandBuilder ();
  681. cb.QuotePrefix = "X";
  682. Assert.AreEqual ("Xmono", cb.QuoteIdentifier ("mono", conn), "#D1");
  683. Assert.AreEqual ("XZ", cb.QuoteIdentifier ("Z", conn), "#D2");
  684. Assert.AreEqual ("XX", cb.QuoteIdentifier ("X", conn), "#D3");
  685. Assert.AreEqual ("X", cb.QuoteIdentifier (string.Empty, conn), "#D4");
  686. Assert.AreEqual ("X ", cb.QuoteIdentifier (" ", conn), "#D5");
  687. Assert.AreEqual ("X\r", cb.QuoteIdentifier ("\r", conn), "#D6");
  688. cb.QuoteSuffix = " ";
  689. Assert.AreEqual ("Xmono ", cb.QuoteIdentifier ("mono", conn), "#D7");
  690. Assert.AreEqual ("XZ ", cb.QuoteIdentifier ("Z", conn), "#D8");
  691. Assert.AreEqual ("XX ", cb.QuoteIdentifier ("X", conn), "#D9");
  692. Assert.AreEqual ("X ", cb.QuoteIdentifier (string.Empty, conn), "#D10");
  693. Assert.AreEqual ("X ", cb.QuoteIdentifier (" ", conn), "#D11");
  694. Assert.AreEqual ("X\r ", cb.QuoteIdentifier ("\r", conn), "#D12");
  695. cb = new OdbcCommandBuilder ();
  696. cb.QuotePrefix = " ";
  697. Assert.AreEqual ("mono", cb.QuoteIdentifier ("mono", conn), "#E1");
  698. Assert.AreEqual ("Z", cb.QuoteIdentifier ("Z", conn), "#E2");
  699. Assert.AreEqual ("abc", cb.QuoteIdentifier ("abc", conn), "#E3");
  700. Assert.AreEqual (string.Empty, cb.QuoteIdentifier (string.Empty, conn), "#E4");
  701. Assert.AreEqual (" ", cb.QuoteIdentifier (" ", conn), "#E5");
  702. Assert.AreEqual ("\r", cb.QuoteIdentifier ("\r", conn), "#E6");
  703. cb.QuoteSuffix = "def";
  704. Assert.AreEqual ("mono", cb.QuoteIdentifier ("mono", conn), "#E7");
  705. Assert.AreEqual ("Z", cb.QuoteIdentifier ("Z", conn), "#E8");
  706. Assert.AreEqual ("abc", cb.QuoteIdentifier ("abc", conn), "#E9");
  707. Assert.AreEqual (string.Empty, cb.QuoteIdentifier (string.Empty, conn), "#E10");
  708. Assert.AreEqual (" ", cb.QuoteIdentifier (" ", conn), "#E11");
  709. Assert.AreEqual ("\r", cb.QuoteIdentifier ("\r", conn), "#E12");
  710. } finally {
  711. ConnectionManager.Singleton.CloseConnection ();
  712. }
  713. }
  714. #endif
  715. void AssertInsertParameters (OdbcCommand cmd, string prefix)
  716. {
  717. Assert.AreEqual (2, cmd.Parameters.Count, prefix + "Count");
  718. Assert.AreEqual (DbType.Int32, cmd.Parameters [0].DbType, prefix + "DbType (0)");
  719. #if NET_2_0
  720. Assert.AreEqual ("p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
  721. #else
  722. Assert.AreEqual ("@p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
  723. #endif
  724. Assert.AreEqual ("id", cmd.Parameters [0].SourceColumn, prefix + "SourceColumn (0)");
  725. Assert.IsNull (cmd.Parameters [0].Value, prefix + "Value (0)");
  726. Assert.AreEqual (DbType.AnsiString, cmd.Parameters [1].DbType, prefix + "DbType (1)");
  727. #if NET_2_0
  728. Assert.AreEqual ("p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
  729. #else
  730. Assert.AreEqual ("@p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
  731. #endif
  732. Assert.AreEqual ("lname", cmd.Parameters [1].SourceColumn, prefix + "SourceColumn (1)");
  733. Assert.IsNull (cmd.Parameters [1].Value, prefix + "Value (1)");
  734. }
  735. void AssertUpdateParameters (OdbcCommand cmd, string prefix)
  736. {
  737. Assert.AreEqual (5, cmd.Parameters.Count, prefix + "Count");
  738. Assert.AreEqual (DbType.Int32, cmd.Parameters [0].DbType, prefix + "DbType (0)");
  739. #if NET_2_0
  740. Assert.AreEqual ("p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
  741. #else
  742. Assert.AreEqual ("@p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
  743. #endif
  744. Assert.AreEqual ("id", cmd.Parameters [0].SourceColumn, prefix + "SourceColumn (0)");
  745. Assert.IsNull (cmd.Parameters [0].Value, prefix + "Value (0)");
  746. Assert.AreEqual (DbType.AnsiString, cmd.Parameters [1].DbType, prefix + "DbType (1)");
  747. #if NET_2_0
  748. Assert.AreEqual ("p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
  749. #else
  750. Assert.AreEqual ("@p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
  751. #endif
  752. Assert.AreEqual ("lname", cmd.Parameters [1].SourceColumn, prefix + "SourceColumn (1)");
  753. Assert.IsNull (cmd.Parameters [1].Value, prefix + "Value (1)");
  754. Assert.AreEqual (DbType.Int32, cmd.Parameters [2].DbType, prefix + "DbType (2)");
  755. #if NET_2_0
  756. Assert.AreEqual ("p3", cmd.Parameters [2].ParameterName, prefix + "ParameterName (2)");
  757. #else
  758. Assert.AreEqual ("@p3", cmd.Parameters [2].ParameterName, prefix + "ParameterName (2)");
  759. #endif
  760. Assert.AreEqual ("id", cmd.Parameters [2].SourceColumn, prefix + "SourceColumn (2)");
  761. Assert.IsNull (cmd.Parameters [2].Value, prefix + "Value (2)");
  762. Assert.AreEqual (DbType.Int32, cmd.Parameters [3].DbType, prefix + "DbType (3)");
  763. #if NET_2_0
  764. Assert.AreEqual ("p4", cmd.Parameters [3].ParameterName, prefix + "ParameterName (3)");
  765. Assert.AreEqual ("lname", cmd.Parameters [3].SourceColumn, prefix + "SourceColumn (3)");
  766. #else
  767. Assert.AreEqual ("@p4", cmd.Parameters [3].ParameterName, prefix + "ParameterName (3)");
  768. Assert.AreEqual (string.Empty, cmd.Parameters [3].SourceColumn, prefix + "SourceColumn (3)");
  769. #endif
  770. Assert.AreEqual (1, cmd.Parameters [3].Value, prefix + "Value (3)");
  771. Assert.AreEqual (DbType.AnsiString, cmd.Parameters [4].DbType, prefix + "DbType (4)");
  772. #if NET_2_0
  773. Assert.AreEqual ("p5", cmd.Parameters [4].ParameterName, prefix + "ParameterName (4)");
  774. #else
  775. Assert.AreEqual ("@p5", cmd.Parameters [4].ParameterName, prefix + "ParameterName (4)");
  776. #endif
  777. Assert.AreEqual ("lname", cmd.Parameters [4].SourceColumn, prefix + "SourceColumn (4)");
  778. Assert.IsNull (cmd.Parameters [4].Value, prefix + "Value (4)");
  779. }
  780. void AssertDeleteParameters (OdbcCommand cmd, string prefix)
  781. {
  782. Assert.AreEqual (3, cmd.Parameters.Count, prefix + "Count");
  783. Assert.AreEqual (DbType.Int32, cmd.Parameters [0].DbType, prefix + "DbType (0)");
  784. #if NET_2_0
  785. Assert.AreEqual ("p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
  786. #else
  787. Assert.AreEqual ("@p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
  788. #endif
  789. Assert.AreEqual ("id", cmd.Parameters [0].SourceColumn, prefix + "SourceColumn (0)");
  790. Assert.IsNull (cmd.Parameters [0].Value, prefix + "Value (0)");
  791. Assert.AreEqual (DbType.Int32, cmd.Parameters [1].DbType, prefix + "DbType (1)");
  792. #if NET_2_0
  793. Assert.AreEqual ("p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
  794. Assert.AreEqual ("lname", cmd.Parameters [1].SourceColumn, prefix + "SourceColumn (1)");
  795. #else
  796. Assert.AreEqual ("@p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
  797. Assert.AreEqual (string.Empty, cmd.Parameters [1].SourceColumn, prefix + "SourceColumn (1)");
  798. #endif
  799. Assert.AreEqual (1, cmd.Parameters [1].Value, prefix + "Value (1)");
  800. Assert.AreEqual (DbType.AnsiString, cmd.Parameters [2].DbType, prefix + "DbType (2)");
  801. #if NET_2_0
  802. Assert.AreEqual ("p3", cmd.Parameters [2].ParameterName, prefix + "ParameterName (2)");
  803. #else
  804. Assert.AreEqual ("@p3", cmd.Parameters [2].ParameterName, prefix + "ParameterName (2)");
  805. #endif
  806. Assert.AreEqual ("lname", cmd.Parameters [2].SourceColumn, prefix + "SourceColumn (2)");
  807. Assert.IsNull (cmd.Parameters [2].Value, prefix + "Value (2)");
  808. }
  809. // FIXME: test SetAllValues
  810. // FIXME: Add tests for examining RowError
  811. // FIXME: Add test for ContinueUpdateOnError property
  812. }
  813. }