Package org.tmatesoft.sqljet.core.table

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable


   */
  public int loadSettings(Vector<Podcast> podcasts,
              URLDownloadList downloads,
              ProgSettings settings){
    boolean firstRun = true;
    ISqlJetTable table = null;
   
    File podsalinanDBFile = new File(settingsDir.concat("/podsalinan.db"));
    if (podsalinanDBFile.exists()){
      SqlJetDb podsalinanDB = new SqlJetDb(podsalinanDBFile,true);
     
      addColumnToTable(podsalinanDB,"podcasts","auto_queue","INTEGER");
     
      try {
        table = podsalinanDB.getTable("downloads");
        podsalinanDB.beginTransaction(SqlJetTransactionMode.READ_ONLY);
        if (table!=null){
          ISqlJetCursor currentDBLine = table.order(table.getPrimaryKeyIndexName());
          if (!currentDBLine.eof()){
            do {
              URLDownload newDownload = new URLDownload(currentDBLine.getString("url"),
                                    currentDBLine.getString("size"),
                                      currentDBLine.getString("destination"),
                                      currentDBLine.getString("podcastSource"),
                                      (int)currentDBLine.getInteger("status"));
                newDownload.setAdded(true);
                downloads.addDownload(newDownload, (int)currentDBLine.getInteger("priority"));
            } while (currentDBLine.next());
          }
        }
      } catch (SqlJetException e){
        debugOutput.printStackTrace(e.getStackTrace());
        return -1;
      } finally {
        try {
          podsalinanDB.commit();
        } catch (SqlJetException e) {
          debugOutput.printStackTrace(e.getStackTrace());
          return -1;
        }
      }
       
      try {
        table = podsalinanDB.getTable("settings");
        podsalinanDB.beginTransaction(SqlJetTransactionMode.READ_ONLY);
       
        if (table!=null){
          ISqlJetCursor currentDBLine = table.order(table.getPrimaryKeyIndexName());
          if (!currentDBLine.eof()){
            do {
              settings.addSetting(currentDBLine.getString("name"), currentDBLine.getString("value"));
            } while (currentDBLine.next());
          }
        }
      } catch (SqlJetException e) {
        debugOutput.printStackTrace(e.getStackTrace());
        return -1;
      } finally {
        try {
          podsalinanDB.commit();
        } catch (SqlJetException e) {
          debugOutput.printStackTrace(e.getStackTrace());
          return -1;
        }
      }

      try {
        table = podsalinanDB.getTable("podcasts");
        podsalinanDB.beginTransaction(SqlJetTransactionMode.READ_ONLY);
        if (table!=null){
          ISqlJetCursor currentDBLine = table.order(table.getPrimaryKeyIndexName());
          if (!currentDBLine.eof()){
            do {
              Podcast newPodcast = new Podcast(currentDBLine.getString("name"),
                               currentDBLine.getString("url"),
                               currentDBLine.getString("directory"),
View Full Code Here


        int sqlType=0;
        if (!download.isAdded()){
          //System.out.println("Adding Download");
          //System.out.println("URL= "+download.getURL().toString());
          //System.out.println("Destination= "+download.getDestination());
          ISqlJetTable table = db.getTable("downloads");
          table.insert(null,download.getURL().toString(),
                        Long.parseLong(download.getSize()),
                        download.getDestination(),
                        downloadCount,download.getPodcastId(),
                        download.getStatus());
          sqlType=1;
View Full Code Here

            try
            {
                db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
                try
                {
                    ISqlJetTable table = db.getTable("RssReader");
                    ISqlJetCursor cursor = table.open();
                    try
                    {
                        do
                        {
                            final String feedLanguage = cursor.getString("language");
View Full Code Here

            try
            {
                db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
                try
                {
                    ISqlJetTable table = db.getTable("HtmlReader");
                    ISqlJetCursor cursor = table.open();
                    try
                    {
                        do
                        {
                            final String siteLanguage = cursor.getString("language");
View Full Code Here

    throws SqlJetException
    {
        db.beginTransaction(SqlJetTransactionMode.WRITE);
        try
        {
            ISqlJetTable table = db.getTable("front_pages");
           
            Map<String,Object> fields = new HashMap<String, Object>();
            fields.put("key", fp.getUserTitle() );
            fields.put("title", fp.getTitle() );
                   
            long rowid = table.insertByFieldNamesOr(SqlJetConflictAction.REPLACE, fields);
           
            db.commit();
            return true;
        }        
        catch(Exception ex)
View Full Code Here

    throws SqlJetException
    {
        db.beginTransaction(SqlJetTransactionMode.WRITE);
        try
        {
            ISqlJetTable table = db.getTable("articles");
           
            Map<String,Object> fields = new HashMap<String, Object>();
            fields.put("key", a.getGuid() );
            fields.put("front_page", fp.getUserTitle() );
            fields.put("title", a.getTitle() );
            fields.put("content", a.getContent() );
            fields.put("url", a.getUrl());
            File imageFile = a .getImageFile();
            if(imageFile!=null)
            {
                fields.put("image", imageFile.getName() );
            }
            else
            {
                fields.put("image", null);
            }
            fields.put("published", a.getPublicationDate() );
            fields.put("refreshed", Calendar.getInstance().getTimeInMillis() );                             
           
            long rowid;
            if( insertOnly==true )
            {
                fields.put("new_entry", Boolean.TRUE.toString());
                rowid = table.insertByFieldNames(fields);
            }
            else
            {
                fields.put("new_entry", Boolean.FALSE.toString());
                rowid = table.insertByFieldNamesOr(SqlJetConflictAction.REPLACE, fields);
            }
           
            db.commit();
            return true;
        }        
View Full Code Here

    private static BasicFrontPage getFrontPage(SqlJetDb db, String frontPageName)
    throws SqlJetException
    {

        BasicFrontPage fp = new BasicFrontPage();
        ISqlJetTable table = db.getTable("front_pages");
        ISqlJetCursor cursor = table.lookup(null, frontPageName);       
       
       
        try
        {
            fp.setUserTitle( cursor.getString("key") );
View Full Code Here

                try
                {
                    db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
                    try
                    {
                        ISqlJetTable table = db.getTable("articles");
                        ISqlJetCursor cursor = table.order("published_article_index"/*table.getPrimaryKeyIndexName()*/);
                        long rowCount = cursor.getRowCount();
                        try
                        {
                            if( cursor.goToRow(index) == false )
                            {
View Full Code Here

                try
                {
                    db.beginTransaction(SqlJetTransactionMode.WRITE);
                    try
                    {
                        ISqlJetTable table = db.getTable("articles");
                        ISqlJetCursor cursor = table.open();
                        try
                        {
                            //- - - - - - - - - - - - - - -
                            // For each entry in the
                            // "articles" table...
View Full Code Here

    private SqlJetDb db;

    private boolean isAnswered(int number) throws SqlJetException {
        db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
        try {
            ISqlJetTable table = db.getTable("answers");
            ISqlJetCursor cursor = table.lookup("login_question", login.getLogin(), number);
            return !cursor.eof();
        } finally {
            db.commit();
        }
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.sqljet.core.table.ISqlJetTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.