Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

This project is at an alpha stage.

Things will break, and APIs might change. Be cautious using this in production. Additionally, not all methods have been tested for accuracy.

Introduction

zmanim.sql is a partial SQL port of the KosherJava library.

The dialect used is MySQL.

Installation

Run the scripts in the context of your DB.

Usage and Documentation

Pure static KosherJava methods

In general, pure static KosherJava methods were converted to deterministic functions.

E.g., in JewishDate:

privatestaticintgetLastDayOfGregorianMonth(intmonth, intyear)

was converted to:

CREATEFUNCTIONJewishDate_getLastDayOfGregorianMonth(month INTEGER UNSIGNED, year INTEGER UNSIGNED) RETURNS INTEGER UNSIGNED
DETERMINISTIC

Impure instance methods

Impure instance methods were usually converted to stored procedures that return multiple out parameters, with the out parameters corresponding to the instance methods that are mutated.

E.g., in JewishDate:

privatevoidabsDateToJewishDate()

which uses instance property gregorianAbsDate and mutates instance properties jewishYear, jewishMonth, and jewishDay, was converted to:

CREATE PROCEDURE JewishDate_absDateToJewishDate(gregorianAbsDate INTEGER UNSIGNED, OUT jewishYear INTEGER UNSIGNED,
OUT jewishMonth INTEGER UNSIGNED, OUT jewishDay INTEGER UNSIGNED)
DETERMINISTIC

Helper procedures

Some helper procedures have been added to take the places of constructors and methods that only make sense in an instance context.

E.g. instead of the following:

Calendarcalendar = Calendar.getInstance();
calendar.set(2023, Calendar.DECEMBER, 31);
JewishDatejewishDate = newJewishDate(calendar);
intjewishYear = jewishDate.getJewishYear();
intjewishMonth = jewishDate.getJewishMonth();
intjewishDay = jewishDate.getJewishDayOfMonth();

use the following:

CALL gregorian_date_to_jewish_date(2023, 12, 31, @jewishYear, @jewishMonth, @jewishDay);
select @jewishYear, @jewishMonth, @jewishDay;

About

A partial SQL port of the KosherJava library

Topics

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages