Minor changes to tables for device registration phone app integration; these changes...
[iot2.git] / iotjava / iotinstaller / Table.java
index 8e514d61fead3f6a59735299502024984f720f07..c3fa5ab1811ef154f0ac60da707a8c8b6271e9d5 100644 (file)
@@ -234,11 +234,18 @@ public class Table {
         */
        public boolean isTableEmpty() {
 
-               if (rs == null) {
-                       return true;
+               // Check if this table has any entries
+               String strCommand = "SELECT * FROM " + strTableName;
+               rs = sqlInterface.sqlCommandQuery(strCommand);
+               try {
+                       if (!rs.first()) {
+                               return true;
+                       }
+               } catch(SQLException ex) {
+                       System.out.println("Table: Exception: ");
+                       ex.printStackTrace();
                }
                return false;
-
        }
 
        /**