Hi Ede, edgar.soldin wrote:
>hey Coding Jukka, Thanks for your comments. Ain't no coding yet, I rather copied, pasted, modified, and tried if it still compiles. > some comments inline, nothing major though > > if (loadGisExtension()){ > + geoPackageMetaData = queryToInt("select > +CheckGeoPackageMetaData()"); > spatialMetaData = queryToInt("select > CheckSpatialMetaData()"); > System.out.println("spatialMetaData: " + > spatialMetaData); > + System.out.println("geoPackageMetaData: " + > + geoPackageMetaData); > if (spatialMetaData == 2) { //FDO/OGR > queryToInt("select AutoFDOStart()"); > + } > + if (geoPackageMetaData == 1) { // GeoPackage > + queryToInt("select AutoGPKGStart()"); > } > return true; > } else return false; > as GeoPackage and FDO are probably exclusive you should consider running one > query checking it's result and running the other only if the first was > unsuccessful. that will save > one query potentially making the extension (a > little bit) faster. Well, AutoFDOStart and AutoGPKGStart may be exclusive but I have not made tests with such peculiar databases. However, it is possible to create a database which has tables which are using different encodings: SpatiaLite + GeoPackage, or even FDO+GeoPackage. Doing so is a call for trouble, though. Running both "select CheckSpatialMetaData()" and "select CheckGeoPackageMetaData is not expensive and allows to print the results into the log file which may help users later with debugging. I would rather enhance the output by printing a clear warning in such case. There may be a real problem if user has older Spatialite extension which do not have CheckGeoPackageMetaData function at all. I believe that the plugin would throw an error by now and stop even it could still handle SpatiaLite and FDO perfectly. Another option would be to check the SpatiaLite version with "select spatialite_version()" and stop the game with an advice to update if it is less than 4.2.0. > also, the indention is not proper here. choose either space or tabs. use > either what was used by the original author or use OJ standard, which is only > tabs with 2 spaces indention. might make sense to reformat the whole file > then. Sorry, what does "only tabs with 2 spaces indention" mean? To use tabs or to use 2 spaces instead of tabs? The standard of the original author seems to be to use mostly tabs but also 4 spaces instead of tab. Both alternatives occur in every source file which I checked. >> + if (geoPackageMetaData==1) {sql=metadataSQL_4;} >> + else if (spatialMetaData==0) {sql=metadataSQL_0;} >> + else if (spatialMetaData==2) {sql=metadataSQL_2;} >> + else {sql=metadataSQL_1_3;} >> + ; > consider giving metadataSQL_* speaking names like metadataSQL_GeoPkg, > metadataSQL_FDO etc. I consider. The original author used coded names but after my edits the metadata check is now different and meaning of the coded names are not obvious any more. -Jukka- ------------------------------------------------------------------------------ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel