BaseColumns类的作用

来源:互联网 发布:淘宝美工面试 编辑:程序博客网 时间:2024/05/17 05:50

这个类只是提供了两个字段,一个是"_id"一个是"_count",便于调用数据库时导致拼写错误,你也可以扩展它,或者自定义这么个,然后直接调用它的常量名,防止写sql语句时把列名拼错

/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package android.provider;public interface BaseColumns{    /**     * The unique ID for a row.     * <P>Type: INTEGER (long)</P>     */    public static final String _ID = "_id";    /**     * The count of rows in a directory.     * <P>Type: INTEGER</P>     */    public static final String _COUNT = "_count";}


0 0
原创粉丝点击