Hi Muley,

You can use parameter substitution.  "logoutTime = ?" and pass-in the 
actual datetime as a parameter to execute().

-Colin

On Friday, April 3, 2015 at 1:13:04 AM UTC-5, Muley wrote:
>
> HI Colin,
>
> *Code for inserting DATETIME*
>
> public String insertInLoggingTable(LoggingDetails loggingDetails,
>             Registration user)
> {
> Vertex dataNodeloggingDetails = graph
>                                 .addVertex("class:LoggingDetails");
>
>
> dataNodeloggingDetails.setProperty("loginTime",loggingDetails.getLoginTime());
> ////
> }
>
>
>
> *Code for updating *
>
>
> public void updateInLoggingTable(LoggingDetails loggingDetails,
>             Registration user)
>     {
>         OrientGraph graph = 
> OrientDBConnectionClass.createOrientDbConnection()
>         .getTx();
>
> System.out
>         .println("code for updating loggingdetails for user  starts 
> here......... ");
>
> {
>
> {
>
>         String updatePart = "";
>         
>             updatePart = " logoutTime = '"
>                     + loggingDetails.getLogoutTime() + "' ";
>         
>         
>
>         if (updatePart.length() > 0) {
>
>             String updateQuery = "update LoggingDetails  set " + updatePart
>                     + " WHERE name = '" + loggingDetails.getUniqueId() + 
> "'";
>
>             System.out.println("update vertex LoggingDetails Query IS : "
>                     + updateQuery);
>
>             try {
>                 long startTime = System.currentTimeMillis();
>
>                 int no = graph.getRawGraph()
>                         .command(new OCommandSQL(updateQuery))
>                         .execute();
>                 // graph.commit();
>
>                 long endTime = System.currentTimeMillis();
>                 System.out.println("No of activities updated : " + (no)
>                         + " and time taken is : "
>                         + (endTime - startTime));
>                 
>                 graph.commit();
>             } catch (Exception e) {
>                 e.printStackTrace();
>                 graph.rollback();
>             } finally {
>                 System.out
>                         .println("update LoggingDetails shutting down the 
> graph...........");
>                 graph.shutdown();
>             }
>
>         }
>     }
> }
>
> System.out
>         .println("code for updating logdetials  Ends 
> here.......             ");
>
>     }
>     
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to