DatabaseVerificaitonErrors.kt revision ba069d50913c3fb250bb60ec310439db36895337
188865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar/*
288865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * Copyright (C) 2017 The Android Open Source Project
388865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar *
488865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * Licensed under the Apache License, Version 2.0 (the "License");
588865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * you may not use this file except in compliance with the License.
688865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * You may obtain a copy of the License at
788865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar *
888865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar *      http://www.apache.org/licenses/LICENSE-2.0
988865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar *
1088865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * Unless required by applicable law or agreed to in writing, software
1188865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * distributed under the License is distributed on an "AS IS" BASIS,
1288865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1388865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * See the License for the specific language governing permissions and
1488865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar * limitations under the License.
1588865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar */
1688865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar
17ba069d50913c3fb250bb60ec310439db36895337Alan Viverettepackage androidx.room.verifier
1888865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar
1988865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyarimport java.sql.SQLException
2088865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar
2188865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyarobject DatabaseVerificaitonErrors {
226f1f5567abe765d30fda9c8fedce5617ecdeda9cAurimas Liutikas    private val CANNOT_CREATE_TABLE: String = "Create table statement had an error: %s"
236f1f5567abe765d30fda9c8fedce5617ecdeda9cAurimas Liutikas    fun cannotCreateTable(exception: SQLException): String {
2488865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar        return CANNOT_CREATE_TABLE.format(exception.message)
2588865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar    }
2688865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar
276f1f5567abe765d30fda9c8fedce5617ecdeda9cAurimas Liutikas    private val CANNOT_VERIFY_QUERY: String = "There is a problem with the query: %s"
286f1f5567abe765d30fda9c8fedce5617ecdeda9cAurimas Liutikas    fun cannotVerifyQuery(exception: SQLException): String {
2988865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar        return CANNOT_VERIFY_QUERY.format(exception.message)
3088865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar    }
3188865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar
326f1f5567abe765d30fda9c8fedce5617ecdeda9cAurimas Liutikas    private val CANNOT_CREATE_SQLITE_CONNECTION: String = "Room cannot create an SQLite" +
3388865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar            " connection to verify the queries. Query verification will be disabled. Error: %s"
346f1f5567abe765d30fda9c8fedce5617ecdeda9cAurimas Liutikas    fun cannotCreateConnection(exception: Exception): String {
3588865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar        return CANNOT_CREATE_SQLITE_CONNECTION.format(exception.message)
3688865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar    }
3788865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar
3888865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar    val CANNOT_GET_TMP_JAVA_DIR = "Cannot read tmp java dir which is necessary to load sqlite" +
3988865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar            " lib. Database SQL verification will be disabled"
4088865f77c35657a2bc545a718ca16a648fc8b62eYigit Boyar}
41