Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Update data SQLite

$
0
0

Hello guys,

Continuing with the testing database, I'm using SQLite, I now have the "next step", that is to update.

How to get the code to update the data?

I have this example:

import de.bezier.data.sql.*;
SQLite db;

void setup(){
  size( 100, 100 );

  //DDL Table
  /*CREATE TABLE Historia (
    hisCodigo    INTEGER       PRIMARY KEY,
    hisDescricao VARCHAR (100) NOT NULL,
    hisLink      VARCHAR (255) NOT NULL,
    hisFleg      CHAR (1)      NOT NULL
  );*/


  db = new SQLite( this, "dados.db" );  // open database file
  if (db.connect()){

    int codigo = 1;
   //String strSQL = "UPDATE Historia SET hisFleg = '0' WHERE hisCodigo = '"+codigo+"' ";
   //db.execSQL(strSQL);
   //db.update(strSQL);

    db.query( "SELECT * FROM Historia WHERE hisCodigo = '"+codigo+"' " );

    while (db.next()){
      println(db.getInt("hisCodigo") + " - " + db.getString("hisFleg") );
    }
  }
}

In the examples just thought how to SELECT, UPDATE must now make ...

I tried to do as the example commenting, but returns error.

Thanks for listening


Viewing all articles
Browse latest Browse all 2896

Trending Articles