package cn.myapps.runtime.rest.user.dao;

import java.sql.Connection;
import java.sql.SQLException;

public class MssqlUserDAO extends AbstractUserDAO implements UserDAO {

	public MssqlUserDAO(Connection conn) throws Exception {
		super();
		if (conn != null) {
			try {
				this.schema = conn.getMetaData().getURL().trim().toUpperCase();
				if (this.schema.indexOf("?USE") > 0) {
					this.schema = this.schema.substring(this.schema
							.lastIndexOf("/") + 1, this.schema.indexOf("?USE"));
				} else {
					this.schema = this.schema.substring(this.schema
							.lastIndexOf("/") + 1);
				}
			} catch (SQLException sqle) {
				sqle.printStackTrace();
			}
		}
	}

}
