//////////////////////////////////////////////////////////// private void OpenDB() { m_SqlReader = null; if (File.Exists(m_StrPath)) { m_FirstOpen = false; } else { m_FirstOpen = true; } try { m_SqlInstance = new SqliteConnection("URI=file:" + m_StrPath); //m_SqlInstance = new SqliteConnection(m_StrPath); //Debug.LogError("URI=file:" + m_StrPath); m_SqlInstance.Open(); } catch (Exception e) { m_SqlInstance = null; LogHelp.LogFile(e.ToString()); } }
public int ExecuteNoneQuery(string sqlLan) { if (null == m_SqlInstance || string.IsNullOrEmpty(sqlLan)) { return(0); } try { SqliteCommand mycommand = new SqliteCommand(m_SqlInstance) { CommandText = sqlLan }; int result = mycommand.ExecuteNonQuery(); mycommand.Dispose(); mycommand = null; return(result); } catch (Exception e) { Debug.LogError(e.ToString()); LogHelp.LogFile(e.ToString()); return(0); } }
public SqliteDataReader ExecuteQuery(string strQuery) { if (null == m_SqlInstance || string.IsNullOrEmpty(strQuery)) { return(null); } ClearReader(); try { SqliteCommand tempSqlCommand = m_SqlInstance.CreateCommand(); tempSqlCommand.CommandText = strQuery; m_SqlReader = tempSqlCommand.ExecuteReader(); tempSqlCommand.Dispose(); tempSqlCommand = null; return(m_SqlReader); } catch (Exception e) { LogHelp.LogFile(e.ToString()); return(null); } }
public void EndTransaction() { if (null != m_SqlTransaction) { try { m_SqlTransaction.Commit(); m_SqlTransaction.Dispose(); m_SqlTransaction = null; } catch (Exception e) { LogHelp.LogFile(e.ToString()); } } }
/// <summary> /// 移动流媒体资源 /// </summary> /// <returns></returns> private IEnumerator MoveStreamingAssets() { if (m_LocalRVLDic == null) { yield return(StartCoroutine(ParserLocalRVL())); } ///>获取流媒体文件夹内的资源列表 string path = m_StreamResRootPath + "/" + RVL; WWW streamWWW = new WWW(ComTool.FormatTickUrl(path)); yield return(streamWWW); if (streamWWW.error == null) { m_ServerRVLDic = ParserResVersionList(streamWWW.text, ref m_ServerVersion); if (CompareVersion(m_LocalVersion, m_ServerVersion)) { MoveResFinished(); } else { string localVersionPath = m_LocalResRootPath + "/" + RVL;//local资源版本列表配置 if (File.Exists(localVersionPath)) { MoveResFinished(); } else { try { FileInfo t = new FileInfo(localVersionPath); if (!t.Exists) { Directory.CreateDirectory(t.DirectoryName); } Debug.LogError("write resversion:" + localVersionPath); File.WriteAllBytes(localVersionPath, streamWWW.bytes); //xml.Save 在实际真机环境中,如果不存在文件,将会报IO错误 /* * XmlDocument xml = new XmlDocument(); * xml.LoadXml(streamWWW.text); * xml.Save(localVersionPath); * */ MoveResFinished(); }catch (Exception e) { LogHelp.LogFile(e.ToString()); } } #region /* * yield return StartCoroutine(CompareWithRVL()); * ///>是否需要移动资源 * if (m_UpdateResList != null && m_UpdateResList.Count > 0) * { * m_IsMovingRes = true; * StartCoroutine(UpdateNewRes(m_UpdateResList)); * } * else * { * MoveResFinished(); * } * */ #endregion } streamWWW.Dispose(); } else { MoveResFinished(); } }