Package com.pugh.sockso.db

Examples of com.pugh.sockso.db.Database.prepare()


        st.setInt( 1, 10 );
        expect( st.executeQuery() ).andReturn( rs ).times( 1 );
        replay( st );
       
        final Database db = createMock( Database.class );
        expect( db.prepare((String)anyObject()) ).andReturn( st ).times( 1 );
        replay( db );
       
        final Latester b = new Latester();
        b.setProperties( p );
        b.setDatabase( db );
View Full Code Here


            final String sql = " select t.path as path " +
                               " from tracks t " +
                               " where t." +typeName+ "_id = " +id;
            final Database db = getDatabase();
           
            st = db.prepare( sql );
            rs = st.executeQuery();
       
            while ( rs.next() ) {
                final String path = rs.getString( "path" );
                if ( !taken.contains(path) ) {
View Full Code Here

        try {
           
            final Database db = getDatabase();
            final String sql = " select c.id, c.path " +
                               " from collection c ";
            st = db.prepare( sql );

            rs = st.executeQuery();

            final List<Collection> folders = new ArrayList<Collection>();
            while ( rs.next() )
View Full Code Here

                        " group by artistId, artistName, albumId, albumName, albumYear, trackId, " +
                            " trackName, trackPath, trackNo, genreId, genreName, dateAdded " +
                        " having count(l.id) > 0 " +
                        " order by count(l.id) desc " +
                        " limit ? ";
            st = db.prepare( sql );
           
            st.setInt( 1, (int) p.get(Constants.WWW_BROWSE_POPULAR_TRACK_COUNT,20) );
           
            rs = st.executeQuery();
View Full Code Here

                                   : " ar.browse_name like ? ") +
                         " group by tr.album_id, ar.id, ar.name) " +
                   " group by name, id " +
                   " order by name asc ";

            st = db.prepare( sql );

            if ( !letter.equals("") ) {
                st.setString( 1, letter + "%" );
            }
View Full Code Here

                            " on t.id = pt.track_id " +
                            " inner join users u " +
                            " on u.id = p.user_id " +
                        " group by p.id, p.name, p.date_created " +
                        " order by p.date_created desc ";
            st = db.prepare( sql );
            rs = st.executeQuery();
           
            final List<Playlist> userPlaylists = new ArrayList<Playlist>();
            while ( rs.next() )
                userPlaylists.add( new Playlist(
View Full Code Here

                            " left outer join playlist_tracks pt " +
                            " on pt.playlist_id = p.id " +
                        " where p.user_id is null " +
                        " group by p.id, p.name, p.date_created " +
                        " order by p.date_created desc ";
            st = db.prepare( sql );
            rs = st.executeQuery();
           
            final List<Playlist> sitePlaylists = new ArrayList<Playlist>();

            while ( rs.next() )
View Full Code Here

           
            final Database db = getDatabase();
            final String sql = Track.getSelectFromSql() +
                  " where t.album_id = ? " +
                  " order by t.track_no asc ";
            st = db.prepare( sql );
            st.setInt( 1, albumId );
            rs = st.executeQuery();

            return Track.createListFromResultSet( rs );
           
View Full Code Here

                    " from albums al " +
                        " inner join artists ar " +
                        " on ar.id = al.artist_id " +
                    " where al.id = ? " +
                    " limit 1 ";
            st = db.prepare( sql );
            st.setInt( 1, id );
            rs = st.executeQuery();
            if ( !rs.next() )
                throw new BadRequestException( "album not found", 404 );
View Full Code Here

                            " left outer join tracks t " +
                            " on t.album_id = al.id " +
                        " where (t.artist_id = ? or al.artist_id = ?) " +
                        " group by artistId, artistName, albumId, albumYear, albumName " +
                        " order by al.year desc, al.name asc ";
            st = db.prepare( sql );
            st.setInt( 1, artistId );
            st.setInt( 2, artistId );
            rs = st.executeQuery();

            final List<Album> albums = new ArrayList<Album>();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.