Tom and all the others that have taken their time to help,


After reading various reply, I have no doubt about the stability of RBSQL. I came to the conclusion that the problem MUST be in my code.

Therefore, I have decided to re-write the Database module from scratch. I am testing things now, and it seems good so far...

I assume, that I was writting over my Database file somehow and re-creating an empty file with no Table in certain obscure circumstances.

Thank you all for your time, nice to feel the comunity around when problem arise ;-)


Youri



Tom Benson wrote:
Youri,

I'm beginning to wonder whether or not your app is simply creating a new database file, overwriting the old one??

Assuming you are using a local DB (RBDB) file of course. How does your app build the file if it's not there? Does it check to make sure the database exists before creating a new one? Sounds simple, but Ocham's Razor rarely fails me....

- Tom

On 13/12/2006, at 7:28 PM, Youri wrote:


Bart, Tom,

The problem is not to my opinion in inserting data and selecting the correct database file. I have for proof that last night I ran my app did some insertions from CSV file. Quit re-opened many times, deleted, and re-imported the very same data to see if there was something wrong.

Not only I didn't loose any data (let say the Table didn't disapear which is quite different from only loosing datas somehow), but everytime I inserted datas from a csv file I confirmed the presence of these datas using Marco's app. In the limit of the 20 records shown, ALL datas where there in the DB, and yes there is only one database file on my disk so it is the same one as the one used by my app.

I also ran a delete via my app, the datas where deleted, but not the table (checked with SQLiteManager again) re-inserted datas and then again it worked fine. Then I thought everything was fine by then.

I just re-opened the project this morning in the very same way as I did last night, and... no more TABLE in the Database...

If it was a problem with a COMMIT, datas would not be present in the database but TABLE would not be affected!

Let me also mention that this app doesn't do much so far :


1 single table (4 fields Database)
1 button to Import csv file in the database
Populate a listbox with the records present
1 pushbutton to run a DELETE all records in the TABLE with the following Method :

DB_DELETE (engine as integer, tablename as string)
  Return Boolean


  dim query As  string
  query = "DELETE FROM " + tablename
  select case engine
  case KengineRDB
    MyRDB.SQLExecute (query)
    if MyRDB.ErrorMessage = "" then
      Return true
    else
      Return false
    end if

  case KengineRDBServer

  Case KengineValentina

  Case KengineValentinaServer

  Case KengineMySQL

  Case KenginePGSQL

  end


This is going crazy, and moreover we ran into the very same problem during the 2 training sessions and it was not solved by RB France Tech support.


Cheers,

Youri


Bart Pietercil wrote:
On 12-dec-06, at 23:22, Youri wrote:

Bart,


Not possible in my case, as I create this simple DB with Marco's app (SQLiteManager in demo mode). When the Table has disapeared, I re-create it using SQL in SQLiteManager.

I don't handle any creation/alteration of the structure of the BD inside my code. I don't use bindings, nor any RB controls (DataControl, DatabaseQuery). No fancy SQL (just SELECT so far...).

For instance, I import records from a text file (.csv) with the following Method :


  select case engine

  case KengineRDB
    Dim f, ff as FolderItem
    Dim textInput As TextInputStream
    Dim rowFromFile,oneCell As String
    Dim i, nbrechamps As Integer

    f = getfolderitem(app.NomBase)
Verify if app.NomBase is not Nil AND valid?
Verify if f = valid ?
    ff = GetOpenFolderItem("")  //defined as a FileType


    If ff <> Nil Then

      if DB_Connect(KengineRDB, f) then
in DB_Connect try to read the tableschema , should return the name of the predefined table
I would suggest concentrating on these calls, before looking further
HTH
Bart

        textInput = ff.OpenAsTextFile
        textInput.Encoding= Encodings.MacRoman //strings are MacRoman
        nbrechamps = CountFields(rowFromFile,",")

        dim rec as New DatabaseRecord

        Do
          rowFromFile = textInput.ReadLine

rec.IntegerColumn("ID_Patient") = DB_autoincrement(KengineRdb,"PATIENTS_TBL","ID_Patient")
          rec.Column("Genre") = NthField(rowFromFile, ",",2)
          rec.Column("Nom") = NthField(rowFromFile, ",",3)
          rec.Column("Prenom") = NthField(rowFromFile, ",",4)
          rec.Column("No_SS") = NthField(rowFromFile, ",",5)

          if DB_insertRecord (KengineRDB,rec, "PATIENTS_TBL") then

            MyRDB.Commit

            // All is OK
          else
            MsgBox "Erreur à l'insertion"
          end if

        Loop Until textInput.EOF
        textInput.Close

      else
        // Pas de connection à la Base de Données
      end if
    End If

  case KengineRDBServer

  Case KengineValentina

  Case KengineValentinaServer

  Case KengineMySQL

  Case KenginePGSQL

  end






Youri








Bart Pietercil wrote:
On 12-dec-06, at 21:57, Youri wrote:


Maybe you are inserting your table and their data inside a transaction and then instead of "commit" you "rollback"...

Can you please explain what you mean?
Marco means that it is possible to
1) start a transaction (look for "begin transaction" or "begin work")
2) create the table
3) fill it with data
then quit
Since I omitted the necessary "commit" step sqlite will cancel (rollback) everything you did until the start of the transaction. Another possibility would be that you create the table as a temporary table. Look at the create code for the db

Would this Delete my Table?
yes


or there is an error
somewhere executing an sql command that you are ignoring...


Nop. I have been looking for all sql command and nothing that could delete the Table.


Cheers,

HTH
Bart Pietercil
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to