1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Is possible read version DB Sqlite as in Java or convert this code?

Discussion in 'Delphi Android And IOS' started by pumidru, May 18, 2014.

  1. pumidru
    Offline

    pumidru DF Junior

    Is possible convert this code for Delphi XE6 IOS compadible?
    On java


    Code:
    int CurrVerDB = db.getVersion();
       
      if (CurrVerDB <  newVersion ) {
                     if (CurrVerDB <  6 ) {       
                                upgradeQuery = "ALTER TABLE " + DatiWebServer.TABLE_NAME
                                        + " ADD COLUMN TRelay1 INTEGER DEFAULT 0";
                                db.execSQL(upgradeQuery);
                                db.execSQL(upgradeQuery);
                                myDataBase.setVersion(DATABASE_VERSION);
                         }
     }
    
      else {
                        Log.d("onUpgrade", "else-clause: Already upgraded!");
        }
    

    Thanks All
     
  2. pumidru
    Offline

    pumidru DF Junior

    Not found Db Version on Delphi, I solved this:

    create new database MyDB_101.s3db and import data by old database


    Code:
    if FileExists(PathDB + PathDelim + 'MyDB_100.s3db') then
      begin
        try
        FormMain.myLog.Lines.Add('Exit Old DB MyDB_100.s3db ');
        FDConnTmp := TFDConnection.Create(nil);
        With FDConnTmp do
        begin
          LoginPrompt := false;
          Params.Clear;
          Params.Values['Database'] := PathDB + PathDelim + 'MyDB_100.s3db';
          Params.Values['DriverID'] := 'SQLite';
          Params.Values['CharacterSet'] := 'utf8';
          Connected := false;
        end;
        ObjQry := TFDQuery.Create(nil);
        ObjQry.Connection := FDConnTmp;
        ObjQry.Close;
        ObjQry.SQL.Clear;
        ObjQry.SQL.Text := 'Select * From dati where ID=0';
        ObjQry.Open;
    
        myUrl := ObjQry.FieldByName('Url').AsString;
        MyPort := ObjQry.FieldByName('Port').AsString;
       
    
        ObjQry.Close;
        ObjQry.Free;
        FDConnTmp.Close;
        FDConnTmp.Free;
    
        if DeleteFile(PathDB + PathDelim + 'MyDB_100.s3db') = true then
        begin
          FormMain.myLog.Lines.Add('delete is ok');
        end;
        except
            FormMain.myLog.Lines.Add('error update DB 100 TO 101');
        end;
      end
      else
      begin
    
      end;
     
  3. pumidru
    Offline

    pumidru DF Junior

    Thanks
     

Share This Page