コード例 #1
0
	@Test
	public void testParseSimilarity() {
		String command = "select book.id, publisher.id " + 
						 "from book, publisher " + 
						 "where book.id > 200000 and " +
						 "publisher.id > 100000 and " + 
						 "book.id = publisher.id and " +
						 "ED(book.authors, \"whoami\") < 10 and " +
						 "JACCARD(book.title, \"who are you\") > 0.8;";
		
		SQLCommand sqlCommand = sqlProcessor.parse(command);
		System.out.println(sqlCommand.toString());
		assertEquals(sqlCommand.selects.size(), 4);
	}
コード例 #2
0
	@Test
	public void testParse() {
		String command = "select book.id, publisher.id " + 
						 "from book, publisher " + 
						 "where book.id > 200000 and " +
						 "publisher.id > 100000 and " + 
						 "book.id = publisher.id and " +
						 "book.title = \"what\";";
		
		SQLCommand sqlCommand = sqlProcessor.parse(command);
		System.out.println(sqlCommand.toString());
		assertEquals(sqlCommand.projects, 
				new ArrayList<String>(Arrays.asList("book.id", "publisher.id")));
		
		assertEquals(sqlCommand.froms,
				new ArrayList<String>(Arrays.asList("book", "publisher")));
		assertEquals(sqlCommand.joins.size(), 1);
		assertEquals(sqlCommand.selects.size(), 3);		
	}