Difference between revisions of "Python MySQL API"

From ISFDB
Jump to navigation Jump to search
(→‎Common: cleanup)
(→‎Authors: Added details)
Line 29: Line 29:
  
 
==Authors==
 
==Authors==
* SQLgetAuthorData(author):
+
 
* SQLloadAuthorData(author_id):
+
* '''SQLauthorIsPseudo'''(au_id)  - Returns whether the author is present as a pseudonym in the pseudonym table. Returns 1 if pseudonym, otherwise 0.
* SQLauthorIsPseudo(au_id):
+
** '''au_id''' - the author ID.
* SQLauthorHasPseudo(au_id):
+
* '''SQLauthorHasPseudo'''(au_id) - Returns whether the author is present as a parent author in the pseudonym table. Returns 1 if a pseudonym exists, otherwise 0.
* SQLgetActualFromPseudo(au_id):
+
** '''au_id''' - the author ID.
* SQLgetPseudoFromActual(au_id):
+
* '''SQLbornToday'''() - Returns an array of author records of authors born on today's date (local time).
* SQLupdateViews(author_id):
+
* '''SQLdiedToday'''() - Returns an array of author records of authors who died on today's date (local time).
* SQLloadEmails(author_id):
+
* '''SQLFindAuthors'''(target) - Returns an array of author records of authors whose canonical names contain the target substring.
* SQLloadWebpages(author_id):
+
** '''target''' - the target substring.
* SQLbornToday():
+
* '''SQLgetActualFromPseudo'''(au_id) - Returns the canonical name of the actual author associated with a pseudonym.
* SQLdiedToday():
+
** '''au_id''' - author ID of the pseudonym.
* SQLgetAuthorVariants(author_id):
+
* '''SQLgetAuthorData'''(author) - Returns the author record that matches the given author name.
* SQLGetInterviews(author_id):
+
** '''author''' - the author's canonical name.
* SQLFindAuthors(target):
+
* '''SQLGetInterviews'''(author_id) - Returns an array of interview records where the author was the interviewee.
 +
** '''author_id''' - author ID of the interviewee.
 +
* '''SQLgetPseudoFromActual'''(au_id) - Returns an array of all pseudonym names used by a particular author.
 +
** '''au_id''' - author ID of the actual author.
 +
* '''SQLloadAuthorData'''(author_id) - Returns the author record that matches the given author ID. Similar to '''SQLgetAuthorData'''() except this takes an ID instead of a name.
 +
** '''author_id''' - author ID
 +
* '''SQLloadEmails'''(author_id) - Returns an array of all email addresses associated with the author.
 +
** '''author_id''' - author ID
 +
* '''SQLloadWebpages'''(author_id) - Returns an array of all web pages associated with the author.
 +
** '''author_id''' - author ID
 +
* '''SQLupdateViews'''(author_id) - Increments the authors view counter.
 +
** '''author_id''' - author ID
  
 
==Titles==
 
==Titles==

Revision as of 06:57, 3 June 2008

Common

  • SQLgetDatabaseStatus() - This function can be called to obtain the current status of the database. 0=offline, 1=online. The value is changed through the moderator cpanel.
  • SQLgetEditingStatus() - This function can be called to obtain the current editing status. 0=offline, 1=public editing, 2=moderator-only editing. The value is changed through the moderator cpanel.
  • SQLgetNotes(note_id) - This function returns text from the notes table.
    • note_id - the record number of the note.
  • SQLgetSchemaVersion() - Returns the current schema version. There is no standard for defining schema versions as yet, so this may be deprecated in the future.
  • SQLgetSubmitterID(submitter) - Converts a user name to a user_id.
    • submitter - The user's name.
  • SQLgetSubmitterName(submitter) - This appears to be a variant duplicate of SQLgetUserName(). This needs to be cleaned up.
    • submitter - the user ID of the user.
  • SQLgetUserName(userId) - This function returns a plain text user name.
    • userId - the user ID of the user.
  • SQLisUserModerator(userId) - This function returns 1 if the user is a moderator, otherwise it returns 0.
    • userId - the user ID of the user.
  • SQLloadXML(recno) - This function loads the XML payload associated with a data submission.
    • recno - record number of the submission.
  • SQLloadState(recno) - This function loads the state of a data submission (N=new, I=integrated, R=rejected).
    • recno - record number of the submission.
  • SQLmarkIntegrated(db, recno, reviewerid) - This function marks a submission record as approved. This probably doesn't need db as an argument.
    • db - database handle
    • recno - the submission number being approved.
    • reviewerid - the user ID of the approver.
  • SQLUpdateQueries() - This function is executed whenever SQLparsing.py is imported. It's not intended for application use.
  • SQLwikiLinkExists(namespace, title) - Returns 1 if the wiki page exists in the wiki area of the database, otherwise returns 0.
    • namespace - namespace of the wiki page. Although wiki pages are not required to use a namespace, all pages that the ISFDB might link to do.
    • title - title of the wiki article.
  • todaysDate() - This should probably be moved elsewhere, as it has nothing to do with the MySQL interface.

Authors

  • SQLauthorIsPseudo(au_id) - Returns whether the author is present as a pseudonym in the pseudonym table. Returns 1 if pseudonym, otherwise 0.
    • au_id - the author ID.
  • SQLauthorHasPseudo(au_id) - Returns whether the author is present as a parent author in the pseudonym table. Returns 1 if a pseudonym exists, otherwise 0.
    • au_id - the author ID.
  • SQLbornToday() - Returns an array of author records of authors born on today's date (local time).
  • SQLdiedToday() - Returns an array of author records of authors who died on today's date (local time).
  • SQLFindAuthors(target) - Returns an array of author records of authors whose canonical names contain the target substring.
    • target - the target substring.
  • SQLgetActualFromPseudo(au_id) - Returns the canonical name of the actual author associated with a pseudonym.
    • au_id - author ID of the pseudonym.
  • SQLgetAuthorData(author) - Returns the author record that matches the given author name.
    • author - the author's canonical name.
  • SQLGetInterviews(author_id) - Returns an array of interview records where the author was the interviewee.
    • author_id - author ID of the interviewee.
  • SQLgetPseudoFromActual(au_id) - Returns an array of all pseudonym names used by a particular author.
    • au_id - author ID of the actual author.
  • SQLloadAuthorData(author_id) - Returns the author record that matches the given author ID. Similar to SQLgetAuthorData() except this takes an ID instead of a name.
    • author_id - author ID
  • SQLloadEmails(author_id) - Returns an array of all email addresses associated with the author.
    • author_id - author ID
  • SQLloadWebpages(author_id) - Returns an array of all web pages associated with the author.
    • author_id - author ID
  • SQLupdateViews(author_id) - Increments the authors view counter.
    • author_id - author ID

Titles

  • SQLupdateTitleViews(title_id):
  • SQLloadTitlesXBA(aurec, alpha, views, chron):
  • SQLserialTitlesXBA(aurec, alpha, views):
  • SQLloadLongTitlesXBA(aurec, alpha, views):
  • SQLloadAnyTitles(aurec):
  • SQLloadShortTitlesXBA(aurec, alpha, views):
  • SQLloadTitlesXBT(recno):
  • SQLloadIntervieweeXBA(author):
  • SQLloadTitle(titlerec):
  • SQLFindTitles(target):
  • SQLCollaborators(author_id):
  • SQLTitleCollaborators(title_id, author_id):
  • SQLTitleAuthors(title_id):
  • SQLInterviewAuthors(title_id):
  • SQLReviewAuthors(title_id):
  • SQLFindYear(target):
  • SQLgetTitle(titleId):
  • SQLgetTitleVariants(title_id):
  • SQLgetSerialsByTitle(title):
  • SQLFindReviewParent(title, author):
  • SQLloadTitleReviews(title_id):
  • SQLfindReviewedTitle(review_id):

Series

  • SQLgetShortSeriesData(authorec):
  • SQLgetEssaySeriesData(authorec):
  • SQLget1Series(seriesrec):
  • SQLgetNCSeriesData(authorec):
  • SQLgetASeriesData(authorec):
  • SQLgetESeriesData(authorec):
  • SQLgetNFSeriesData(authorec):
  • SQLFindSeries(target):
  • SQLFindSeriesChildren(id):
  • SQLgetSeriesName(id):
  • SQLFindSeriesId(target):
  • SQLFindSeriesName(target):
  • SQLFindSeries2(target):
  • SQLloadTitlesXBS(series):

Awards

  • SQLloadTitleFromAward(award_id):
  • SQLloadAwardsXBA(author):
  • SQLloadAwardsXBY(year):
  • SQLTitleAwards(title_id):
  • SQLloadAwards(award_id):

Publications

  • SQLGetForthcoming(month, year, day, all):
  • SQLGetTodaysPubs(month, year, day, limit):
  • SQLGetPubByTag(tag):
  • SQLGetPubById(tag):
  • SQLGetPubsByTitle(titlerec):
  • SQLGetPubsByPublisherYear(publisher_id, year):
  • SQLGetPubsByAuthor(aurec):
  • SQLGetPubsByPublisherYear(publisher_id, year):
  • SQLGetPubContentByAuthor(aurec):
  • SQLFindPubsByIsbn(target):
  • SQLPubAuthors(pub_id):
  • SQLMarqueAuthors(pub_id):
  • SQLgetTitleReferral(pub_id):
  • SQLgetPubTitle(pubId):
  • SQLGetPubContentList(pub_id):
  • SQLRefList():
  • SQLVerificationList(pub_id):

Publishers

  • SQLGetPublisher(pubrec):
  • SQLFindPublisher(target):
  • SQLGetPublisherYears(publisher_id):
  • SQLgetPublisherName(id):
  • SQLloadPublisherWebpages(publisher_id):

User Tags

  • SQLgetAuthorTags(author_id):
  • SQLgetTitleTags(title_id):
  • SQLgetUserTags(title_id, user_id):
  • SQLGetTagById(tag_id):
  • SQLgetPopularTags():
  • SQLsearchTags(tag):