Python MySQL API
Jump to navigation
Jump to search
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.
- 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
- SQLCollaborators(author_id) - Returns an array of title records that the author contributed to, but were cowritten by another author.
- author_id - the author ID.
- SQLfindReviewedTitle(review_id) - Returns the title ID of the title referred to be a review.
- review_id - record ID of the review.
- SQLFindReviewParent(title, author) - Given a title name and author name, returns the first title record with a matching title and author that is not a review.
- title - the target title name.
- author - the target author name.
- SQLFindTitles(target) - Returns an array of title records whose titles contain the given substring. Results are ordered alphabetically.
- target - the title substring.
- SQLFindYear(target) - Returns an array of title records whose year component of the copyright date matches the target year.
- target - the target year. Must be an integer.
- SQLgetAuthorVariants(author_id) - Returns an array of title records that are written by the author and are variants of another title.
- author_id - the author ID.
- SQLgetTitle(titleId) - Returns the title string associated with the title record.
- titleId - the title record.
- SQLgetTitleVariants(title_id) - Returns an array of title records that are variants of the given parent.
- title_id - the title record of the parent.
- SQLgetSerialsByTitle(title) - Returns an array of title records where the title types are SERIAL, and the titles contain the given substring, and the titles are not variants.
- title - the title substring.
- SQLInterviewAuthors(title_id) - Returns the canonical name of the author who conducted an interview.
- title_id - the title record of the interview.
- SQLloadAnyTitles(aurec) - Returns an array of title records that have any association with the author.
- aurec - author ID.
- SQLloadIntervieweeXBA(author) - Returns an array of title records that are interviews and the interviewee was the given author.
- author - the canonical author name.
- SQLloadTitleReviews(title_id) - Returns an array of review records that reviewed the given title.
- title_id - the ID of the reviewed title.
- SQLloadLongTitlesXBA(aurec, alpha, views) - Returns an array of title records, belonging to a particular author, of type NOVEL, COLLECTION, ANTHOLOGY, OMNIBUS, EDITOR, NONFICTION, NONGENRE, INTERIORART, COVERART, or BACKCOVERART.
- aurec - the author ID.
- alpha - If nonzero, the titles will be sorted in alphabetical order.
- views - If nonzero, the titles will be sorted in order of which titles have been viewed most often.
- SQLloadShortTitlesXBA(aurec, alpha, views) - Returns an array of title records, belonging to a particular author, of type SHORTFICTION, POEM, ESSAY, REVIEW, or INTERVIEW.
- aurec - the author ID.
- alpha - If nonzero, the titles will be sorted in alphabetical order.
- views - If nonzero, the titles will be sorted in order of which titles have been viewed most often.
- SQLloadTitle(titlerec) - Returns the title record associated with the title ID.
- titlerec - the title ID.
- SQLloadTitlesXBA(aurec, alpha, views, chron) - Returns an array of title records, belonging to a particular author, that are not variants, and were written by the author.
- aurec - the author ID.
- alpha - If nonzero, the titles will be sorted in alphabetical order.
- views - If nonzero, the titles will be sorted in order of which titles have been viewed most often.
- chron - If nonzero, the titles will be sorted in chronological order.
- SQLloadTitlesXBT(recno) - Returns an array of titles contained within a particular publication.
- recno - the publication ID.
- SQLReviewAuthors(title_id) - Returns the canonical names of the reviewers who wrote a review.
- title_id - title ID of the review.
- SQLserialTitlesXBA(aurec, alpha, views) - Returns an array of title records written by a particular author, where the title types are SERIAL, and the titles are not variants.
- aurec - the author ID.
- alpha - If nonzero, the titles will be sorted in alphabetical order.
- views - If nonzero, the titles will be sorted in order of which titles have been viewed most often.
- SQLTitleCollaborators(title_id, author_id) - Returns an array of canonical author names who cowrote a particular title, excluding the given author ID.
- title_id - the title ID.
- 'author_id - the excluded author ID.
- SQLTitleAuthors(title_id) - Returns an array of canonical author names who wrote a particular title.
- title_id - the title ID.
- SQLupdateTitleViews(title_id) - Increments the view counter in the title. Returns the current view count to the caller.
- title_id - the title ID.
Series
- SQLFindSeries2(target) - returns an array of series tuples (title, id, series number, year, authors) that are present within the target series name. These are sorted by series number and copyright date.
- target - the series name.
- SQLFindSeriesChildren(id) - returns an array of series id's that are children of the given parent id.
- id - the parent id.
- SQLFindSeriesId(target) - returns the series id associated with the given series name.
- target - the series name.
- SQLFindSeriesName(target) - returns the series name associated with the given series id.
- target - the series id.
- SQLFindSeries(target) - returns an array of series records that use the target substring in the series name.
- target - the series substring.
- SQLget1Series(seriesrec) - Returns the series record with a matching series id.
- seriesrec - the series id.
- SQLgetASeriesData(authorec) - Returns an array of series records associated with any anthologies written by the given author.
- authorrec - the author record id.
- SQLgetESeriesData(authorec) - Returns an array of series records associated with any editor records written by the given author.
- authorrec - the author record id.
- SQLgetEssaySeriesData(authorec) - Returns an array of series records associated with any essays written by the given author.
- authorrec - the author record id.
- SQLgetNCSeriesData(authorec) - Returns an array of series records associated with any novel, collection, or omnibus written by the given author.
- authorrec - the author record id.
- SQLgetNFSeriesData(authorec) - Returns an array of series records associated with any nonfiction written by the given author.
- authorrec - the author record id.
- SQLgetSeriesName(id) - appears to be a duplicate of SQLFindSeriesName().
- SQLgetShortSeriesData(authorec) - Returns an array of series records associated with any short fiction written by the given author.
- authorrec - the author record id.
- SQLloadTitlesXBS(series) - Returns an array of titlerecords associated with the given series name.
- series - the series name.
Awards
- SQLloadAwards(award_id) - returns the award record associated with the record number.
- award_id - the award record number.
- SQLloadAwardsXBA(author) - returns an array of award record whose award_author fields contain the author substring.
- author - the author substring.
- SQLloadAwardsXBY(year) - returns an array of award record whose award_year fields match the target year.
- year - the target year.
- SQLloadTitleFromAward(award_id) - returns the title record referred to by the award.
- award_id - the award record number.
- SQLTitleAwards(title_id) - returns an array of title_award mappings whose title_id field matches the target title.
- title_id - the title record number.
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):