metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasper Sørensen (JIRA) <j...@apache.org>
Subject [jira] [Commented] (METAMODEL-97) getDefaultSchema() indexOf()
Date Mon, 17 Nov 2014 08:47:33 GMT

    [ https://issues.apache.org/jira/browse/METAMODEL-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14214423#comment-14214423
] 

Kasper Sørensen commented on METAMODEL-97:
------------------------------------------

Right ... I guess this is because the two schema names overlap ... Maybe you can propose a
solution that takes into account not just "a match" but "the best match" ?

> getDefaultSchema()   indexOf()
> ------------------------------
>
>                 Key: METAMODEL-97
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-97
>             Project: Metamodel
>          Issue Type: Bug
>    Affects Versions: 4.1.0-incubating, 4.2.0-incubating
>            Reporter: xgl1991714
>
> There are two databases:'mydb'  and 'mydb2' 
> But when I run:
> {quote}
> Class.forName({color:blue}"com.mysql.jdbc.Driver"{color});
> 		Connection conn = DriverManager.getConnection({color:blue}"jdbc:mysql://localhost:3306/mydb2?user=root&password=xxxx"{color});
> 		DataContext dataContext=DataContextFactory.createJdbcDataContext(conn);
> 		System.out.println({color:blue}"default schema is:"{color}+dataContext.getDefaultSchema());
> {quote}
> The reslut is:
> {quote}
> default schema is:mydb
> {quote}
> the code of method getDefaultSchema() in JdbcDataContext:
> {quote}
> ...
> for (int i = 0; i < schemaNames.length && !found; i++) {
> String schemaName=schemaNames\[i];
> if(lastToken.{color:red}indexOf{color}(schemaName) != -1) {
> result = schemaName;
> found = true;
> }
> }
> ...
> {quote}
> the lastToken is {color:blue}'mydb2?user=root&password=xxxx'{color} and the schemaName
is {color:blue}'mydb'{color}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message