class GDB
{
        Config config;
        MySQLDriver driver;
        DataSource ds;
        Connection conn;

        this(Config config)
        {
                this.config = config;
                driver = new MySQLDriver();
                string[string] params;
string url = MySQLDriver.generateUrl("localhost", 3306, "geodb");
            params = MySQLDriver.setUserAndPassword("root", "123");
            ds = new ConnectionPoolDataSourceImpl(driver, url, params);
                conn = ds.getConnection();
        
        }
        

void dbInsert(string login, string uploading_date, string geometry_type, string data)
        {
            Statement stmt = conn.createStatement();
                //stmt.executeUpdate("...");
                // some processing of request
                scope(exit) stmt.close(); // closing
        }

        void getIMGsMetadataFromDB(Json request)
        {

            Statement stmt = conn.createStatement();
        //stmt.executeWuery("...");
                // some processing of request
                scope(exit) stmt.close(); // closing
        }
        
Is this code is more correct?

Reply via email to