void PHPEntityClass::Store(wxSQLite3Database& db) { try { wxSQLite3Statement statement = db.PrepareStatement("REPLACE INTO SCOPE_TABLE (ID, SCOPE_TYPE, SCOPE_ID, NAME, FULLNAME, EXTENDS, " "IMPLEMENTS, USING_TRAITS, FLAGS, DOC_COMMENT, " "LINE_NUMBER, FILE_NAME) VALUES (NULL, 1, :SCOPE_ID, :NAME, :FULLNAME, :EXTENDS, " ":IMPLEMENTS, :USING_TRAITS, :FLAGS, :DOC_COMMENT, :LINE_NUMBER, :FILE_NAME)"); statement.Bind(statement.GetParamIndex(":SCOPE_ID"), Parent()->GetDbId()); statement.Bind(statement.GetParamIndex(":NAME"), GetShortName()); statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName()); statement.Bind(statement.GetParamIndex(":EXTENDS"), GetExtends()); statement.Bind(statement.GetParamIndex(":IMPLEMENTS"), GetImplementsAsString()); statement.Bind(statement.GetParamIndex(":USING_TRAITS"), GetTraitsAsString()); statement.Bind(statement.GetParamIndex(":FLAGS"), (int) GetFlags()); statement.Bind(statement.GetParamIndex(":DOC_COMMENT"), GetDocComment()); statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine()); statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath()); statement.ExecuteUpdate(); SetDbId(db.GetLastRowId()); } catch(wxSQLite3Exception& exc) { wxUnusedVar(exc); } }
void PHPEntityVariable::Store(wxSQLite3Database& db) { // we keep only the function arguments in the databse and globals if(IsFunctionArg() || IsMember()) { try { wxSQLite3Statement statement = db.PrepareStatement("INSERT OR REPLACE INTO VARIABLES_TABLE VALUES (NULL, " ":SCOPE_ID, :FUNCTION_ID, :NAME, :FULLNAME, :SCOPE, :TYPEHINT, " ":FLAGS, :DOC_COMMENT, :LINE_NUMBER, :FILE_NAME)"); statement.Bind(statement.GetParamIndex(":SCOPE_ID"), IsMember() ? Parent()->GetDbId() : wxLongLong(-1)); statement.Bind(statement.GetParamIndex(":FUNCTION_ID"), IsFunctionArg() ? Parent()->GetDbId() : wxLongLong(-1)); statement.Bind(statement.GetParamIndex(":NAME"), GetShortName()); statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName()); statement.Bind(statement.GetParamIndex(":SCOPE"), GetScope()); statement.Bind(statement.GetParamIndex(":TYPEHINT"), GetTypeHint()); statement.Bind(statement.GetParamIndex(":FLAGS"), (int)GetFlags()); statement.Bind(statement.GetParamIndex(":DOC_COMMENT"), GetDocComment()); statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine()); statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath()); statement.ExecuteUpdate(); SetDbId(db.GetLastRowId()); } catch(wxSQLite3Exception& exc) { wxUnusedVar(exc); } } }
void PHPEntityFunctionAlias::Store(wxSQLite3Database& db) { try { wxSQLite3Statement statement = db.PrepareStatement( "INSERT OR REPLACE INTO FUNCTION_ALIAS_TABLE VALUES(NULL, :SCOPE_ID, :NAME, :REALNAME, :FULLNAME, :SCOPE, " ":LINE_NUMBER, :FILE_NAME)"); statement.Bind(statement.GetParamIndex(":SCOPE_ID"), Parent()->GetDbId()); statement.Bind(statement.GetParamIndex(":NAME"), GetShortName()); statement.Bind(statement.GetParamIndex(":REALNAME"), GetRealname()); statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName()); statement.Bind(statement.GetParamIndex(":SCOPE"), GetScope()); statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine()); statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath()); statement.ExecuteUpdate(); SetDbId(db.GetLastRowId()); } catch(wxSQLite3Exception& exc) { CL_WARNING("PHPEntityFunctionAlias::Store: %s", exc.GetMessage()); } }
void PHPEntityNamespace::Store(wxSQLite3Database& db) { try { // A namespace, unlike other PHP entities, can be defined in various files // and in multiple locations. This means, that by definition, there can be multiple entries // for the same namespace, however, since our relations in the database is ID based, // we try to locate the namespace in the DB before we attempt to insert it { wxSQLite3Statement statement = db.PrepareStatement("SELECT * FROM SCOPE_TABLE WHERE FULLNAME=:FULLNAME LIMIT 1"); statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName()); wxSQLite3ResultSet res = statement.ExecuteQuery(); if(res.NextRow()) { // we have a match, update this item database ID to match // what we have found in the database PHPEntityNamespace ns; ns.FromResultSet(res); SetDbId(ns.GetDbId()); return; } } // Get the 'parent' namespace part wxString parentPath = GetFullName().BeforeLast('\\'); DoEnsureNamespacePathExists(db, parentPath); { wxSQLite3Statement statement = db.PrepareStatement( "INSERT INTO SCOPE_TABLE (ID, SCOPE_TYPE, SCOPE_ID, NAME, FULLNAME, LINE_NUMBER, FILE_NAME) " "VALUES (NULL, 0, -1, :NAME, :FULLNAME, :LINE_NUMBER, :FILE_NAME)"); statement.Bind(statement.GetParamIndex(":NAME"), GetShortName()); statement.Bind(statement.GetParamIndex(":FULLNAME"), GetFullName()); statement.Bind(statement.GetParamIndex(":LINE_NUMBER"), GetLine()); statement.Bind(statement.GetParamIndex(":FILE_NAME"), GetFilename().GetFullPath()); statement.ExecuteUpdate(); SetDbId(db.GetLastRowId()); } } catch(wxSQLite3Exception& exc) { wxUnusedVar(exc); } }