Menu

#86 Incorrect row count

open
5
2009-04-15
2009-04-15
No

I was trying to study the Joomla DB schema.

So, What I did is as follows:
- - Create two Joomla installations, One with the Test data installed, Other without it
- - Ran the following command
java -jar schema.jar -t mysql -o opfol/<DB Name> -dp "mysql-connector-java-5.1.7-bin.jar" -host localhost -db <DB Name> -u lauda -p gaandmarao

After that, when I opend the index.html page from both the folders to know the difference in number of rows, Both showed exactly same data.

I have attached opfol.rar. Please get it from http://www.mediafire.com/?sharekey=61b9729ae982fa1008f8df73f2072ed60fdee164365a665fce018c8114394287

It contins two RARs. One of them is jooj.rar other is jemp.rar.

joo.rar is the joomla db with sample data whereas jemp.rar does not have it.

STEPS TO RE-PRODUCE

- - Create two installation of Joomla CMS
- - While specifying the DB info, install sample data for one of them and not for the other
- - Run the command above to get the results

http://www.mediafire.com/?sharekey=61b9729ae982fa1008f8df73f2072ed60fdee164365a665fce018c8114394287

Discussion

  • John Currier

    John Currier - 2009-04-15

    The only explanation that I can think of is that you ran against the same database both times or that the number of rows couldn't be retrieved.

    I don't have access to mediafire.com from the office, but I assume the row counts are populated with something other than 0 or -1 (an indication that they couldn't be retrieved), right?

    John

     
  • Anonymous

    Anonymous - 2010-02-26

    I just had the same problem. My sample data:

    DROP DATABASE IF EXISTS schemaspyonedata;
    DROP DATABASE IF EXISTS schemaspyotherdata;

    CREATE DATABASE schemaspyonedata;
    CREATE DATABASE schemaspyotherdata;

    CREATE TABLE schemaspyonedata.test (id INT NOT NULL PRIMARY KEY);
    CREATE TABLE schemaspyotherdata.test (id INT NOT NULL PRIMARY KEY);

    INSERT INTO schemaspyonedata.test (id) VALUES (1),(2),(3),(4),(5);

    Ran schemaspy with -db schemaspyonedata -s schemaspyonedata, row count for test is 5, which is correct.
    Then I ran schemaspy with -db schemaspyotherdata -s schemaspyotherdata (and I know I ran it against this, because it is written in the result), row count for test is also 5, which is wrong, it must be 0 (I double-checked this by selecting the data manually in a mysql console – 0 rows).

    I can see the problem within net/sourceforge/schemaspy/dbTypes/mysql.properties:
    select table_rows row_count from information_schema.tables where table_name=:table
    If you have two different schemas with tables of the same name, the row count of the first table with that name within information_schema.tables will be used.

     
  • John Currier

    John Currier - 2010-02-26

    Just let me know what the correct SQL would be for MySQL and I'll update the .properties file.

    Thanks,
    john

     

Log in to post a comment.