<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ivaneeo's blog

    自由的力量,自由的生活。

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks

    #

    用語句設置sqlserver的信息的語言:
    set language 'us_english'
    上面是把語言設置成美國英語.
    set language 'Simplified Chinese'
    上面是把語言設置成簡體中文.

    安裝了 SQL Server 提供的三十三種語言。下面是語言列表。


    用英語表示的名稱 NT LCID SQL Server 消息組 ID
    English 1033 1033
    German 1031 1031
    French 1036 1036
    Japanese 1041 1041
    Danish 1030 1030
    Spanish 3082 3082
    Italian 1040 1040
    Dutch 1043 1043
    Norwegian 2068 2068
    Portuguese 2070 2070
    Finnish 1035 1035
    Swedish 1053 1053
    Czech 1029 1029
    Hungarian 1038 1038
    Polish 1045 1045
    Romanian 1048 1048
    Croatian 1050 1050
    Slovak 1051 1051
    Slovene 1060 1060
    Greek 1032 1032
    Bulgarian 1026 1026
    Russian 1049 1049
    Turkish 1055 1055
    British English 2057 1033
    Estonian 1061 1061
    Latvian 1062 1062
    Lithuanian 1063 1063
    Brazilian 1046 1046
    Traditional Chinese 1028 1028
    Korean 1042 1042
    Simplified Chinese 2052 2052
    Arabic 1025 1025
    Thai 1054 1054
    posted @ 2005-08-04 14:54 ivaneeo 閱讀(294) | 評論 (0)編輯 收藏

    CREATE TABLE #test (f_int INT,f_varchar VARCHAR(255))
    上面創建了一張臨時表.

    臨時表
    SQL Server 支持臨時表。臨時表就是那些名稱以井號 (#) 開頭的表。如果當用戶斷開連接時沒有除去臨時表,SQL Server 將自動除去臨時表。臨時表不存儲在當前數據庫內,而是存儲在系統數據庫 tempdb 內。

    臨時表有兩種類型:

    本地臨時表
    以一個井號 (#) 開頭的那些表名。只有在創建本地臨時表的連接上才能看到這些表。

    全局臨時表
    以兩個井號 (##) 開頭的那些表名。在所有連接上都能看到全局臨時表。如果在創建全局臨時表的連接斷開前沒有顯式地除去這些表,那么只要所有其它任務停止引用它們,這些表即被除去。當創建全局臨時表的連接斷開后,新的任務不能再引用它們。當前的語句一執行完,任務與表之間的關聯即被除去;因此通常情況下,只要創建全局臨時表的連接斷開,全局臨時表即被除去。

    現在,臨時表的許多傳統用途可由具有 table 數據類型的變量替換。
    posted @ 2005-08-04 14:52 ivaneeo 閱讀(221) | 評論 (0)編輯 收藏

    Test 這是所有類型的測試類都必須實現的接口.在目前的框架中只有兩個這樣的類:TestCase和TestSuite.
      TestCase 這個類是大家在編寫自己的測試時要擴展(extend)的主要的類.它是最簡單的Test類型.TestCase的具體類(也就是擴展TestCase的類)包含實現各種測試的方法以及可選的setUp和tearDown方法.
      TestSuite 這是Test的另一個子類.其目的就是把各種Test(測試)集中在一起,這包括TestCase,其他的TestSuite以及這二者的任意組合.
      Assert 這是TestCase的超類,它提供在編寫測試時要用到的所有assert方法.
      TestFailure 這個類簡單封裝了測試運行過程中產生的錯誤(error)或失敗(failure).它記錄了失敗的Test(測試)以及引發錯誤或失敗的例外(exception)(對于失敗的情況,就是AssertionFailedError).
      TestResult 這個類收集測試運行的結果.除了報告失敗和錯誤以外,它還負責感興趣的各方通告測試的開始和結束.

    斷言
      當你在編寫測試方法的時候,將會大量使用從Assert繼承下來(通過TestCase)的各種功能.
      fail
        fail是最簡單的方法.
        void fail()
        void fail(String message)
        調用fail()會導致測試立刻失敗.
    posted @ 2005-08-04 14:51 ivaneeo 閱讀(201) | 評論 (0)編輯 收藏

    1.調用構造函數的例子
    /**
         * Invoke a constructor on a class using reflection.
         *
         * @param klass The class.
         * @param classes The classes in the parameter list.
         * @param objects The objects to be used as parameters.
         * @return The object constructed.
         */
        public static Object invokeConstructor(final Class klass, final Class[] classes, final Object[] objects) {
            try {
                Constructor constructor;
                try {
                    constructor = klass.getDeclaredConstructor(classes);
                }
                catch (NoSuchMethodException e) {
                    constructor = klass.getConstructor(classes);
                }
                constructor.setAccessible(true);
                return constructor.newInstance(objects);
            }
            catch (NoSuchMethodException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (InstantiationException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (IllegalAccessException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (InvocationTargetException e) {
                throw new RuntimeException(e.getTargetException().getMessage());
            }
        }

    2.調用域的例子
    /**
         * Get the value of an instance field on an object using reflection.
         *
         * @param instance The instance of the object.
         * @param fieldName The name of the field.
         * @return The object returned by getting the field.
         */
        public static Object invokeGetInstanceField(final Object instance, final String fieldName) {
            try {
                Field field;
                try {
                    field = instance.getClass().getField(fieldName);
                }
                catch (NoSuchFieldException e) {
                    field = instance.getClass().getDeclaredField(fieldName);
                }
                field.setAccessible(true);
                return field.get(instance);
            }
            catch (NoSuchFieldException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (IllegalAccessException e) {
                throw new RuntimeException(e.getMessage());
            }
        }

    3.調用類方法的例子
    /**
         * Invoke an instance method on an object using reflection.
         *
         * @param instance The instance of the object.
         * @param methodName The name of the method.
         * @param classes The classes in the parameter list.
         * @param objects The objects to be used as parameters.
         * @return The object returned by invoking the method.
         */
        public static Object invokeInstanceMethod(
                final Object instance, final String methodName, final Class[] classes, final Object[] objects) {

            try {
                Method method;
                try {
                    method = instance.getClass().getDeclaredMethod(methodName, classes);
                }
                catch (NoSuchMethodException e) {
                    method = instance.getClass().getMethod(methodName, classes);
                }
                method.setAccessible(true);
                return method.invoke(instance, objects);
            }
            catch (NoSuchMethodException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (IllegalAccessException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (InvocationTargetException e) {
                throw new RuntimeException(e.getTargetException().getMessage());
            }
        }

    4.調用靜態方法的例子
    /**
         * Invoke a static method on a class using reflection.
         *
         * @param klass The class.
         * @param methodName The name of the method.
         * @param classes The classes in the parameter list.
         * @param objects The objects to be used as parameters.
         * @return The object returned by invoking the method.
         */
        public static Object invokeStaticMethod(
                final Class klass, final String methodName, final Class[] classes, final Object[] objects) {

            try {
                Method method;
                try {
                    method = klass.getDeclaredMethod(methodName, classes);
                }
                catch (NoSuchMethodException e) {
                    method = klass.getMethod(methodName, classes);
                }
                method.setAccessible(true);
                return method.invoke(klass, objects);
            }
            catch (NoSuchMethodException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (IllegalAccessException e) {
                throw new RuntimeException(e.getMessage());
            }
            catch (InvocationTargetException e) {
                throw new RuntimeException(e.getTargetException().getMessage());
            }
        }
    posted @ 2005-08-04 14:47 ivaneeo 閱讀(407) | 評論 (0)編輯 收藏

    constructor = klass.getDeclaredConstructor(classes);
    上面的函數形式如下:
    Constructor getDeclaredConstructor(Class [] argumentTypes);
    得到公共或非公共的指定構造函數,其實參與argumentTypes中所列類型匹配.

    下面的也需要列出參數,這里的objects就是參數:
    return constructor.newInstance(objects);

    注意:其他也是如此.
    posted @ 2005-08-04 14:46 ivaneeo 閱讀(322) | 評論 (0)編輯 收藏

    對反射API的訪問由安全管理器所控制.Field,Method和Constructor類都是由一個名為AccessibleObject的基類擴展的.AccessibleObject類有一個主要的方法,名為setAccessible(),由此可以在訪問特定的類成員時解除平常所設定的安全性.Javadoc說明如下:
    setAccessible

    public void setAccessible(boolean flag)
                       throws SecurityException

        Set the accessible flag for this object to the indicated boolean value. A value of true indicates that the reflected object should suppress Java language access checking when it is used. A value of false indicates that the reflected object should enforce Java language access checks.

        First, if there is a security manager, its checkPermission method is called with a ReflectPermission("suppressAccessChecks") permission.

        A SecurityException is raised if flag is true but accessibility of this object may not be changed (for example, if this element object is a Constructor object for the class Class).

        A SecurityException is raised if this object is a Constructor object for the class java.lang.Class, and flag is true.

        Parameters:
            flag - the new value for the accessible flag
        Throws:
            SecurityException - if the request is denied.
        See Also:
            SecurityManager.checkPermission(java.security.Permission), RuntimePermission

    Class類提供了兩組方法來得到每一種特性.其中一組允許訪問類的公共特性(其中包括由其超類所繼承得到的成員),而另一組則允許訪問在類中直接聲明的任何公共或非公共成員(而不包括繼承得來的成員),這要取決于有何安全性考慮.以下是一些例子:
    .getFields()將返回一個Field對象數組,它表示一個類的所有公共變量,其中包括繼承得到的公共變量.
    .getDeclareFields()將返回一個數組,以表示類中聲明的所有變量,而不論其訪問修飾符如何(不包括安全管理器不允許看到的變量),但是不包括繼承得到的變量.
    .對于構造函數,"所有構造函數"和"所聲明構造函數"之間無所謂差別(類不會繼承構造函數),因此getConstructors()和getDeclaredConstructors()的唯一區別在于,前者返回的是公共構造函數,而后者則返回類的所有構造函數.
    posted @ 2005-08-04 14:45 ivaneeo 閱讀(348) | 評論 (0)編輯 收藏

    package net.sourceforge.jtds.jdbc;

    import java.text.MessageFormat;
    import java.util.Enumeration;
    import java.util.Map;
    import java.util.ResourceBundle;

    public final class Messages {
      private static final String DEFAULT_RESOURCE = "net.sourceforge.jtds.jdbc.Messages";  //默認得資源
      private static ResourceBundle defaultResource;  //和locale的綁定

      private Messages() {
        }

        public static String get(String key) {
            return get(key, null);
        }

        public static String get(String key, Object param1) {
            Object args[] = {param1};
            return get(key, args);
        }

        static String get(String key, Object param1, Object param2) {
            Object args[] = {param1, param2};
            return get(key, args);
        }

        private static String get(String key, Object[] arguments) {
          try {
                ResourceBundle bundle = loadResourceBundle();
                String formatString = bundle.getString(key);
                // No need for any formatting if no parameters are specified
                if (arguments == null || arguments.length == 0) {
                    return formatString;
                } else {
                    MessageFormat formatter = new MessageFormat(formatString);
                    return formatter.format(arguments);
                }
            } catch (java.util.MissingResourceException mre) {
                throw new RuntimeException("No message resource found for message property " + key);
            }
        }

        private static ResourceBundle loadResourceBundle() {
            if (defaultResource == null) {
                defaultResource = ResourceBundle.getBundle(DEFAULT_RESOURCE);
            }
            return defaultResource;
        }

        static void loadDriverProperties(Map propertyMap, Map descriptionMap) {
            final ResourceBundle bundle = loadResourceBundle();
            final Enumeration keys = bundle.getKeys();
            while (keys.hasMoreElements()) {
                final String key = (String) keys.nextElement();
                final String descriptionPrefix = "prop.desc.";
                final String propertyPrefix = "prop.";
                if (key.startsWith(descriptionPrefix)) {
                    descriptionMap.put(key.substring(descriptionPrefix.length()), bundle.getString(key));
                }
                else if (key.startsWith(propertyPrefix)) {
                    propertyMap.put(key.substring(propertyPrefix.length()), bundle.getString(key));
                }
            }
        }
    }

    上面代碼中默認得綁定名為:"net.sourceforge.jtds.jdbc.Messages".其實就是以工程為根目錄,尋找文件Messages.properties.這里查找的方式和類是一樣的.比如:"net.sourceforge.jtds.jdbc.Messages",就是工程根目錄下的net/sourceforge/jtds/jdbc/下的Messages.properties文件.
    這個文件定義很多的屬性,要得到只要用get方法.

      注意這里的defaultResource = ResourceBundle.getBundle(DEFAULT_RESOURCE);沒有設定Locale值,所以文件名為Messages.properties.如果設置了Locale值的話,例如:defaultResource = ResourceBundle.getBundle(DEFAULT_RESOURCE, Locale.ENGLISH);那么它就會去查找文件Messages_en.properties.其他類似加后綴(Locale.CHINA是Messages_zh.properties).

      關于java.text.MessageFormat類,下面通過一個例子就可以說明:
        MessageFormat mf = new MessageFormat("You have {0} messages.");
        Object[] arguments = {"no"};
        System.out.println(mf.format(arguments));  //"You have no messages."

      關于String.startsWith(String prex)是測試字符串是否以prex開頭.
    posted @ 2005-08-04 14:43 ivaneeo 閱讀(411) | 評論 (0)編輯 收藏

    private static int nextToken(String url, int pos, StringBuffer token) {
            token.setLength(0);

            while (pos < url.length()) {
                char ch = url.charAt(pos++);

                if (ch == ':' || ch == ';') {
                    break;
                }

                if (ch == '/') {
                    if (pos < url.length() && url.charAt(pos) == '/') {
                        pos++;
                    }

                    break;
                }

                token.append(ch);
            }

            return pos;
        }

    上面代碼中token.setLength(0);的作用是每次都把字符串緩沖區清空,也就是重置的作用.
    上面代碼作用是每次得到指定的一段.例如"jdbc:jtds:sqlserver://hostname/dbname"
    token為jdbc,jtds,sqlserver,hostname,dbname
    posted @ 2005-08-04 14:38 ivaneeo 閱讀(466) | 評論 (0)編輯 收藏

    "a".equalsIgnoreCase(token.toString())

    public boolean equalsIgnoreCase(String anotherString)
    函數是忽略大小寫的比較兩個字符串.
    posted @ 2005-08-04 14:35 ivaneeo 閱讀(234) | 評論 (0)編輯 收藏

    僅列出標題
    共67頁: First 上一頁 59 60 61 62 63 64 65 66 67 
    主站蜘蛛池模板: 最近2019中文字幕免费看最新| 爽爽爽爽爽爽爽成人免费观看| 亚洲中文字幕无码久久2020| 亚洲毛片在线免费观看| 亚洲理论片在线中文字幕| 亚洲高清视频在线播放| 99ri精品国产亚洲| 亚洲成人午夜电影| 亚洲天堂免费在线| 亚洲av无码一区二区三区天堂 | 日本大片在线看黄a∨免费| 免费观看的毛片手机视频| 日本高清免费不卡视频| 免费大香伊蕉在人线国产| 亚洲国产精品无码久久青草 | 99久久综合国产精品免费| 久久久久久99av无码免费网站| 成人最新午夜免费视频| 国产婷婷高清在线观看免费| 亚洲福利精品一区二区三区| 久久亚洲欧洲国产综合| 久久久久亚洲精品影视| 亚洲高清视频免费| 亚洲欧洲av综合色无码| 日韩精品视频在线观看免费| 大地资源网高清在线观看免费| 日日麻批免费40分钟无码| 国产大片线上免费观看| 五月婷婷亚洲综合| 亚洲AV无码成人精品区在线观看 | 久久精品国产亚洲av麻豆蜜芽| 亚洲精品自偷自拍无码| 一级做a爰黑人又硬又粗免费看51社区国产精品视 | 亚洲乱码中文字幕久久孕妇黑人| 婷婷亚洲综合五月天小说| 久久亚洲国产成人影院| 少妇亚洲免费精品| 最近免费中文字幕mv在线电影| 性感美女视频免费网站午夜| 亚洲日本va午夜中文字幕久久| 亚洲永久永久永久永久永久精品|