Android Open Source - ASQLDatabase A Sql Database






From Project

Back to project page ASQLDatabase.

License

The source code is released under:

GNU General Public License

If you think the Android project ASQLDatabase listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mptr.asqldatabase;
/* www . jav a 2s.c  o  m*/
import java.net.URL;

/**
 * Manages SQL databases. 
 * The databases are managed via PHP files which are stored on a remote server.
 * Connection to the server is achieved which URL class and HTTP/HTTPS protocol. 
 * 
 * @author Michal Poteralski <michalpoteralski@gmail.com>
 * @version 0.1
 * @see java.net.URL
 */
public class ASqlDatabase {
public static final String ASQLDATABASE_DEBUG_TAG = "ASQLDATABASE DEBUG";
private String databaseName, userName, password;
private URL hostName;


  /**
   * Creates ASqlDatabase object.
   * 
   * @param hostName {@link URL} object which represents host name (IP or HTTP)
   * @param databaseName Database name
   * @param userName Database user name
   * @param password Database user password
   */
  public ASqlDatabase(URL hostName, String databaseName, String userName, String password) {
    setHostName(hostName);
    setDatabaseName(databaseName);
    setUserName(userName);
    setPassword(password);
  }

  /**
   * Returns database user password.
   * 
   * @return Database user password
   * 
   * @see #setPassword(String)
   */
  public String getPassword() {
    return password;
  }

  /**
   * Sets database user password.
   * 
   * @param password
   * 
   * @see #getPassword()
   */
  public void setPassword(String password) {
    this.password = password;
  }

  /**
   * Gets database user name.
   * 
   * @return Database user name.
   * 
   * @see #setUserName(String)
   */
  public String getUserName() {
    return userName;
  }

  /**
   * Sets database user name. 
   * 
   * @param userName Database user name
   * 
   * @see #getUserName()
   */
  public void setUserName(String userName) {
    this.userName = userName;
  }

  /**
   * Gets database user name.
   * 
   * @return Database user name
   * 
   * @see #setDatabaseName(String)
   */
  public String getDatabaseName() {
    return databaseName;
  }

  /**
   * Sets database name.
   * 
   * @param databaseName Database name
   * 
   * @see #getDatabaseName()
   */
  public void setDatabaseName(String databaseName) {
    this.databaseName = databaseName;
  }

  /**
   * Gets database host name.
   * 
   * @return {@link URL} object which represents host name
   * 
   * @see #setHostName(URL)
   */
  public URL getHostName() {
    return hostName;
  }

  /**
   * Sets host name
   * @param hostName {@link URL} object which represents host name
   * 
   * @see #getHostName()
   */
  public void setHostName(URL hostName) {
    this.hostName = hostName;
  }
  
  /**
   * Opens database.
   * 
   * @return True if database is open successfully otherwise returns false.
   * 
   * @see #isOpen()
   * @see #close()
   */
  public boolean open() {
    return false;
  }
  
  /**
   * Checks if database is open.
   * 
   * @return True if database is open otherwise return false.
   * 
   * @see #open()
   * @see #close()
   */
  public boolean isOpen() {
    return false;
  }
  
  /**
   * Closes database.
   * 
   * @return True if database is close successfully otherwise returns false.
   * 
   * @see #isOpen()
   * @see #open()
   */
  public boolean close() {
    return false;
  }

  /**
   * Adds a query to the queue.
   * 
   * @param query String which represent SQL database query.
   * @param execId An unique id which specifies query.
   * @return True if the query has been successfully added to queue, otherwise returns false.
   * 
   * @see #removeFromExecQueryQueue(int)
   * @see #execQuery()
   */
  public int addToExecQueryQueue(String query, int execId) {
    return 0;
  }
  
  /**
   * Removes a query from the queue.
   * 
   * @param execId An unique id which specifies query. 
   * @return True if query has been successfully removed from queue, otherwise return false.
   * 
   * @see #addToExecQueryQueue(String, int)
   * @see #execQuery()
   */
  public int removeFromExecQueryQueue(int execId) {
    return 0;
  }
  
  /**
   * Executes query added to the query queue with {@link #addToExecQueryQueue(String, int)}.
   * The queries will be executed without encryption.
   * 
   * Before queries will be executed please bear in mind that {@link #open()} method must to be successfully invoked.
   * 
   * @return True if queries list will being executed otherwise return false.
   * 
   * @see #addToExecQueryQueue(String, int)
   * @see #removeFromExecQueryQueue(int)
   */
  public boolean execQuery() {
    return false;
  }
  
  /**
   * Executes query added to the query queue with {@link #addToExecQueryQueue(String, int)} with encryption.
   * The queries will be executed with encryption provided by {@link SecurityWriter}.
   * 
   * @param writer
   * @return True is query will being successfully executed, otherwise return false.
   * 
   * @see #addToExecQueryQueue(String, int)
   * @see #removeFromExecQueryQueue(int)
   * @see SecurityWriter
   */
  public boolean execQuer(SecurityWriter writer) {
    return false;
  }
  
  /**
   * Registers a listener which will be invoked after query execution.
   * 
   * @param listener ASqlDatabaseListener class represents listener which will being invoked.
   * @return True if the listener has been successfully registered, otherwise returns false.
   * 
   * @see #unregisterListener(ASqlDatabaseListener)
   * @see #isListenerRegistered(ASqlDatabaseListener)
   */
  public boolean registerListener(ASqlDatabaseListener listener) {
    
    return false;
  }
  
  /**
   * Unregister an listener.
   * 
   * @param listener ASqlDatabaseListener class represents listener which will being invoked.
   * @return True if the listener has been successfully unregistered, otherwise returns false.
   * 
   * @see #registerListener(ASqlDatabaseListener)
   * @see #isListenerRegistered(ASqlDatabaseListener)
   */
  public boolean unregisterListener(ASqlDatabaseListener listener) {
    
    return false;
  }
  
  /**
   * Checks if listener has been registered.
   * 
   * @param listener ASqlDatabaseListener class represents listener which will being invoked.
   * @return True if the listener has been registered, otherwise returns false.
   * 
   * @see #registerListener(ASqlDatabaseListener)
   * @see #unregisterListener(ASqlDatabaseListener)
   */
  public boolean isListenerRegistered(ASqlDatabaseListener listener) {
    return false;
  }
}




Java Source Code List

com.mptr.asqldatabase.ASqlDatabaseListener.java
com.mptr.asqldatabase.ASqlDatabase.java
com.mptr.asqldatabase.JsonFieldName.java
com.mptr.asqldatabase.PhpExecutorListener.java
com.mptr.asqldatabase.PhpExecutor.java
com.mptr.asqldatabase.SecurityWriter.java