AbstractDBCommand.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. //namespace System.Data.Common
  2. //{
  3. //
  4. // using java.sql;
  5. // using java.util;
  6. //
  7. // using System;
  8. // using System.Collections;
  9. // using System.Data;
  10. // using System.Data.ProviderBase;
  11. //
  12. // /**
  13. // * @author erand
  14. // */
  15. // public abstract class AbstractDBCommand : DbCommandBase
  16. // {
  17. // protected String _cmdText, _javaCmdText;
  18. // protected AbstractDBConnection _connection;
  19. // protected IDbTransaction _transaction;
  20. // protected int _cmdTimeout = 30;
  21. // protected CommandType _cmdType = CommandType.Text;
  22. // protected UpdateRowSource _updateRowSource = UpdateRowSource.Both;
  23. // protected Statement _statement;
  24. // protected IDataParameterCollection _paramCollection;
  25. // protected IDataReader _reader;
  26. // private bool _isCommandTextChanged;
  27. // private CommandBehavior _behvior = CommandBehavior.Default;
  28. //
  29. // private static readonly int _oracleRefCursor;
  30. // protected const int oracleTypeRefCursor = 1111; // Types.OTHER
  31. //
  32. //
  33. // static AbstractDBCommand()
  34. // {
  35. // try {
  36. // java.lang.Class OracleTypesClass = java.lang.Class.forName("oracle.jdbc.OracleTypes");
  37. // _oracleRefCursor = OracleTypesClass.getField("CURSOR").getInt(null);
  38. // }
  39. // catch(java.lang.ClassNotFoundException e) {
  40. // // oracle driver is not in classpath - just continue
  41. // }
  42. // }
  43. //
  44. // public AbstractDBCommand(
  45. // String cmdText,
  46. // AbstractDBConnection connection,
  47. // IDbTransaction transaction)
  48. // {
  49. // _connection = connection;
  50. // _cmdText = cmdText;
  51. // _transaction = transaction;
  52. // _isCommandTextChanged = true;
  53. // }
  54. //
  55. // public java.sql.Statement Statement
  56. // {
  57. // get
  58. // {
  59. // return _statement;
  60. // }
  61. // set
  62. // {
  63. // _statement = value;
  64. // }
  65. // }
  66. //
  67. // public virtual String JavaCommandText
  68. // {
  69. // get
  70. // {
  71. // return _javaCmdText;
  72. // }
  73. // set
  74. // {
  75. // _javaCmdText = value;
  76. // }
  77. // }
  78. //
  79. // protected bool getCommandTextChanged()
  80. // {
  81. // return _isCommandTextChanged;
  82. // }
  83. //
  84. // internal void setCommandTextChanged(bool value)
  85. // {
  86. // _isCommandTextChanged = value;
  87. // }
  88. //
  89. // public Statement getStatement()
  90. // {
  91. // return _statement;
  92. // }
  93. // /**
  94. // * @see System.Data.IDbCommand#Cancel()
  95. // */
  96. // public override void Cancel()
  97. // {
  98. // try
  99. // {
  100. // if (_statement != null)
  101. // _statement.cancel();
  102. // }
  103. // catch (SQLException exp)
  104. // {
  105. // Console.WriteLine(exp);
  106. // }
  107. // }
  108. //
  109. //// /**
  110. //// * @see System.Data.IDbCommand#ExecuteScalar()
  111. //// */
  112. //// public virtual Object ExecuteScalar()
  113. //// {
  114. //// Object result = null;
  115. //// IDataReader reader = ((IDbCommand)this).ExecuteReader();
  116. ////
  117. //// if (reader != null && reader.Read())
  118. //// {
  119. //// result = ((IDataRecord) reader).GetValue(0);
  120. //// }
  121. //// reader.Close();
  122. ////
  123. //// return result;
  124. //// }
  125. //
  126. //// /**
  127. //// * @see System.Data.IDbCommand#CommandTimeout
  128. //// */
  129. //// public virtual int CommandTimeout
  130. //// {
  131. //// get
  132. //// {
  133. //// return _cmdTimeout;
  134. //// }
  135. //// set
  136. //// {
  137. //// _cmdTimeout = value;
  138. //// }
  139. //// }
  140. //
  141. //// /**
  142. //// * @see System.Data.IDbCommand#CommandType
  143. //// */
  144. //// public virtual CommandType CommandType
  145. //// {
  146. //// get
  147. //// {
  148. //// return _cmdType;
  149. //// }
  150. //// set
  151. //// {
  152. //// _cmdType = value;
  153. //// }
  154. //// }
  155. //
  156. //// /**
  157. //// * @see System.Data.IDbCommand#Connection
  158. //// */
  159. //// public virtual IDbConnection Connection
  160. //// {
  161. //// get
  162. //// {
  163. //// return (IDbConnection)_connection;
  164. //// }
  165. //// set
  166. //// {
  167. //// _connection = (AbstractDBConnection) value;
  168. //// }
  169. //// }
  170. //
  171. //// /**
  172. //// * @see System.Data.IDbCommand#Transaction
  173. //// */
  174. //// public virtual IDbTransaction Transaction
  175. //// {
  176. //// get
  177. //// {
  178. //// return _transaction;
  179. //// }
  180. //// set
  181. //// {
  182. //// _transaction = value;
  183. //// }
  184. //// }
  185. //
  186. //// /**
  187. //// * @see System.Data.IDbCommand#UpdatedRowSource
  188. //// */
  189. //// public virtual UpdateRowSource UpdatedRowSource
  190. //// {
  191. //// get
  192. //// {
  193. //// return _updateRowSource;
  194. //// }
  195. //// set
  196. //// {
  197. //// _updateRowSource = value;
  198. //// }
  199. //// }
  200. //
  201. //// /**
  202. //// * @see System.Data.IDbCommand#CommandText
  203. //// */
  204. //// public virtual String CommandText
  205. //// {
  206. //// get
  207. //// {
  208. //// return _cmdText;
  209. //// }
  210. //// set
  211. //// {
  212. //// if (_cmdText == null || String.Compare(_cmdText, value, true) != 0)
  213. //// {
  214. //// _cmdText = value;
  215. //// _isCommandTextChanged = true;
  216. //// }
  217. //// }
  218. //// }
  219. //
  220. // protected virtual void setInputForStatement(
  221. // PreparedStatement stm,
  222. // int javaType,
  223. // int place,
  224. // Object value)
  225. // //throws SQLException
  226. // {
  227. // // by the type of the the parameter we know wich method of
  228. // // the statement to use
  229. //
  230. // if (value is DBNull)
  231. // stm.setNull(place, javaType);
  232. //
  233. // else if (javaType == Types.BINARY)
  234. // stm.setBytes(place, vmw.common.TypeUtils.ToSByteArray((byte[]) value));
  235. //
  236. // else if (javaType == Types.BLOB)
  237. // stm.setObject(place, value);
  238. //
  239. // else if (javaType == Types.CLOB)
  240. // stm.setObject(place, value);
  241. //
  242. // else if (javaType == Types.DISTINCT)
  243. // stm.setObject(place, value);
  244. //
  245. // else if (javaType == Types.ARRAY)
  246. // stm.setObject(place, value);
  247. //
  248. // else if (javaType == Types.JAVA_OBJECT)
  249. // stm.setObject(place, value);
  250. //
  251. // else if (javaType == Types.REF)
  252. // stm.setObject(place, value);
  253. //
  254. // else if (javaType == Types.STRUCT)
  255. // stm.setObject(place, value);
  256. //
  257. // else if (javaType == Types.VARBINARY)
  258. // stm.setBytes(place, vmw.common.TypeUtils.ToSByteArray((byte[]) value));
  259. //
  260. // else if (javaType == Types.BIGINT)
  261. // stm.setLong(place, ((java.lang.Long) value).longValue());
  262. //
  263. // else if (javaType == Types.BIT)
  264. // stm.setBoolean(place, ((java.lang.Boolean) value).booleanValue());
  265. //
  266. // else if (javaType == Types.CHAR)
  267. // stm.setString(place, ((java.lang.Character) value).toString());
  268. //
  269. // else if (javaType == Types.DATE)
  270. // {
  271. // DateTime tmp = (DateTime) value;
  272. // Calendar c = vmw.common.DateTimeUtils.DateTimeToCalendar(tmp);
  273. // stm.setDate(
  274. // place, new java.sql.Date(c.getTime().getTime()));
  275. // }
  276. // else if (javaType == Types.DECIMAL || javaType == Types.NUMERIC)
  277. // stm.setBigDecimal(place, vmw.common.PrimitiveTypeUtils.DecimalToBigDecimal((Decimal) value));
  278. //
  279. // else if (javaType == Types.DOUBLE)
  280. // stm.setDouble(place, ((java.lang.Double) value).doubleValue());
  281. //
  282. // else if (javaType == Types.FLOAT)
  283. // stm.setFloat(place, ((java.lang.Float) value).floatValue());
  284. //
  285. // else if (javaType == Types.INTEGER)
  286. // stm.setInt(place, ((java.lang.Integer) value).intValue());
  287. //
  288. // else if (javaType == Types.LONGVARCHAR)
  289. // stm.setString(place, (String) value);
  290. //
  291. // else if (javaType == Types.LONGVARBINARY)
  292. // stm.setBytes(place, vmw.common.TypeUtils.ToSByteArray((byte[]) value));
  293. //
  294. // else if (javaType == Types.REAL)
  295. // stm.setFloat(place, ((java.lang.Float) value).floatValue());
  296. //
  297. // else if (javaType == Types.SMALLINT)
  298. // stm.setShort(place, ((java.lang.Short) value).shortValue());
  299. //
  300. // else if (javaType == Types.TIME)
  301. // {
  302. // Calendar c = vmw.common.DateTimeUtils.DateTimeToCalendar(value);
  303. // stm.setTime(
  304. // place,
  305. // new java.sql.Time(c.getTime().getTime()));
  306. // }
  307. // else if (javaType == Types.TIMESTAMP)
  308. // {
  309. // DateTime tmp = (DateTime) value;
  310. // Calendar c = vmw.common.DateTimeUtils.DateTimeToCalendar(value);
  311. // stm.setTimestamp(
  312. // place,
  313. // new java.sql.Timestamp(c.getTime().getTime()));
  314. // }
  315. //
  316. // else if (javaType == Types.TINYINT)
  317. // stm.setByte(place, ((java.lang.Byte) value).byteValue());
  318. //
  319. // else if (javaType == Types.VARCHAR)
  320. // stm.setString(place, (String) value);
  321. //
  322. // else
  323. // stm.setObject(place, value, javaType);
  324. //
  325. // }
  326. //
  327. // // create the _javaCmdText from the _cmdText (the .NET text)
  328. // protected String createCommandForStoreProcedure(String text)
  329. // {
  330. // IDbDataParameter param;
  331. // bool isFirst = true;
  332. // IList paramCollection = (IList) ((IDbCommand)this).Parameters;
  333. //
  334. // //in .Net the name of sore procedure can be wraped by '[' and ']'
  335. // // so we remove them.
  336. // int indx1 = text.IndexOf('[');
  337. // if (indx1 != -1)
  338. // {
  339. // int indx2 = text.IndexOf(']', indx1);
  340. // if (indx2 != -1)
  341. // text = text.Substring(indx1 + 1, indx2 - (indx1 + 1));
  342. // }
  343. //
  344. // java.lang.StringBuffer sb = new java.lang.StringBuffer(text);
  345. // sb.insert(0, "{call ");
  346. //
  347. // for (int i = 0; i < paramCollection.Count; i++)
  348. // {
  349. // param = (IDbDataParameter) paramCollection[i];
  350. //
  351. // if (param.Direction == ParameterDirection.ReturnValue)
  352. // sb = sb.insert(1, "? =");
  353. // else if (isFirst)
  354. // {
  355. // sb = sb.append("(?");
  356. // isFirst = false;
  357. // }
  358. // else
  359. // sb = sb.append(",?");
  360. // }
  361. //
  362. // String retVal = sb.toString();
  363. //
  364. // if (retVal.IndexOf("(") != -1)
  365. // retVal = retVal + ")";
  366. //
  367. // retVal += "}";
  368. //
  369. // _javaCmdText = retVal;
  370. //
  371. // return retVal;
  372. //
  373. // }
  374. //
  375. // // prepare the input and output parameters for the jdbc prepared statement
  376. // // from the SqlParameters of this instance
  377. // internal virtual void prepareStatementForStoreProcedure()// throws SQLException
  378. // {
  379. // CallableStatement stm = (CallableStatement) _statement;
  380. // AbstractDBParameter param;
  381. // IList paramCollection = (IList) ((IDbCommand)this).Parameters;
  382. // ParameterDirection direction;
  383. // //int place;
  384. //
  385. // // NOTE - we add 1 to the index because in .NET it is zero base
  386. // // and in jdbc it is one base
  387. // for (int i = 0; i < paramCollection.Count; i++)
  388. // {
  389. // param = (AbstractDBParameter) paramCollection[i];
  390. // direction = param.Direction;
  391. //
  392. // if (direction == ParameterDirection.Input)
  393. // setInput(stm, i + 1, param);
  394. // else if (direction == ParameterDirection.Output)
  395. // {
  396. // setOutput(stm, i + 1, param);
  397. // param.setParameterPlace(i + 1);
  398. // }
  399. // else if (direction == ParameterDirection.InputOutput)
  400. // {
  401. // setInput(stm, i + 1, param);
  402. // setOutput(stm, i + 1, param);
  403. // param.setParameterPlace(i + 1);
  404. // }
  405. // else if (direction == ParameterDirection.ReturnValue)
  406. // {
  407. // setOutput(stm, 1, param);
  408. // param.setParameterPlace(1);
  409. // }
  410. // }
  411. //
  412. // }
  413. //
  414. // // set input parameter for the statement
  415. // protected void setInput(
  416. // PreparedStatement stm,
  417. // int place,
  418. // AbstractDbParameter param)
  419. // //throws SQLException
  420. // {
  421. // int javaType = param.JdbcType;
  422. // Object value = param.Value;
  423. //
  424. // value = getJavaWrapperFromCSharp(value);
  425. //
  426. // setInputForStatement(stm, javaType, place, value);
  427. // }
  428. //
  429. // public static Object getJavaWrapperFromCSharp(Object obj)
  430. // {
  431. // if (obj is bool)
  432. // return new java.lang.Boolean((bool)obj);
  433. // else if (obj is byte)
  434. // return new java.lang.Byte((sbyte)obj);
  435. // else if (obj is char)
  436. // return new java.lang.Character((char) obj);
  437. // else if (obj is short)
  438. // return new java.lang.Short((short)obj);
  439. // else if (obj is int)
  440. // return new java.lang.Integer((int)obj);
  441. // else if (obj is long)
  442. // return new java.lang.Long((long)obj);
  443. // else if (obj is float)
  444. // return new java.lang.Float((float)obj);
  445. // else if (obj is double)
  446. // return new java.lang.Double((double)obj);
  447. //
  448. // return obj;
  449. //
  450. // }
  451. //
  452. // // set an output parameter to the statement.
  453. // protected void setOutput(
  454. // CallableStatement stm,
  455. // int place,
  456. // AbstractDbParameter param)
  457. // //throws SQLException
  458. // {
  459. // int javaType = param.JdbcType;
  460. //
  461. // // the scale has a meening only in DECIMAL parameters
  462. // if (javaType == Types.DECIMAL || javaType == Types.NUMERIC)
  463. // {
  464. // if(param.DbType == DbType.Currency)
  465. // stm.registerOutParameter(place, javaType, 4);
  466. // else
  467. // stm.registerOutParameter(place, javaType, param.Scale);
  468. // }
  469. // else if (javaType == oracleTypeRefCursor) {
  470. // stm.registerOutParameter(place, _oracleRefCursor);
  471. // }
  472. // else {
  473. // stm.registerOutParameter(place, javaType);
  474. // }
  475. //
  476. // }
  477. //
  478. // // get the the output parameter for a specific statement at a specific place
  479. // // returns the value of the output parameter
  480. // protected Object getOutputValue(
  481. // AbstractDbParameter param,
  482. // CallableStatement stm)
  483. // //throws SQLException
  484. // {
  485. // Object retVal = null;
  486. //
  487. // int place = param.getParameterPlace();
  488. //
  489. // // by the type of the parameter we know wich method to use
  490. // // on the statement
  491. // int type = param.JdbcType;
  492. //
  493. // if (type == Types.ARRAY)
  494. // retVal = stm.getObject(place);
  495. // else if (type == Types.BIGINT)
  496. // retVal = stm.getLong(place);
  497. // else if (type == Types.BINARY)
  498. // retVal = stm.getBytes(place);
  499. // else if (type == Types.BIT)
  500. // retVal = stm.getBoolean(place);
  501. // else if (type == Types.BLOB)
  502. // retVal = stm.getObject(place);
  503. // else if (type == Types.CHAR)
  504. // retVal = stm.getString(place);
  505. // else if (type == Types.CLOB)
  506. // retVal = stm.getObject(place);
  507. // else if (type == Types.DATE)
  508. // {
  509. // java.sql.Date date = stm.getDate(place);
  510. // if(date != null)
  511. // {
  512. // // convertirn sql.Date to DateTime
  513. // Calendar c = Calendar.getInstance();
  514. // c.setTime(date);
  515. //
  516. // retVal = vmw.common.DateTimeUtils.CalendarToDateTime(c);
  517. // }
  518. //
  519. // }
  520. // else if (type == Types.DECIMAL)
  521. // {
  522. // java.math.BigDecimal bd = stm.getBigDecimal(place);
  523. // if(bd != null)
  524. // retVal = vmw.common.PrimitiveTypeUtils.BigDecimalToDecimal(bd);
  525. // }
  526. // else if (type == Types.DISTINCT)
  527. // retVal = stm.getObject(place);
  528. // else if (type == Types.DOUBLE)
  529. // retVal = stm.getDouble(place);
  530. // else if (type == Types.FLOAT)
  531. // retVal = stm.getFloat(place);
  532. // else if (type == Types.INTEGER)
  533. // retVal = stm.getInt(place);
  534. // else if (type == Types.JAVA_OBJECT)
  535. // retVal = stm.getObject(place);
  536. // else if (type == Types.LONGVARBINARY)
  537. // retVal = stm.getBytes(place);
  538. // else if (type == Types.LONGVARCHAR)
  539. // retVal = stm.getString(place);
  540. // else if (type == Types.NULL)
  541. // retVal = DBNull.Value;
  542. // else if (type == Types.NUMERIC)
  543. // retVal = stm.getBigDecimal(place);
  544. // else if (type == Types.OTHER)
  545. // retVal = stm.getObject(place);
  546. // else if (type == Types.REAL)
  547. // retVal = stm.getFloat(place);
  548. // else if (type == Types.REF)
  549. // retVal = stm.getObject(place);
  550. // else if (type == Types.SMALLINT)
  551. // retVal = stm.getShort(place);
  552. // else if (type == Types.STRUCT)
  553. // retVal = stm.getObject(place);
  554. // else if (type == Types.TIME)
  555. // {
  556. // Time t = stm.getTime(place);
  557. // if(t != null)
  558. // {
  559. // java.util.Date d = new java.util.Date(t.getTime());
  560. // // convertirn sql.Date to DateTime
  561. // Calendar c = Calendar.getInstance();
  562. // c.setTime(d);
  563. //
  564. // retVal = vmw.common.DateTimeUtils.CalendarToDateTime(c);
  565. // }
  566. //
  567. // }
  568. // else if (type == Types.TIMESTAMP)
  569. // {
  570. // Timestamp ts = stm.getTimestamp(place);
  571. // if(ts != null)
  572. // {
  573. // java.util.Calendar cal = java.util.Calendar.getInstance();
  574. // cal.setTime(new java.util.Date(ts.getTime() + ts.getNanos()/1000000));
  575. // retVal = (DateTime)vmw.common.DateTimeUtils.CalendarToDateTime(cal);
  576. // }
  577. // }
  578. // else if (type == Types.TINYINT)
  579. // retVal = stm.getByte(place);
  580. // else if (type == Types.VARBINARY)
  581. // retVal = stm.getBytes(place);
  582. // else if (type == Types.VARCHAR)
  583. // retVal = stm.getString(place);
  584. //
  585. // if(stm.wasNull())
  586. // retVal = DBNull.Value;
  587. //
  588. // return retVal;
  589. // }
  590. //
  591. //
  592. //// IDbDataParameter IDbCommand.CreateParameter()
  593. //// {
  594. //// return null;
  595. //// }
  596. //
  597. //// IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)
  598. //// {
  599. //// return null;
  600. //// }
  601. ////
  602. //// IDataReader IDbCommand.ExecuteReader()
  603. //// {
  604. //// return null;
  605. //// }
  606. ////
  607. //// int IDbCommand.ExecuteNonQuery()
  608. //// {
  609. //// return -1;
  610. //// }
  611. ////
  612. //// void IDbCommand.Prepare()
  613. //// {
  614. //// }
  615. //
  616. //
  617. //// public IDataParameterCollection Parameters
  618. //// {
  619. //// get
  620. //// {
  621. //// return _paramCollection;
  622. //// }
  623. //// }
  624. //
  625. // ~AbstractDBCommand()
  626. // {
  627. // Dispose();
  628. // }
  629. //
  630. // public new void Dispose()
  631. // {
  632. // if (_paramCollection != null)
  633. // _paramCollection.Clear();
  634. //
  635. // _connection = null;
  636. // _transaction = null;
  637. //
  638. // if (_statement != null)
  639. // {
  640. // _statement.close();
  641. // _statement = null;
  642. // }
  643. // base.Dispose();
  644. // }
  645. //
  646. // protected void CheckTrasactionContext()
  647. // {
  648. // if (_connection.Transaction != null &&
  649. // (Transaction == null || Transaction != _connection.Transaction)) {
  650. // throw new InvalidOperationException("Execute requires the command to have a transaction object" +
  651. // " when the connection assigned to the command is in a pending local transaction." +
  652. // " The Transaction property of the command has not been initialized.");
  653. // }
  654. // }
  655. //
  656. // protected String buildJavaCommand(String command)
  657. // {
  658. // IDataParameterCollection parameters = Parameters;
  659. //
  660. // if (parameters != null && parameters.Count > 0) {
  661. // string tokens = command;
  662. // System.Text.StringBuilder sb = new System.Text.StringBuilder(tokens.Length);
  663. //
  664. // int currParameter = 0;
  665. // int currStart = 0;
  666. // int curr = 0;
  667. // char curSeparator = (char)0;
  668. // bool foundSeparator = false;
  669. //
  670. // for(;curr<tokens.Length;curr++) {
  671. // switch(tokens[curr]) {
  672. // case '"':
  673. // case '\'':
  674. // if (foundSeparator) {
  675. // if (curSeparator == tokens[curr]) {
  676. // foundSeparator = false;
  677. // }
  678. // }
  679. // else {
  680. // // start inner string
  681. // foundSeparator = true;
  682. // curSeparator = tokens[curr];
  683. // }
  684. // break;
  685. // case '?':
  686. // if (!foundSeparator) {
  687. // if (curr > currStart) {
  688. // // copy collected
  689. // sb.Append(tokens,currStart,curr - currStart);
  690. // }
  691. // // append parameter value
  692. // AbstractDBParameter param = (AbstractDBParameter)parameters[currParameter++];
  693. // sb.Append(param.formatParameter());
  694. // currStart = curr+1;
  695. // }
  696. // break;
  697. // }
  698. // }
  699. //
  700. // if (curr > currStart) { // end of the stirng
  701. // sb.Append(tokens,currStart,curr - currStart);
  702. // }
  703. //
  704. // command = sb.ToString();
  705. // }
  706. // return command;
  707. // }
  708. //
  709. // internal void fillParameters()
  710. // {
  711. // if(CommandType == CommandType.StoredProcedure)
  712. // {
  713. // AbstractDBParameter param;
  714. // CallableStatement stm = (CallableStatement)_statement;
  715. // // get the output parameters from the statement
  716. // // and put their values into the SqlParameter
  717. // for (int i = 0; i < _paramCollection.Count; i++)
  718. // {
  719. // param = (AbstractDBParameter)_paramCollection[i];
  720. //
  721. // if (param.IsOracleRefCursor)
  722. // continue;
  723. //
  724. // ParameterDirection direction = param.Direction;
  725. // if (direction == ParameterDirection.InputOutput
  726. // || direction == ParameterDirection.Output
  727. // || direction == ParameterDirection.ReturnValue)
  728. // param.Value = getOutputValue(param, stm);
  729. // }
  730. // }
  731. // }
  732. //
  733. // protected void setCommandBehabior(CommandBehavior cmdBehavior)
  734. // {
  735. // _behvior = cmdBehavior;
  736. // }
  737. //
  738. // internal CommandBehavior getCommandBehavior()
  739. // {
  740. // return _behvior;
  741. // }
  742. //
  743. // protected static String GetProcedureName(string cmdText)
  744. // {
  745. // if(cmdText[0] == '[' && cmdText[cmdText.Length - 1] == ']')
  746. // return cmdText.Substring(1, cmdText.Length - 2);
  747. // return cmdText;
  748. // }
  749. //
  750. // }
  751. //}