Re: [ROOT] TSQLResult::Query() Return Values

From: Valeriy Onuchin (onuchin@fnal.gov)
Date: Mon Feb 19 2001 - 16:24:22 MET


"Stephen A. Fuqua" wrote:

>
> Here's the basic situation: I want to upload data via SQL to a database,
> and then check if the insert statement executed properly. Idealy, if my
> database object is called "db", I would like to have db->Query("insert
> ...") return a value indicating success. Obviously, values are returned
> if the query string contains a select statement. But what if its just a
> command, not a question?
>
> In summation: how do I tell if a query command executed properly?
>
> Stephen A. Fuqua
>

Hi Stephen,
try RDBC which is JDBC/ROOT SQL complient.
Download the latest snapshot from
http://d-000692-co.dhcp.fnal.gov/~onuchin/tmp/ RDBC-1.0.2-010218.tar.gz

Use ( check also examples from macros directory )

Int_t TSQLStatement::ExecuteUpdate( const TString& sql )
{
   // Executes an SQL INSERT, UPDATE or DELETE statement.
   // In addition, SQL statements that return nothing,
   // such as SQL DDL statements, can be executed.
   //
   //  Parameters:
   //      sql - a SQL INSERT, UPDATE or DELETE statement or
   //            a SQL statement that  returns nothing
   //
   //  Returns:
   //      either the row count for INSERT, UPDATE or DELETE or
   //      0 for SQL statements that return nothing
   //  Throws:
   //      TSQLException - if a database access error occurs


HTH.    Valeriy



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:36 MET