├── project ├── NOT-YET.md ├── TASKS.md └── finished │ ├── 005 CREATE SCRIPT.md │ └── 009 Update to SQLite 3.50.1.md ├── src ├── chocolatey │ └── .gitignore ├── Tests │ ├── files │ │ ├── subdir │ │ │ └── subdir-file.txt │ │ ├── duplicate-header.csv │ │ ├── utf8.csv │ │ ├── utf8.txt │ │ ├── utf8bom.txt │ │ ├── blank-values.csv │ │ ├── semicolon.csv │ │ ├── utf8bom.csv │ │ ├── int-convert-fail.csv │ │ ├── missing-header.csv │ │ ├── excel.xls │ │ ├── utf16.csv │ │ ├── utf16.txt │ │ ├── v1.sqlnb │ │ ├── excel.xlsx │ │ ├── shiftjis.csv │ │ ├── shiftjis.txt │ │ ├── cli_test.sqlnb │ │ ├── example.duckdb │ │ ├── example.sqlite3 │ │ ├── excel-blank-row.xlsx │ │ ├── int-convert-fail.xlsx │ │ ├── excel-blank-values.xlsx │ │ ├── excel-duplicate-header.xlsx │ │ └── excel-missing-header.xlsx │ ├── scripts │ │ ├── doc │ │ │ ├── phonetic-funcs-1.sql │ │ │ ├── set-stmt.sql │ │ │ ├── hash-funcs.sql │ │ │ ├── array-count-func.sql │ │ │ ├── date-from-parts-func.sql │ │ │ ├── stats-aggregate-funcs.sql │ │ │ ├── json1 - Arrow operators 2.sql │ │ │ ├── month-func.sql │ │ │ ├── year-func.sql │ │ │ ├── json1 - Arrow operators 1.sql │ │ │ ├── is-numeric-func.sql │ │ │ ├── array-concat-func.sql │ │ │ ├── array-func.sql │ │ │ ├── date-time-from-parts-func.sql │ │ │ ├── try-catch-stmt.sql │ │ │ ├── phonetic-funcs-2.sql │ │ │ ├── print-stmt.sql │ │ │ ├── choose-func.sql │ │ │ ├── rowvalue - Clarity of presentation 1.sql │ │ │ ├── download-func.sql │ │ │ ├── string-distance-funcs-1.sql │ │ │ ├── uuid-blob-func.sql │ │ │ ├── array-merge-func.sql │ │ │ ├── date-part-func.sql │ │ │ ├── error-message-func.sql │ │ │ ├── array-get-func.sql │ │ │ ├── array-set-func.sql │ │ │ ├── math-funcs.sql │ │ │ ├── split-func.sql │ │ │ ├── gencol 2.sql │ │ │ ├── is-date-func.sql │ │ │ ├── array-insert-func.sql │ │ │ ├── string-distance-funcs-2.sql │ │ │ ├── array-append-func.sql │ │ │ ├── lang_upsert - Examples 1.sql │ │ │ ├── gencol 1.sql │ │ │ ├── lang_upsert - Parsing Ambiguity.sql │ │ │ ├── rowvalue - Row Value Comparisons 2.sql │ │ │ ├── stricttables - The ANY datatype 2.sql │ │ │ ├── to-date-func.sql │ │ │ ├── stricttables - The ANY datatype 1.sql │ │ │ ├── lang_upsert - Examples 2.sql │ │ │ ├── while-stmt.sql │ │ │ ├── break-stmt.sql │ │ │ ├── rowvalue - Clarity of presentation 2.sql │ │ │ ├── continue-stmt.sql │ │ │ ├── to-date-time-func.sql │ │ │ ├── eomonth-func.sql │ │ │ ├── lang_returning - Typical Use.sql │ │ │ ├── rowvalue - Search against multi-column keys 3.sql │ │ │ ├── rowvalue - Search against multi-column keys 2.sql │ │ │ ├── date-name-func.sql │ │ │ ├── rowvalue - Search against multi-column keys 1.sql │ │ │ ├── lang_update - UPDATE FROM.sql │ │ │ ├── date-add-func.sql │ │ │ ├── for-stmt.sql │ │ │ ├── date-trunc-func.sql │ │ │ ├── rowvalue - Scrolling Window Queries.sql │ │ │ ├── rowvalue - Comparison of dates stored as separate fields.sql │ │ │ ├── rowvalue - Row Value Comparisons 3.sql │ │ │ ├── date-diff-func.sql │ │ │ ├── lang_upsert - Examples 3.sql │ │ │ ├── list-xls-worksheets-func.sql │ │ │ ├── rowvalue - Row Values In UPDATE Statements.sql │ │ │ ├── windowfunctions - Introduction to Window Functions 2.sql │ │ │ ├── windowfunctions - Introduction to Window Functions 1.sql │ │ │ ├── declare-stmt.sql │ │ │ └── rowvalue - Update multiple columns of a table based on a query.sql.sql │ │ ├── Underscores in numeric literals.sql │ │ ├── EXECUTE simple.sql │ │ ├── RETURN.sql │ │ ├── HOST_NAME.sql │ │ ├── NOW.sql │ │ ├── USER_NAME.sql │ │ ├── NEWID.sql │ │ ├── UUID.sql │ │ ├── EXECUTE with quoted script name.sql │ │ ├── DELETE RETURNING.sql │ │ ├── RETURN with value.sql │ │ ├── UPDATE RETURNING.sql │ │ ├── EXECUTE using EXEC shorthand.sql │ │ ├── EXECUTE with return value.sql │ │ ├── FOREACH_minimal.sql │ │ ├── CREATE TABLE STRICT.sql │ │ ├── ORDER BY NULLS FIRST.sql │ │ ├── ORDER BY NULLS LAST.sql │ │ ├── INSERT RETURNING.sql │ │ ├── EXECUTE with one argument.sql │ │ ├── WITH MATERIALIZED.sql │ │ ├── EXECUTE implicitly using default value.sql │ │ ├── CREATE TABLE WITHOUT ROWID.sql │ │ ├── EXECUTE with DEFAULT keyword.sql │ │ ├── WITH NOT MATERIALIZED.sql │ │ ├── THROW.sql │ │ ├── IMPORT CSV duplicate header 1.sql │ │ ├── ALTER TABLE DROP COLUMN 2.sql │ │ ├── IMPORT XLS STOP_AT_FIRST_BLANK_ROW default.sql │ │ ├── CREATE TABLE duplicate options.sql │ │ ├── IMPORT XLS duplicate header 1.sql │ │ ├── ALTER TABLE DROP COLUMN 1.sql │ │ ├── IMPORT TEXT.sql │ │ ├── IMPORT CSV missing header 1.sql │ │ ├── IMPORT CSV missing header 2.sql │ │ ├── RETURN from EXECUTE.sql │ │ ├── ALTER TABLE RENAME COLUMN 2.sql │ │ ├── DECLARE_test.sql │ │ ├── HAVING without GROUP BY.sql │ │ ├── IMPORT CSV duplicate header 2.sql │ │ ├── IMPORT XLS missing header 1.sql │ │ ├── IMPORT XLS missing header 2.sql │ │ ├── THROW from sub-script.sql │ │ ├── ALTER TABLE RENAME COLUMN 1.sql │ │ ├── FOREACH_debug.sql │ │ ├── IMPORT XLS STOP_AT_FIRST_BLANK_ROW 1.sql │ │ ├── IMPORT XLS duplicate header 2.sql │ │ ├── IMPORT CSV missing header 3.sql │ │ ├── IMPORT XLS missing header 3.sql │ │ ├── EXECUTE one explicit, one default argument.sql │ │ ├── IMPORT CSV missing header 4.sql │ │ ├── IMPORT XLS STOP_AT_FIRST_BLANK_ROW 0.sql │ │ ├── Aggregate function filter clause.sql │ │ ├── GETDATE.sql │ │ ├── IMPORT XLS missing header 4.sql │ │ ├── GETUTCDATE.sql │ │ ├── THROW rethrow.sql │ │ ├── IMPORT XLS FIRST_COLUMN no column range.sql │ │ ├── JSON_GROUP_ARRAY.sql │ │ ├── RIGHT JOIN.sql │ │ ├── STRING_AGG.sql │ │ ├── EXPORT CSV SELECT.sql │ │ ├── EXPORT CSV TABLE.sql │ │ ├── FULL OUTER JOIN.sql │ │ ├── EXPORT CSV SCRIPT.sql │ │ ├── IMPORT XLS FIRST_COLUMN first and last, number.sql │ │ ├── IMPORT XLS LAST_COLUMN last column only.sql │ │ ├── RIGHT OUTER JOIN.sql │ │ ├── IMPORT XLS FIRST_COLUMN first and last, letter.sql │ │ ├── IN table-valued function.sql │ │ ├── IMPORT XLS LAST_COLUMN 0, all columns.sql │ │ ├── EXPORT CSV HEADER_ROW 0.sql │ │ ├── IMPORT XLS FIRST_COLUMN first column only, number.sql │ │ ├── JSON_GROUP_ARRAY with ORDER BY.sql │ │ ├── STRING_AGG with ORDER BY.sql │ │ ├── EXPORT CSV HEADER_ROW 1.sql │ │ ├── IMPORT XLS FIRST_COLUMN first column only, letter.sql │ │ ├── EXPORT CSV SEPARATOR semicolon.sql │ │ ├── EXPORT TXT.sql │ │ ├── IMPORT XLS LAST_COLUMN last beyond end of data.sql │ │ ├── FOREACH_two_vars.sql │ │ ├── IMPORT XLS FIRST_COLUMN first beyond end of data.sql │ │ ├── IMPORT TXT SKIP_LINES.sql │ │ ├── EXPORT CSV TABLE TRUNCATE_EXISTING_FILE default.sql │ │ ├── FOREACH_empty_table.sql │ │ ├── EXPORT CSV TABLE TRUNCATE_EXISTING_FILE 1.sql │ │ ├── IMPORT DATABASE DUCKDB.sql │ │ ├── IMPORT DATABASE SQLITE.sql │ │ ├── EXPORT CSV SEPARATOR tab.sql │ │ ├── EXPORT CSV TABLE TRUNCATE_EXISTING_FILE 0.sql │ │ ├── EXPORT CSV TABLE FILE_ENCODING.sql │ │ ├── FOREACH_single_column.sql │ │ ├── IMPORT DATABASE DUCKDB LINK.sql │ │ ├── IMPORT DATABASE SQLITE LINK.sql │ │ ├── CREATE_SCRIPT.sql │ │ ├── EXPORT TXT append.sql │ │ ├── EXPORT TXT truncate.sql │ │ ├── LIST_FILES.sql │ │ ├── EXPORT TXT Shift-JIS.sql │ │ ├── READ_FILE.sql │ │ ├── IMPORT XLS HEADER_ROW.sql │ │ ├── FOREACH_basic.sql │ │ ├── IMPORT CSV SKIP_LINES.sql │ │ ├── FOREACH_nested.sql │ │ ├── IMPORT TXT TAKE_LINES.sql │ │ ├── IMPORT XLS LAST_ROW.sql │ │ ├── IMPORT CSV BLANK_VALUES 1.sql │ │ ├── IMPORT CSV BLANK_VALUES DEFAULT.sql │ │ ├── IMPORT CSV BLANK_VALUES 2.sql │ │ ├── IMPORT XLS BLANK_VALUES 1.sql │ │ ├── IMPORT CSV BLANK_VALUES 3.sql │ │ └── IMPORT XLS BLANK_VALUES DEFAULT.sql │ ├── Resources │ │ └── other.db │ ├── TestUtil.cs │ └── GlobalInit.cs ├── SqlNotebook │ ├── .gitignore │ ├── SqlNotebookIcon.ico │ ├── Pages │ │ ├── BlockType.cs │ │ └── AddBlockEventArgs.cs │ ├── Resources │ │ ├── SqlNotebookIcon.ico │ │ ├── SqlNotebookIcon.png │ │ ├── SqlNotebookIcon32.png │ │ └── SqlNotebookIcon48.png │ ├── IDocumentControl.cs │ ├── Import │ │ ├── ColumnHeadersOption.cs │ │ ├── ImportConversionFailOption.cs │ │ ├── ImportTableExistsOption.cs │ │ ├── ImportPreviewControl.cs │ │ └── Database │ │ │ └── IImportSession.cs │ ├── Properties │ │ └── PublishProfiles │ │ │ └── FolderProfile.pubxml │ └── UserControlDockContent.cs ├── SqlNotebookScript │ ├── Interpreter │ │ ├── Ast │ │ │ ├── Stmt.cs │ │ │ ├── SetStmt.cs │ │ │ ├── BreakStmt.cs │ │ │ ├── DeclareStmt.cs │ │ │ ├── RethrowStmt.cs │ │ │ ├── ContinueStmt.cs │ │ │ ├── TypeConversion.cs │ │ │ ├── Script.cs │ │ │ ├── BlockStmt.cs │ │ │ ├── ReturnStmt.cs │ │ │ ├── ArgumentPair.cs │ │ │ ├── SaveStmt.cs │ │ │ ├── PrintStmt.cs │ │ │ ├── ThrowStmt.cs │ │ │ ├── Expr.cs │ │ │ ├── Block.cs │ │ │ ├── AssignmentStmt.cs │ │ │ ├── DropPageStmt.cs │ │ │ ├── DropScriptStmt.cs │ │ │ ├── WhileStmt.cs │ │ │ ├── IdentifierOrExpr.cs │ │ │ ├── TryCatchStmt.cs │ │ │ ├── OptionsList.cs │ │ │ ├── CreateScriptStmt.cs │ │ │ ├── IfStmt.cs │ │ │ ├── ForeachStmt.cs │ │ │ ├── ExecuteStmt.cs │ │ │ ├── ExportTxtStmt.cs │ │ │ ├── ImportCsvStmt.cs │ │ │ ├── ImportColumn.cs │ │ │ ├── ImportTable.cs │ │ │ ├── ForStmt.cs │ │ │ ├── ImportXlsStmt.cs │ │ │ ├── ExportCsvStmt.cs │ │ │ ├── ImportTxtStmt.cs │ │ │ └── SqlStmt.cs │ │ ├── ScriptException.cs │ │ └── UncaughtErrorScriptException.cs │ ├── Utils │ │ ├── IfConversionFails.cs │ │ ├── BlankValuesOption.cs │ │ ├── ExceptionEx.cs │ │ └── Extensions.cs │ ├── SharedHttp.cs │ ├── Core │ │ ├── GenericModules │ │ │ ├── GenericTableMetadata.cs │ │ │ └── GenericCursorMetadata.cs │ │ ├── SqliteException.cs │ │ ├── SqliteInterop │ │ │ ├── Sqlite3IndexOrderBy.cs │ │ │ ├── Sqlite3IndexConstraintUsage.cs │ │ │ ├── Sqlite3IndexConstraint.cs │ │ │ ├── Sqlite3VtabCursor.cs │ │ │ ├── Sqlite3Vtab.cs │ │ │ └── Sqlite3IndexInfo.cs │ │ └── AdoModules │ │ │ ├── AdoCursorMetadata.cs │ │ │ └── AdoCreateInfo.cs │ ├── Token.cs │ ├── CustomScalarFunction.cs │ ├── CustomTableFunction.cs │ ├── ScalarFunctions │ │ ├── DownloadFunction.cs │ │ └── RegexpFunction.cs │ └── DataTables │ │ └── MemorySimpleDataTable.cs ├── SqlNotebookDb │ └── SqlNotebookDb.vcxproj.filters └── SqlNotebookCmd │ └── SqlNotebookCmd.csproj ├── web ├── .gitignore ├── robots.txt ├── favicon.ico ├── sitemap.txt ├── art │ ├── SqlNotebookIcon.png │ ├── main-screenshot.png │ ├── import-screenshot.png │ └── script-screenshot.png ├── appversion.txt ├── error.html └── doc.html ├── .csharpierrc ├── ext ├── fatcow │ ├── cog.png │ ├── key.png │ ├── cog32.png │ ├── cross.png │ ├── font.png │ ├── help.ico │ ├── help.png │ ├── house.png │ ├── key32.png │ ├── link.png │ ├── list.png │ ├── note.png │ ├── page.png │ ├── panel.png │ ├── stop.png │ ├── table.ico │ ├── table.png │ ├── bookmark.png │ ├── cross32.png │ ├── delete.png │ ├── delete32.png │ ├── diskette.png │ ├── filter.png │ ├── filter32.png │ ├── folder.png │ ├── folder32.png │ ├── font32.png │ ├── help32.png │ ├── house32.png │ ├── link32.png │ ├── list32.png │ ├── note32.png │ ├── page32.png │ ├── panel32.png │ ├── script.ico │ ├── script.png │ ├── script32.ico │ ├── script32.png │ ├── stop32.png │ ├── table32.ico │ ├── table32.png │ ├── table_go.png │ ├── warning.png │ ├── world_go.png │ ├── arrow_left.png │ ├── bookmark32.png │ ├── bullet_add.png │ ├── check_box.png │ ├── diskette32.png │ ├── hourglass.png │ ├── magnifier.png │ ├── page_white.png │ ├── script_go.png │ ├── table_edit.png │ ├── table_go32.png │ ├── table_link.png │ ├── tree_list.png │ ├── warning32.png │ ├── world_go32.png │ ├── world_link.png │ ├── accept_button.png │ ├── arrow_left32.png │ ├── arrow_right.png │ ├── arrow_right32.png │ ├── bullet_add32.png │ ├── bullet_key32.png │ ├── bullet_white.png │ ├── check_box32.png │ ├── database_add.png │ ├── exclamation.ico │ ├── exclamation.png │ ├── exclamation16.png │ ├── filter_clear.png │ ├── hide_detail.png │ ├── hide_detail32.png │ ├── hourglass32.png │ ├── magic_wand16.png │ ├── magic_wand32.png │ ├── magnifier32.png │ ├── page_white32.png │ ├── preferences.png │ ├── preferences32.png │ ├── script_go32.png │ ├── show_detail.png │ ├── show_detail32.png │ ├── table_edit32.png │ ├── table_import.ico │ ├── table_link32.png │ ├── table_sheet.ico │ ├── table_sheet32.png │ ├── text_exports.png │ ├── text_imports.png │ ├── tree_list32.png │ ├── world_link32.png │ ├── zone_select.png │ ├── zone_select32.png │ ├── accept_button32.png │ ├── bullet_black32.png │ ├── bullet_white32.png │ ├── database_add32.png │ ├── database_table.png │ ├── filter_clear32.png │ ├── page_white_text.ico │ ├── page_white_text.png │ ├── resultset_next.png │ ├── table_import32.png │ ├── text_exports32.png │ ├── text_imports32.png │ ├── check_box_uncheck.png │ ├── control_play_blue.png │ ├── database_table32.png │ ├── file_extension_txt.ico │ ├── file_extension_xls.ico │ ├── page_white_excel.png │ ├── page_white_excel32.png │ ├── page_white_text32.png │ ├── resultset_next32.png │ ├── resultset_previous.png │ ├── textfield_rename.png │ ├── textfield_rename32.png │ ├── check_box_uncheck32.png │ ├── control_play_blue32.png │ ├── file_extension_txt32.png │ ├── file_extension_xls32.png │ └── resultset_previous32.png ├── Windows-API-Code-Pack │ ├── README.md │ ├── source │ │ └── WindowsAPICodePack │ │ │ ├── Core │ │ │ ├── ProjectSignKey.snk │ │ │ ├── Interop │ │ │ │ └── Dialogs │ │ │ │ │ └── DialogShowState.cs │ │ │ ├── Dialogs │ │ │ │ └── TaskDialogs │ │ │ │ │ ├── TaskDialogStartupLocation.cs │ │ │ │ │ ├── TaskDialogExpandedInfoMode.cs │ │ │ │ │ └── TaskDialogControl.cs │ │ │ └── SafeHandles │ │ │ │ ├── ZeroInvalidHandle.cs │ │ │ │ ├── SafeIconHandle.cs │ │ │ │ └── SafeRegionHandle.cs │ │ │ ├── Sensors │ │ │ ├── ProjectSignKey.snk │ │ │ ├── Sensors │ │ │ │ └── UnknownSensor.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ └── Interop │ │ │ │ └── SensorNativeMethods.cs │ │ │ ├── Shell │ │ │ ├── ProjectSignKey.snk │ │ │ ├── Common │ │ │ │ ├── ShellFolder.cs │ │ │ │ ├── ShellNonFileSystemItem.cs │ │ │ │ ├── ShellSavedSearchCollection.cs │ │ │ │ ├── ShellSearchCollection.cs │ │ │ │ └── ShellNonFileSystemFolder.cs │ │ │ ├── ExplorerBrowser │ │ │ │ ├── ExplorerBrowser.WPF.xaml │ │ │ │ └── NavigationLogEnums.cs │ │ │ ├── DesktopWindowManager │ │ │ │ └── GlassEvents.cs │ │ │ ├── KnownFolders │ │ │ │ └── RetrievalOptions.cs │ │ │ ├── CommonFileDialogs │ │ │ │ └── ICommonFileDialogIndexedControls.cs │ │ │ ├── Interop │ │ │ │ └── Common │ │ │ │ │ └── ShellCOMClasses.cs │ │ │ └── Taskbar │ │ │ │ └── TaskbarInterfaces.cs │ │ │ ├── ShellExtensions │ │ │ ├── ProjectSignKey.snk │ │ │ └── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ └── ExtendedLinguisticServices │ │ │ ├── ProjectSignKey.snk │ │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ └── .gitattributes ├── dockpanelsuite │ ├── WinFormsUI │ │ ├── dockpanelsuite.snk │ │ ├── Docking │ │ │ ├── DockPanel.bmp │ │ │ ├── Resources │ │ │ │ ├── DockPane_Dock.png │ │ │ │ ├── DockPane_Close.png │ │ │ │ ├── DockPane_Option.png │ │ │ │ ├── DockPane_AutoHide.png │ │ │ │ ├── DockIndicator_PanelFill.png │ │ │ │ ├── DockIndicator_PanelLeft.png │ │ │ │ ├── DockIndicator_PanelTop.png │ │ │ │ ├── DockPane_OptionOverflow.png │ │ │ │ ├── DockIndicator_PaneDiamond.png │ │ │ │ ├── DockIndicator_PanelBottom.png │ │ │ │ ├── DockIndicator_PanelRight.png │ │ │ │ ├── DockIndicator_PaneDiamond_Left.png │ │ │ │ ├── DockIndicator_PaneDiamond_Right.png │ │ │ │ ├── DockIndicator_PaneDiamond_Top.png │ │ │ │ ├── DockIndicator_PanelFill_Active.png │ │ │ │ ├── DockIndicator_PanelLeft_Active.png │ │ │ │ ├── DockIndicator_PanelRight_Active.png │ │ │ │ ├── DockIndicator_PanelTop_Active.png │ │ │ │ ├── Dockindicator_PaneDiamond_Fill.png │ │ │ │ ├── DockIndicator_PaneDiamond_Bottom.png │ │ │ │ ├── DockIndicator_PaneDiamond_Hotspot.png │ │ │ │ ├── DockIndicator_PanelBottom_Active.png │ │ │ │ ├── DockIndicator_PaneDiamond_HotspotIndex.png │ │ │ │ └── DockIndicator_PaneDiamond_HotspotIndex_VS2012.png │ │ │ ├── DummyControl.cs │ │ │ ├── ThemeBase.cs │ │ │ ├── Measures.cs │ │ │ ├── ITheme.cs │ │ │ ├── DockContentEventArgs.cs │ │ │ ├── DrawingRoutines.cs │ │ │ └── Helpers │ │ │ │ └── Win32Helper.cs │ │ └── ThemeVS2012Light │ │ │ └── Resources │ │ │ ├── DockPane_Close.png │ │ │ ├── DockPane_Dock.png │ │ │ ├── ActiveTab_Close.png │ │ │ ├── DockPane_AutoHide.png │ │ │ ├── DockPane_Option.png │ │ │ ├── LostFocusTab_Close.png │ │ │ ├── ActiveTabHover_Close.png │ │ │ ├── DockIndicator_PanelTop.png │ │ │ ├── InactiveTabHover_Close.png │ │ │ ├── DockIndicator_PanelFill.png │ │ │ ├── DockIndicator_PanelLeft.png │ │ │ ├── DockIndicator_PanelRight.png │ │ │ ├── DockPane_OptionOverflow.png │ │ │ ├── LostFocusTabHover_Close.png │ │ │ ├── DockIndicator_PaneDiamond1.bmp │ │ │ ├── DockIndicator_PanelBottom.png │ │ │ ├── Dockindicator_PaneDiamond.png │ │ │ ├── Dockindicator_PaneDiamond_Fill.png │ │ │ ├── Dockindicator_PaneDiamond_Hotspot.png │ │ │ └── DockIndicator_PaneDiamond_HotspotIndex.png │ └── .gitignore └── README.md ├── scripts ├── clean.sh ├── init.sh ├── run.sh ├── format.sh └── get-native-arch.sh ├── .config └── dotnet-tools.json ├── .gitignore ├── doc ├── host-name-func.html ├── now-func.html ├── user-name-func.html ├── get-date-func.html ├── new-id-func.html ├── get-utc-date-func.html ├── print-stmt.html ├── year-func.html ├── day-func.html └── month-func.html ├── ps1 └── Update-GitHubPages.ps1 ├── .gitattributes └── README.md /project/NOT-YET.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project/TASKS.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/chocolatey/.gitignore: -------------------------------------------------------------------------------- 1 | *.nupkg 2 | -------------------------------------------------------------------------------- /web/.gitignore: -------------------------------------------------------------------------------- 1 | site/ 2 | temp/ 3 | -------------------------------------------------------------------------------- /src/Tests/files/subdir/subdir-file.txt: -------------------------------------------------------------------------------- 1 | hi -------------------------------------------------------------------------------- /.csharpierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120 3 | } 4 | -------------------------------------------------------------------------------- /src/Tests/files/duplicate-header.csv: -------------------------------------------------------------------------------- 1 | a,,b,b,b 2 | 1,2,3,4,5 3 | -------------------------------------------------------------------------------- /src/Tests/files/utf8.csv: -------------------------------------------------------------------------------- 1 | foo,bar 2 | 111,"HELLO" 3 | 222,"WORLD" -------------------------------------------------------------------------------- /src/Tests/files/utf8.txt: -------------------------------------------------------------------------------- 1 | abc 2 | def 3 | ghi 4 | jkl 5 | mno -------------------------------------------------------------------------------- /src/Tests/files/utf8bom.txt: -------------------------------------------------------------------------------- 1 | abc 2 | def 3 | ghi 4 | jkl 5 | mno -------------------------------------------------------------------------------- /web/robots.txt: -------------------------------------------------------------------------------- 1 | Sitemap: https://sqlnotebook.com/sitemap.txt 2 | -------------------------------------------------------------------------------- /src/Tests/files/blank-values.csv: -------------------------------------------------------------------------------- 1 | a,b,c 2 | 111,,333 3 | 444,555,666 -------------------------------------------------------------------------------- /src/Tests/files/semicolon.csv: -------------------------------------------------------------------------------- 1 | foo;bar 2 | 111;"HELLO" 3 | 222;"WORLD" -------------------------------------------------------------------------------- /src/Tests/files/utf8bom.csv: -------------------------------------------------------------------------------- 1 | foo,bar 2 | 111,"HELLO" 3 | 222,"WORLD" -------------------------------------------------------------------------------- /src/Tests/files/int-convert-fail.csv: -------------------------------------------------------------------------------- 1 | foo,bar 2 | 111,HELLO 3 | ZZZ,WORLD -------------------------------------------------------------------------------- /src/SqlNotebook/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | 3 | obj/ 4 | 5 | .vs/ 6 | publish/ 7 | -------------------------------------------------------------------------------- /src/Tests/files/missing-header.csv: -------------------------------------------------------------------------------- 1 | A,,B,,C 2 | 111,222,333,444,555 3 | 666,777,888,999,0 -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/web/favicon.ico -------------------------------------------------------------------------------- /ext/fatcow/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/cog.png -------------------------------------------------------------------------------- /ext/fatcow/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/key.png -------------------------------------------------------------------------------- /web/sitemap.txt: -------------------------------------------------------------------------------- 1 | https://sqlnotebook.com/index.html 2 | https://sqlnotebook.com/doc.html 3 | -------------------------------------------------------------------------------- /ext/fatcow/cog32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/cog32.png -------------------------------------------------------------------------------- /ext/fatcow/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/cross.png -------------------------------------------------------------------------------- /ext/fatcow/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/font.png -------------------------------------------------------------------------------- /ext/fatcow/help.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/help.ico -------------------------------------------------------------------------------- /ext/fatcow/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/help.png -------------------------------------------------------------------------------- /ext/fatcow/house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/house.png -------------------------------------------------------------------------------- /ext/fatcow/key32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/key32.png -------------------------------------------------------------------------------- /ext/fatcow/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/link.png -------------------------------------------------------------------------------- /ext/fatcow/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/list.png -------------------------------------------------------------------------------- /ext/fatcow/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/note.png -------------------------------------------------------------------------------- /ext/fatcow/page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page.png -------------------------------------------------------------------------------- /ext/fatcow/panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/panel.png -------------------------------------------------------------------------------- /ext/fatcow/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/stop.png -------------------------------------------------------------------------------- /ext/fatcow/table.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table.ico -------------------------------------------------------------------------------- /ext/fatcow/table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table.png -------------------------------------------------------------------------------- /src/Tests/scripts/doc/phonetic-funcs-1.sql: -------------------------------------------------------------------------------- 1 | PRINT SOUNDEX('Robert'); 2 | --output-- 3 | R163 4 | -------------------------------------------------------------------------------- /ext/fatcow/bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bookmark.png -------------------------------------------------------------------------------- /ext/fatcow/cross32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/cross32.png -------------------------------------------------------------------------------- /ext/fatcow/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/delete.png -------------------------------------------------------------------------------- /ext/fatcow/delete32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/delete32.png -------------------------------------------------------------------------------- /ext/fatcow/diskette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/diskette.png -------------------------------------------------------------------------------- /ext/fatcow/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/filter.png -------------------------------------------------------------------------------- /ext/fatcow/filter32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/filter32.png -------------------------------------------------------------------------------- /ext/fatcow/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/folder.png -------------------------------------------------------------------------------- /ext/fatcow/folder32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/folder32.png -------------------------------------------------------------------------------- /ext/fatcow/font32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/font32.png -------------------------------------------------------------------------------- /ext/fatcow/help32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/help32.png -------------------------------------------------------------------------------- /ext/fatcow/house32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/house32.png -------------------------------------------------------------------------------- /ext/fatcow/link32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/link32.png -------------------------------------------------------------------------------- /ext/fatcow/list32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/list32.png -------------------------------------------------------------------------------- /ext/fatcow/note32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/note32.png -------------------------------------------------------------------------------- /ext/fatcow/page32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page32.png -------------------------------------------------------------------------------- /ext/fatcow/panel32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/panel32.png -------------------------------------------------------------------------------- /ext/fatcow/script.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/script.ico -------------------------------------------------------------------------------- /ext/fatcow/script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/script.png -------------------------------------------------------------------------------- /ext/fatcow/script32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/script32.ico -------------------------------------------------------------------------------- /ext/fatcow/script32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/script32.png -------------------------------------------------------------------------------- /ext/fatcow/stop32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/stop32.png -------------------------------------------------------------------------------- /ext/fatcow/table32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table32.ico -------------------------------------------------------------------------------- /ext/fatcow/table32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table32.png -------------------------------------------------------------------------------- /ext/fatcow/table_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_go.png -------------------------------------------------------------------------------- /ext/fatcow/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/warning.png -------------------------------------------------------------------------------- /ext/fatcow/world_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/world_go.png -------------------------------------------------------------------------------- /ext/fatcow/arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/arrow_left.png -------------------------------------------------------------------------------- /ext/fatcow/bookmark32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bookmark32.png -------------------------------------------------------------------------------- /ext/fatcow/bullet_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bullet_add.png -------------------------------------------------------------------------------- /ext/fatcow/check_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/check_box.png -------------------------------------------------------------------------------- /ext/fatcow/diskette32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/diskette32.png -------------------------------------------------------------------------------- /ext/fatcow/hourglass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/hourglass.png -------------------------------------------------------------------------------- /ext/fatcow/magnifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/magnifier.png -------------------------------------------------------------------------------- /ext/fatcow/page_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page_white.png -------------------------------------------------------------------------------- /ext/fatcow/script_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/script_go.png -------------------------------------------------------------------------------- /ext/fatcow/table_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_edit.png -------------------------------------------------------------------------------- /ext/fatcow/table_go32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_go32.png -------------------------------------------------------------------------------- /ext/fatcow/table_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_link.png -------------------------------------------------------------------------------- /ext/fatcow/tree_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/tree_list.png -------------------------------------------------------------------------------- /ext/fatcow/warning32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/warning32.png -------------------------------------------------------------------------------- /ext/fatcow/world_go32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/world_go32.png -------------------------------------------------------------------------------- /ext/fatcow/world_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/world_link.png -------------------------------------------------------------------------------- /src/Tests/files/excel.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/excel.xls -------------------------------------------------------------------------------- /src/Tests/files/utf16.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/utf16.csv -------------------------------------------------------------------------------- /src/Tests/files/utf16.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/utf16.txt -------------------------------------------------------------------------------- /src/Tests/files/v1.sqlnb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/v1.sqlnb -------------------------------------------------------------------------------- /ext/fatcow/accept_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/accept_button.png -------------------------------------------------------------------------------- /ext/fatcow/arrow_left32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/arrow_left32.png -------------------------------------------------------------------------------- /ext/fatcow/arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/arrow_right.png -------------------------------------------------------------------------------- /ext/fatcow/arrow_right32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/arrow_right32.png -------------------------------------------------------------------------------- /ext/fatcow/bullet_add32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bullet_add32.png -------------------------------------------------------------------------------- /ext/fatcow/bullet_key32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bullet_key32.png -------------------------------------------------------------------------------- /ext/fatcow/bullet_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bullet_white.png -------------------------------------------------------------------------------- /ext/fatcow/check_box32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/check_box32.png -------------------------------------------------------------------------------- /ext/fatcow/database_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/database_add.png -------------------------------------------------------------------------------- /ext/fatcow/exclamation.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/exclamation.ico -------------------------------------------------------------------------------- /ext/fatcow/exclamation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/exclamation.png -------------------------------------------------------------------------------- /ext/fatcow/exclamation16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/exclamation16.png -------------------------------------------------------------------------------- /ext/fatcow/filter_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/filter_clear.png -------------------------------------------------------------------------------- /ext/fatcow/hide_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/hide_detail.png -------------------------------------------------------------------------------- /ext/fatcow/hide_detail32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/hide_detail32.png -------------------------------------------------------------------------------- /ext/fatcow/hourglass32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/hourglass32.png -------------------------------------------------------------------------------- /ext/fatcow/magic_wand16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/magic_wand16.png -------------------------------------------------------------------------------- /ext/fatcow/magic_wand32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/magic_wand32.png -------------------------------------------------------------------------------- /ext/fatcow/magnifier32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/magnifier32.png -------------------------------------------------------------------------------- /ext/fatcow/page_white32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page_white32.png -------------------------------------------------------------------------------- /ext/fatcow/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/preferences.png -------------------------------------------------------------------------------- /ext/fatcow/preferences32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/preferences32.png -------------------------------------------------------------------------------- /ext/fatcow/script_go32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/script_go32.png -------------------------------------------------------------------------------- /ext/fatcow/show_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/show_detail.png -------------------------------------------------------------------------------- /ext/fatcow/show_detail32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/show_detail32.png -------------------------------------------------------------------------------- /ext/fatcow/table_edit32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_edit32.png -------------------------------------------------------------------------------- /ext/fatcow/table_import.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_import.ico -------------------------------------------------------------------------------- /ext/fatcow/table_link32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_link32.png -------------------------------------------------------------------------------- /ext/fatcow/table_sheet.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_sheet.ico -------------------------------------------------------------------------------- /ext/fatcow/table_sheet32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_sheet32.png -------------------------------------------------------------------------------- /ext/fatcow/text_exports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/text_exports.png -------------------------------------------------------------------------------- /ext/fatcow/text_imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/text_imports.png -------------------------------------------------------------------------------- /ext/fatcow/tree_list32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/tree_list32.png -------------------------------------------------------------------------------- /ext/fatcow/world_link32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/world_link32.png -------------------------------------------------------------------------------- /ext/fatcow/zone_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/zone_select.png -------------------------------------------------------------------------------- /ext/fatcow/zone_select32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/zone_select32.png -------------------------------------------------------------------------------- /src/Tests/Resources/other.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/Resources/other.db -------------------------------------------------------------------------------- /src/Tests/files/excel.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/excel.xlsx -------------------------------------------------------------------------------- /src/Tests/files/shiftjis.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/shiftjis.csv -------------------------------------------------------------------------------- /src/Tests/files/shiftjis.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/shiftjis.txt -------------------------------------------------------------------------------- /src/Tests/scripts/doc/set-stmt.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = 1; 2 | SET @a = 2; 3 | PRINT @a; 4 | --output-- 5 | 2 6 | -------------------------------------------------------------------------------- /web/art/SqlNotebookIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/web/art/SqlNotebookIcon.png -------------------------------------------------------------------------------- /web/art/main-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/web/art/main-screenshot.png -------------------------------------------------------------------------------- /ext/fatcow/accept_button32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/accept_button32.png -------------------------------------------------------------------------------- /ext/fatcow/bullet_black32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bullet_black32.png -------------------------------------------------------------------------------- /ext/fatcow/bullet_white32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/bullet_white32.png -------------------------------------------------------------------------------- /ext/fatcow/database_add32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/database_add32.png -------------------------------------------------------------------------------- /ext/fatcow/database_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/database_table.png -------------------------------------------------------------------------------- /ext/fatcow/filter_clear32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/filter_clear32.png -------------------------------------------------------------------------------- /ext/fatcow/page_white_text.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page_white_text.ico -------------------------------------------------------------------------------- /ext/fatcow/page_white_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page_white_text.png -------------------------------------------------------------------------------- /ext/fatcow/resultset_next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/resultset_next.png -------------------------------------------------------------------------------- /ext/fatcow/table_import32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/table_import32.png -------------------------------------------------------------------------------- /ext/fatcow/text_exports32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/text_exports32.png -------------------------------------------------------------------------------- /ext/fatcow/text_imports32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/text_imports32.png -------------------------------------------------------------------------------- /src/Tests/files/cli_test.sqlnb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/cli_test.sqlnb -------------------------------------------------------------------------------- /src/Tests/files/example.duckdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/example.duckdb -------------------------------------------------------------------------------- /src/Tests/scripts/Underscores in numeric literals.sql: -------------------------------------------------------------------------------- 1 | SELECT 1_234 AS a 2 | --output-- 3 | a 4 | 1234 5 | - 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/hash-funcs.sql: -------------------------------------------------------------------------------- 1 | PRINT HEX(MD5('abc')); 2 | --output-- 3 | 900150983CD24FB0D6963F7D28E17F72 4 | -------------------------------------------------------------------------------- /web/art/import-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/web/art/import-screenshot.png -------------------------------------------------------------------------------- /web/art/script-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/web/art/script-screenshot.png -------------------------------------------------------------------------------- /ext/fatcow/check_box_uncheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/check_box_uncheck.png -------------------------------------------------------------------------------- /ext/fatcow/control_play_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/control_play_blue.png -------------------------------------------------------------------------------- /ext/fatcow/database_table32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/database_table32.png -------------------------------------------------------------------------------- /ext/fatcow/file_extension_txt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/file_extension_txt.ico -------------------------------------------------------------------------------- /ext/fatcow/file_extension_xls.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/file_extension_xls.ico -------------------------------------------------------------------------------- /ext/fatcow/page_white_excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page_white_excel.png -------------------------------------------------------------------------------- /ext/fatcow/page_white_excel32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page_white_excel32.png -------------------------------------------------------------------------------- /ext/fatcow/page_white_text32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/page_white_text32.png -------------------------------------------------------------------------------- /ext/fatcow/resultset_next32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/resultset_next32.png -------------------------------------------------------------------------------- /ext/fatcow/resultset_previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/resultset_previous.png -------------------------------------------------------------------------------- /ext/fatcow/textfield_rename.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/textfield_rename.png -------------------------------------------------------------------------------- /ext/fatcow/textfield_rename32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/textfield_rename32.png -------------------------------------------------------------------------------- /src/Tests/files/example.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/example.sqlite3 -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE simple.sql: -------------------------------------------------------------------------------- 1 | EXECUTE Script2 2 | --script-- 3 | PRINT 'Hello' 4 | --output-- 5 | Hello 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/RETURN.sql: -------------------------------------------------------------------------------- 1 | PRINT 'foo' 2 | RETURN; 3 | PRINT 'bar'; -- should not execute 4 | --output-- 5 | foo 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-count-func.sql: -------------------------------------------------------------------------------- 1 | PRINT ARRAY_COUNT(ARRAY('A', 'B', 'C')); -- "3" 2 | --output-- 3 | 3 4 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/Windows-API-Code-Pack/README.md -------------------------------------------------------------------------------- /ext/fatcow/check_box_uncheck32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/check_box_uncheck32.png -------------------------------------------------------------------------------- /ext/fatcow/control_play_blue32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/control_play_blue32.png -------------------------------------------------------------------------------- /ext/fatcow/file_extension_txt32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/file_extension_txt32.png -------------------------------------------------------------------------------- /ext/fatcow/file_extension_xls32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/file_extension_xls32.png -------------------------------------------------------------------------------- /ext/fatcow/resultset_previous32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/fatcow/resultset_previous32.png -------------------------------------------------------------------------------- /src/SqlNotebook/SqlNotebookIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/SqlNotebook/SqlNotebookIcon.ico -------------------------------------------------------------------------------- /src/Tests/scripts/HOST_NAME.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = HOST_NAME(); 2 | IF LENGTH(@a) > 0 3 | PRINT 'ok' 4 | --output-- 5 | ok 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/NOW.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = NOW(); 2 | SELECT LENGTH(@a) AS len; 3 | 4 | --output-- 5 | len 6 | 23 7 | - 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/USER_NAME.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = USER_NAME(); 2 | IF LENGTH(@a) > 0 3 | PRINT 'ok' 4 | --output-- 5 | ok 6 | -------------------------------------------------------------------------------- /web/appversion.txt: -------------------------------------------------------------------------------- 1 | 2.0.0 2 | https://github.com/brianluft/sqlnotebook/releases/download/v2.0.0/SQLNotebook-64bit-2.0.0.msi 3 | -------------------------------------------------------------------------------- /src/Tests/files/excel-blank-row.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/excel-blank-row.xlsx -------------------------------------------------------------------------------- /src/Tests/files/int-convert-fail.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/int-convert-fail.xlsx -------------------------------------------------------------------------------- /src/Tests/scripts/NEWID.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = NEWID(); 2 | SELECT LENGTH(@a) AS len; 3 | 4 | --output-- 5 | len 6 | 36 7 | - 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/UUID.sql: -------------------------------------------------------------------------------- 1 | PRINT LENGTH(UUID()); 2 | IF UUID() != UUID() PRINT 'unique'; 3 | --output-- 4 | 36 5 | unique 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/date-from-parts-func.sql: -------------------------------------------------------------------------------- 1 | PRINT DATEFROMPARTS(2015, 1, 2); -- "2015-01-02" 2 | --output-- 3 | 2015-01-02 4 | -------------------------------------------------------------------------------- /src/Tests/files/excel-blank-values.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/excel-blank-values.xlsx -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE with quoted script name.sql: -------------------------------------------------------------------------------- 1 | EXECUTE 'Script2' 2 | --script-- 3 | PRINT 'Hello' 4 | --output-- 5 | Hello 6 | -------------------------------------------------------------------------------- /src/Tests/files/excel-duplicate-header.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/excel-duplicate-header.xlsx -------------------------------------------------------------------------------- /src/Tests/files/excel-missing-header.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/Tests/files/excel-missing-header.xlsx -------------------------------------------------------------------------------- /src/Tests/scripts/DELETE RETURNING.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | DELETE FROM foo RETURNING *; 3 | --output-- 4 | a,b,c 5 | - 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/RETURN with value.sql: -------------------------------------------------------------------------------- 1 | EXECUTE @x = Script2; 2 | PRINT @x; 3 | --script-- 4 | RETURN 'foo'; 5 | --output-- 6 | foo 7 | -------------------------------------------------------------------------------- /src/SqlNotebook/Pages/BlockType.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebook.Pages; 2 | 3 | public enum BlockType 4 | { 5 | Text, 6 | Query, 7 | } 8 | -------------------------------------------------------------------------------- /src/SqlNotebook/Resources/SqlNotebookIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/SqlNotebook/Resources/SqlNotebookIcon.ico -------------------------------------------------------------------------------- /src/SqlNotebook/Resources/SqlNotebookIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/SqlNotebook/Resources/SqlNotebookIcon.png -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/Stmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public abstract class Stmt : Node { } 4 | -------------------------------------------------------------------------------- /src/Tests/scripts/UPDATE RETURNING.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | UPDATE foo SET a = 0 RETURNING *; 3 | --output-- 4 | a,b,c 5 | - 6 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/dockpanelsuite.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/dockpanelsuite.snk -------------------------------------------------------------------------------- /src/SqlNotebook/Resources/SqlNotebookIcon32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/SqlNotebook/Resources/SqlNotebookIcon32.png -------------------------------------------------------------------------------- /src/SqlNotebook/Resources/SqlNotebookIcon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/src/SqlNotebook/Resources/SqlNotebookIcon48.png -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE using EXEC shorthand.sql: -------------------------------------------------------------------------------- 1 | EXEC @x = Script2; 2 | PRINT @x; 3 | --script-- 4 | RETURN 'foo'; 5 | --output-- 6 | foo 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE with return value.sql: -------------------------------------------------------------------------------- 1 | EXECUTE @x = Script2; 2 | PRINT @x; 3 | --script-- 4 | RETURN 'foo'; 5 | --output-- 6 | foo 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/FOREACH_minimal.sql: -------------------------------------------------------------------------------- 1 | PRINT 'before'; 2 | DECLARE @x; 3 | PRINT 'after declare'; 4 | 5 | --output-- 6 | before 7 | after declare -------------------------------------------------------------------------------- /src/Tests/scripts/doc/stats-aggregate-funcs.sql: -------------------------------------------------------------------------------- 1 | SELECT MEDIAN(value) AS x FROM GENERATE_SERIES(100, 200); 2 | --output-- 3 | x 4 | 150 5 | - 6 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/SetStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class SetStmt : AssignmentStmt { } 4 | -------------------------------------------------------------------------------- /src/Tests/scripts/CREATE TABLE STRICT.sql: -------------------------------------------------------------------------------- 1 | -- Test parsing. 2 | CREATE TABLE foo (a INT, b TEXT) STRICT; 3 | PRINT 'ok'; 4 | 5 | --output-- 6 | ok 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/ORDER BY NULLS FIRST.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | SELECT * FROM foo ORDER BY a NULLS FIRST; 3 | --output-- 4 | a,b,c 5 | - 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/ORDER BY NULLS LAST.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | SELECT * FROM foo ORDER BY a NULLS LAST; 3 | --output-- 4 | a,b,c 5 | - 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/json1 - Arrow operators 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/json1.html#jptr 2 | PRINT '{"a":"xyz"}' ->> '$.a'; 3 | --output-- 4 | xyz 5 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/DockPanel.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/DockPanel.bmp -------------------------------------------------------------------------------- /scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | cd "$( dirname "${BASH_SOURCE[0]}" )" 4 | cd .. 5 | powershell.exe -NoProfile ps1/Clear-TempFiles.ps1 6 | -------------------------------------------------------------------------------- /scripts/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | cd "$( dirname "${BASH_SOURCE[0]}" )" 5 | cd .. 6 | 7 | powershell.exe -NoProfile "ps1/Update-Deps.ps1" 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/INSERT RETURNING.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (1, 2, 3) RETURNING *; 3 | --output-- 4 | a,b,c 5 | 1,2,3 6 | - 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE with one argument.sql: -------------------------------------------------------------------------------- 1 | EXECUTE Script2 @foo = 'bar'; 2 | --script-- 3 | DECLARE PARAMETER @foo; 4 | PRINT @foo; 5 | --output-- 6 | bar 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/WITH MATERIALIZED.sql: -------------------------------------------------------------------------------- 1 | WITH foo AS MATERIALIZED ( 2 | SELECT 1, 2, 3 3 | ) 4 | SELECT * FROM foo; 5 | --output-- 6 | 1,2,3 7 | 1,2,3 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/month-func.sql: -------------------------------------------------------------------------------- 1 | PRINT MONTH('2016-03-07'); -- "3" 2 | PRINT MONTH('2016-07-23 22:06:53.742 -04:00'); -- "7" 3 | 4 | --output-- 5 | 3 6 | 7 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE implicitly using default value.sql: -------------------------------------------------------------------------------- 1 | EXECUTE Script2; 2 | --script-- 3 | DECLARE PARAMETER @foo = 'bar'; 4 | PRINT @foo; 5 | --output-- 6 | bar 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/year-func.sql: -------------------------------------------------------------------------------- 1 | PRINT YEAR('2016-03-07'); -- "2016" 2 | PRINT YEAR('2015-07-23 22:06:53.742 -04:00'); -- "2015" 3 | --output-- 4 | 2016 5 | 2015 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/CREATE TABLE WITHOUT ROWID.sql: -------------------------------------------------------------------------------- 1 | -- Test parsing. 2 | CREATE TABLE foo (a INT PRIMARY KEY, b TEXT) WITHOUT ROWID; 3 | PRINT 'ok'; 4 | 5 | --output-- 6 | ok 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE with DEFAULT keyword.sql: -------------------------------------------------------------------------------- 1 | EXECUTE Script2 @foo = DEFAULT; 2 | --script-- 3 | DECLARE PARAMETER @foo = 'foo' 4 | PRINT @foo; 5 | --output-- 6 | foo 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/WITH NOT MATERIALIZED.sql: -------------------------------------------------------------------------------- 1 | WITH foo AS NOT MATERIALIZED ( 2 | SELECT 1, 2, 3 3 | ) 4 | SELECT * FROM foo; 5 | --output-- 6 | 1,2,3 7 | 1,2,3 8 | - 9 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_Dock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_Dock.png -------------------------------------------------------------------------------- /src/Tests/scripts/THROW.sql: -------------------------------------------------------------------------------- 1 | BEGIN TRY 2 | THROW 'Oops'; 3 | END TRY 4 | BEGIN CATCH 5 | PRINT ERROR_MESSAGE(); 6 | END CATCH 7 | 8 | --output-- 9 | Oops 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/json1 - Arrow operators 1.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/json1.html#jptr 2 | PRINT '{"a":2,"c":[4,5,{"f":7}]}' -> '$'; 3 | --output-- 4 | {"a":2,"c":[4,5,{"f":7}]} 5 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_Close.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_Option.png -------------------------------------------------------------------------------- /src/Tests/scripts/doc/is-numeric-func.sql: -------------------------------------------------------------------------------- 1 | PRINT ISNUMERIC('A'); -- "0" 2 | PRINT ISNUMERIC('123'); -- "1" 3 | PRINT ISNUMERIC(3.14); -- "1" 4 | 5 | --output-- 6 | 0 7 | 1 8 | 1 9 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_AutoHide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_AutoHide.png -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-concat-func.sql: -------------------------------------------------------------------------------- 1 | PRINT ARRAY_CONCAT(ARRAY('A', 'B', 'C')); -- "ABC" 2 | PRINT ARRAY_CONCAT(ARRAY(1, 2, 3), '-'); -- "1-2-3" 3 | --output-- 4 | ABC 5 | 1-2-3 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-func.sql: -------------------------------------------------------------------------------- 1 | DECLARE @data = ARRAY(111, 222, 333); 2 | PRINT ARRAY_GET(@data, 0); -- "111" 3 | PRINT ARRAY_GET(@data, 2); -- "333" 4 | --output-- 5 | 111 6 | 333 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/date-time-from-parts-func.sql: -------------------------------------------------------------------------------- 1 | -- Prints "2015-01-02 05:45:30.123". 2 | PRINT DATETIMEFROMPARTS(2015, 1, 2, 5, 45, 30, 123) 3 | --output-- 4 | 2015-01-02 05:45:30.123 5 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/ProjectSignKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/ProjectSignKey.snk -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelFill.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelTop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelTop.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_OptionOverflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockPane_OptionOverflow.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_Close.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_Dock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_Dock.png -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV duplicate header 1.sql: -------------------------------------------------------------------------------- 1 | IMPORT CSV '\duplicate-header.csv' INTO foo; 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | a,column2,b,b_2,b_3 7 | 1,2,3,4,5 8 | - 9 | -------------------------------------------------------------------------------- /web/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Error 5 | 6 | 7 |

There was a problem with your request.

8 | 9 | 10 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Sensors/ProjectSignKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Sensors/ProjectSignKey.snk -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/ProjectSignKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/ProjectSignKey.snk -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelRight.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/ActiveTab_Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/ActiveTab_Close.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_AutoHide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_AutoHide.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_Option.png -------------------------------------------------------------------------------- /src/SqlNotebookScript/Utils/IfConversionFails.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Utils; 2 | 3 | public enum IfConversionFails 4 | { 5 | ImportAsText = 1, 6 | SkipRow = 2, 7 | Abort = 3, 8 | } 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/ALTER TABLE DROP COLUMN 2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (1, 2, 3); 3 | ALTER TABLE foo DROP a; 4 | SELECT * FROM foo; 5 | --output-- 6 | b,c 7 | 2,3 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS STOP_AT_FIRST_BLANK_ROW default.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-blank-row.xlsx' INTO 'excel'; 2 | SELECT * FROM excel; 3 | --output-- 4 | a,b 5 | 111,222 6 | 333,444 7 | - 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/try-catch-stmt.sql: -------------------------------------------------------------------------------- 1 | -- Prints "Foo". 2 | BEGIN TRY 3 | THROW 'Foo'; 4 | END TRY 5 | BEGIN CATCH 6 | PRINT ERROR_MESSAGE(); 7 | END CATCH 8 | --output-- 9 | Foo 10 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/LostFocusTab_Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/LostFocusTab_Close.png -------------------------------------------------------------------------------- /src/SqlNotebookScript/SharedHttp.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | 3 | namespace SqlNotebookScript; 4 | 5 | public static class SharedHttp 6 | { 7 | public static HttpClient Client { get; } = new(); 8 | } 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/CREATE TABLE duplicate options.sql: -------------------------------------------------------------------------------- 1 | -- Test parsing. 2 | CREATE TABLE foo (a INT PRIMARY KEY, b TEXT) STRICT, STRICT, WITHOUT ROWID, WITHOUT ROWID; 3 | PRINT 'ok'; 4 | 5 | --output-- 6 | ok 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS duplicate header 1.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-duplicate-header.xlsx' INTO foo; 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | a,column2,b,b_2,b_3 7 | 1,2,3,4,5 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/phonetic-funcs-2.sql: -------------------------------------------------------------------------------- 1 | BEGIN TRY 2 | PRINT SOUNDEX('🙂'); 3 | END TRY 4 | BEGIN CATCH 5 | PRINT ERROR_MESSAGE(); 6 | END CATCH 7 | --output-- 8 | argument should be ASCII string 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/print-stmt.sql: -------------------------------------------------------------------------------- 1 | PRINT 5; 2 | PRINT 1 + 2; 3 | PRINT 'Hello world'; 4 | PRINT (SELECT COUNT(*) FROM sqlite_master); 5 | 6 | --output-- 7 | 5 8 | 3 9 | Hello world 10 | 0 11 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Left.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Right.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Top.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelFill_Active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelFill_Active.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft_Active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelLeft_Active.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelRight_Active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelRight_Active.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelTop_Active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelTop_Active.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/Dockindicator_PaneDiamond_Fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/Dockindicator_PaneDiamond_Fill.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/ActiveTabHover_Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/ActiveTabHover_Close.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelTop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelTop.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/InactiveTabHover_Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/InactiveTabHover_Close.png -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/BreakStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class BreakStmt : Stmt 4 | { 5 | protected override bool IsLeaf { get; } = true; 6 | } 7 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/DeclareStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class DeclareStmt : AssignmentStmt 4 | { 5 | public bool IsParameter { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/RethrowStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class RethrowStmt : Stmt 4 | { 5 | protected override bool IsLeaf { get; } = true; 6 | } 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/ALTER TABLE DROP COLUMN 1.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (1, 2, 3); 3 | ALTER TABLE foo DROP COLUMN a; 4 | SELECT * FROM foo; 5 | --output-- 6 | b,c 7 | 2,3 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT TEXT.sql: -------------------------------------------------------------------------------- 1 | IMPORT TEXT '\utf8.txt' INTO table1; 2 | SELECT * FROM table1; 3 | 4 | --output-- 5 | number,line 6 | 1,abc 7 | 2,def 8 | 3,ghi 9 | 4,jkl 10 | 5,mno 11 | - 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/choose-func.sql: -------------------------------------------------------------------------------- 1 | PRINT CHOOSE(1, 'A', 'B'); -- "A" 2 | DECLARE @x = CHOOSE(5, 111, 222); 3 | IF @x IS NULL 4 | PRINT 'Out of range!' -- Prints. 5 | --output-- 6 | A 7 | Out of range! 8 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Bottom.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_Hotspot.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom_Active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PanelBottom_Active.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelFill.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelLeft.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelRight.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_OptionOverflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockPane_OptionOverflow.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/LostFocusTabHover_Close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/LostFocusTabHover_Close.png -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ContinueStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class ContinueStmt : Stmt 4 | { 5 | protected override bool IsLeaf { get; } = true; 6 | } 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV missing header 1.sql: -------------------------------------------------------------------------------- 1 | IMPORT CSV '\missing-header.csv' INTO foo (A, B, C); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | A,B,C 7 | 111,333,555 8 | 666,888,0 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV missing header 2.sql: -------------------------------------------------------------------------------- 1 | IMPORT CSV '\missing-header.csv' INTO foo (C, B, A); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | C,B,A 7 | 555,333,111 8 | 0,888,666 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/RETURN from EXECUTE.sql: -------------------------------------------------------------------------------- 1 | PRINT 'a' 2 | EXECUTE Script2; 3 | PRINT 'c' 4 | --script-- 5 | PRINT 'b' 6 | RETURN; 7 | PRINT 'z'; -- should not execute 8 | --output-- 9 | a 10 | b 11 | c 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Clarity of presentation 1.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE tab1 (a, b); 3 | 4 | UPDATE tab1 SET (a,b)=(b,a); 5 | UPDATE tab1 SET a=b, b=a; 6 | 7 | --output-- 8 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/ShellExtensions/ProjectSignKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/Windows-API-Code-Pack/source/WindowsAPICodePack/ShellExtensions/ProjectSignKey.snk -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PaneDiamond1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PaneDiamond1.bmp -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelBottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PanelBottom.png -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/Dockindicator_PaneDiamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/Dockindicator_PaneDiamond.png -------------------------------------------------------------------------------- /src/Tests/scripts/ALTER TABLE RENAME COLUMN 2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (1, 2, 3); 3 | ALTER TABLE foo RENAME a TO aaa; 4 | SELECT * FROM foo; 5 | --output-- 6 | aaa,b,c 7 | 1,2,3 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/DECLARE_test.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a; 2 | DECLARE @b; 3 | DECLARE @c; 4 | SET @a = 1; 5 | SET @b = 2; 6 | SET @c = 3; 7 | PRINT @a; 8 | PRINT @b; 9 | PRINT @c; 10 | 11 | --output-- 12 | 1 13 | 2 14 | 3 -------------------------------------------------------------------------------- /src/Tests/scripts/HAVING without GROUP BY.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE a (c1, c2); 2 | INSERT INTO a VALUES (1, 2); 3 | 4 | SELECT MAX(c1) AS max 5 | FROM a 6 | HAVING c2 > 0 7 | 8 | --output-- 9 | max 10 | 1 11 | - 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV duplicate header 2.sql: -------------------------------------------------------------------------------- 1 | IMPORT CSV '\duplicate-header.csv' INTO foo (a, column2, b, b_2, b_3); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | a,column2,b,b_2,b_3 7 | 1,2,3,4,5 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS missing header 1.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-missing-header.xlsx' INTO foo (A, B, C); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | A,B,C 7 | 111,333,555 8 | 666,888,0 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS missing header 2.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-missing-header.xlsx' INTO foo (C, B, A); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | C,B,A 7 | 555,333,111 8 | 0,888,666 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/THROW from sub-script.sql: -------------------------------------------------------------------------------- 1 | BEGIN TRY 2 | EXECUTE Script2; 3 | END TRY 4 | BEGIN CATCH 5 | PRINT ERROR_MESSAGE(); 6 | END CATCH 7 | --script-- 8 | THROW 'Oops'; 9 | --output-- 10 | Oops 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/download-func.sql: -------------------------------------------------------------------------------- 1 | -- Prints "Sitemap: https://sqlnotebook.com/sitemap.txt" 2 | PRINT DOWNLOAD('https://sqlnotebook.com/robots.txt') 3 | --output-- 4 | Sitemap: https://sqlnotebook.com/sitemap.txt 5 | 6 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/string-distance-funcs-1.sql: -------------------------------------------------------------------------------- 1 | PRINT LEVENSHTEIN('pickle', 'pickle'); -- 0 2 | PRINT LEVENSHTEIN('pickle', 'tickle'); -- 1 3 | PRINT LEVENSHTEIN('pickle', 'stick'); -- 4 4 | --output-- 5 | 0 6 | 1 7 | 4 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/uuid-blob-func.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = UUID_BLOB('A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11'); 2 | SELECT TYPEOF(@a), @a; 3 | 4 | --output-- 5 | TYPEOF ( @a ),@a 6 | blob,[A0EEBC999C0B4EF8BB6D6BB9BD380A11] 7 | - 8 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex.png -------------------------------------------------------------------------------- /src/Tests/scripts/ALTER TABLE RENAME COLUMN 1.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (1, 2, 3); 3 | ALTER TABLE foo RENAME COLUMN a TO aaa; 4 | SELECT * FROM foo; 5 | --output-- 6 | aaa,b,c 7 | 1,2,3 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/FOREACH_debug.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMP TABLE test_table (value INTEGER); 2 | INSERT INTO test_table VALUES (42); 3 | DECLARE @x; 4 | FOREACH (@x) IN test_table BEGIN 5 | PRINT @x; 6 | END 7 | 8 | --output-- 9 | 42 -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-merge-func.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = ARRAY(111, 222); 2 | DECLARE @b = ARRAY(333, 444); 3 | DECLARE @c = ARRAY_MERGE(@a, @b); 4 | PRINT @c; -- "[111, 222, 333, 444]" 5 | --output-- 6 | [111, 222, 333, 444] 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/date-part-func.sql: -------------------------------------------------------------------------------- 1 | PRINT DATEPART('month', '2016-07-23'); -- "7" 2 | PRINT DATEPART('weekday', '2016-07-23'); -- "6" 3 | PRINT DATEPART('dd', '2016-07-23'); -- "23" 4 | --output-- 5 | 7 6 | 6 7 | 23 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/error-message-func.sql: -------------------------------------------------------------------------------- 1 | -- Prints "Message". 2 | BEGIN TRY 3 | THROW 'Message'; 4 | END TRY 5 | BEGIN CATCH 6 | PRINT ERROR_MESSAGE(); 7 | END CATCH; 8 | --output-- 9 | Message 10 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/Dockindicator_PaneDiamond_Fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/Dockindicator_PaneDiamond_Fill.png -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS STOP_AT_FIRST_BLANK_ROW 1.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-blank-row.xlsx' INTO 'excel' OPTIONS (STOP_AT_FIRST_BLANK_ROW: 1); 2 | SELECT * FROM excel; 3 | --output-- 4 | a,b 5 | 111,222 6 | 333,444 7 | - 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS duplicate header 2.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-duplicate-header.xlsx' INTO foo (a, column2, b, b_2, b_3); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | a,column2,b,b_2,b_3 7 | 1,2,3,4,5 8 | - 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-get-func.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = ARRAY(1, 2, 3); 2 | PRINT ARRAY_GET(@a, 2); -- "3" 3 | DECLARE @b = ARRAY_GET(@a, 10); -- @b is NULL 4 | IF @b IS NULL PRINT 'Null!'; -- Prints. 5 | --output-- 6 | 3 7 | Null! 8 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/Dockindicator_PaneDiamond_Hotspot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/Dockindicator_PaneDiamond_Hotspot.png -------------------------------------------------------------------------------- /scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | cd "$( dirname "${BASH_SOURCE[0]}" )" 5 | PLATFORM=$(./get-native-arch.sh) 6 | RID="win-${PLATFORM,,}" 7 | "../src/SqlNotebook/bin/$PLATFORM/Debug/net9.0-windows/$RID/SqlNotebook.exe" 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV missing header 3.sql: -------------------------------------------------------------------------------- 1 | IMPORT CSV '\missing-header.csv' INTO foo; 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | A,column2,B,column4,C 7 | 111,222,333,444,555 8 | 666,777,888,999,0 9 | - 10 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/ExtendedLinguisticServices/ProjectSignKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/Windows-API-Code-Pack/source/WindowsAPICodePack/ExtendedLinguisticServices/ProjectSignKey.snk -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex_VS2012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/Docking/Resources/DockIndicator_PaneDiamond_HotspotIndex_VS2012.png -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/TypeConversion.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public enum TypeConversion 4 | { 5 | Text, 6 | Integer, 7 | Real, 8 | Date, 9 | DateTime, 10 | } 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-set-func.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = ARRAY(111, 222, 333); 2 | DECLARE @b = ARRAY_SET(@a, 2, 999); 3 | PRINT @a; -- "[111, 222, 333]" 4 | PRINT @b; -- "[111, 222, 999]" 5 | --output-- 6 | [111, 222, 333] 7 | [111, 222, 999] 8 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PaneDiamond_HotspotIndex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brianluft/sqlnotebook/HEAD/ext/dockpanelsuite/WinFormsUI/ThemeVS2012Light/Resources/DockIndicator_PaneDiamond_HotspotIndex.png -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/GenericModules/GenericTableMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Core.GenericModules; 2 | 3 | public record class GenericTableMetadata 4 | { 5 | public CustomTableFunction CustomTableFunction { get; init; } 6 | } 7 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/Script.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class Script : Node 4 | { 5 | public Block Block { get; set; } 6 | 7 | protected override Node GetChild() => Block; 8 | } 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS missing header 3.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-missing-header.xlsx' INTO foo; 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | A,column2,B,column4,C 7 | 111,222,333,444,555 8 | 666,777,888,999,0 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/math-funcs.sql: -------------------------------------------------------------------------------- 1 | PRINT POW(2, 5); -- "32" 2 | PRINT SIN(3.14 / 2); -- "0.9999996829318346" 3 | PRINT CEILING(-1.6); -- "-1" 4 | PRINT ROUND(5.5); -- "6" 5 | --output-- 6 | 32 7 | 0.9999996829318346 8 | -1 9 | 6 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/split-func.sql: -------------------------------------------------------------------------------- 1 | PRINT SPLIT('AAA|BBB|CCC', '|', 1); -- "BBB" 2 | PRINT SPLIT('AAA|BBB|CCC', '|', 5); -- NULL 3 | PRINT SPLIT('AAA|BBB|CCC', '|'); -- "[AAA, BBB, CCC]" 4 | 5 | --output-- 6 | BBB 7 | 8 | [AAA, BBB, CCC] 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXECUTE one explicit, one default argument.sql: -------------------------------------------------------------------------------- 1 | EXECUTE Script2 @foo = 'foo'; 2 | --script-- 3 | DECLARE PARAMETER @foo; 4 | DECLARE PARAMETER @bar = 'bar'; 5 | PRINT @foo; 6 | PRINT @bar; 7 | --output-- 8 | foo 9 | bar 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/gencol 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/gencol.html 2 | CREATE TABLE t1( 3 | a INTEGER PRIMARY KEY, 4 | b INT, 5 | c TEXT, 6 | d INT AS (a*abs(b)), 7 | e TEXT AS (substr(c,b,b+1)) STORED 8 | ); 9 | --output-- 10 | -------------------------------------------------------------------------------- /src/SqlNotebookDb/SqlNotebookDb.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/BlockStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class BlockStmt : Stmt 4 | { 5 | public Block Block { get; set; } 6 | 7 | protected override Node GetChild() => Block; 8 | } 9 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ReturnStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class ReturnStmt : Stmt 4 | { 5 | public Expr Value { get; set; } 6 | 7 | protected override Node GetChild() => Value; 8 | } 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/is-date-func.sql: -------------------------------------------------------------------------------- 1 | PRINT ISDATE('2016-03-07'); -- "1" 2 | PRINT ISDATE(1234); -- "0" 3 | PRINT ISDATE('foo'); -- "0" 4 | PRINT ISDATE('2016-01-23 22:06:53.742 -04:00'); -- "1" 5 | 6 | --output-- 7 | 1 8 | 0 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-insert-func.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = ARRAY(111, 222, 333); 2 | DECLARE @b = ARRAY_INSERT(@a, 2, 999); 3 | PRINT @a; -- "[111, 222, 333]" 4 | PRINT @b; -- "[111, 222, 999, 333]" 5 | --output-- 6 | [111, 222, 333] 7 | [111, 222, 999, 333] 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/string-distance-funcs-2.sql: -------------------------------------------------------------------------------- 1 | BEGIN TRY 2 | PRINT LEVENSHTEIN('pickle', '🙂stick'); -- error: non-ASCII string 3 | END TRY 4 | BEGIN CATCH 5 | PRINT ERROR_MESSAGE(); 6 | END CATCH 7 | --output-- 8 | arguments should be ASCII strings 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV missing header 4.sql: -------------------------------------------------------------------------------- 1 | IMPORT CSV '\missing-header.csv' INTO foo (A, column2, B, column4, C); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | A,column2,B,column4,C 7 | 111,222,333,444,555 8 | 666,777,888,999,0 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS STOP_AT_FIRST_BLANK_ROW 0.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-blank-row.xlsx' INTO 'excel' OPTIONS (STOP_AT_FIRST_BLANK_ROW: 0); 2 | SELECT * FROM excel; 3 | --output-- 4 | a,b 5 | 111,222 6 | 333,444 7 | null,null 8 | 555,666 9 | - 10 | -------------------------------------------------------------------------------- /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "csharpier": { 6 | "version": "1.0.2", 7 | "commands": [ 8 | "csharpier" 9 | ], 10 | "rollForward": false 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ArgumentPair.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class ArgumentPair 4 | { 5 | public string Name { get; set; } 6 | public Expr Value { get; set; } // may be null to indicate 'DEFAULT' 7 | } 8 | -------------------------------------------------------------------------------- /src/Tests/scripts/Aggregate function filter clause.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (111, 222, 333), (444, 555, 666); 3 | 4 | SELECT COUNT(*) FILTER (WHERE a = 111) AS count 5 | FROM foo; 6 | 7 | --output-- 8 | count 9 | 1 10 | - 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/GETDATE.sql: -------------------------------------------------------------------------------- 1 | -- 2016-07-23 22:12:55.652 2 | DECLARE @a = GETDATE(); 3 | PRINT LENGTH(@a); 4 | PRINT SUBSTR(@a, 1, 2); -- First two digits of the year (20) 5 | PRINT SUBSTR(@a, 5, 1); -- Dash after the year 6 | --output-- 7 | 23 8 | 20 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS missing header 4.sql: -------------------------------------------------------------------------------- 1 | IMPORT XLS '\excel-missing-header.xlsx' INTO foo (A, column2, B, column4, C); 2 | 3 | SELECT * FROM foo; 4 | 5 | --output-- 6 | A,column2,B,column4,C 7 | 111,222,333,444,555 8 | 666,777,888,999,0 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/GETUTCDATE.sql: -------------------------------------------------------------------------------- 1 | -- 2016-07-23 22:12:55.652 2 | DECLARE @a = GETUTCDATE(); 3 | PRINT LENGTH(@a); 4 | PRINT SUBSTR(@a, 1, 2); -- First two digits of the year (20) 5 | PRINT SUBSTR(@a, 5, 1); -- Dash after the year 6 | --output-- 7 | 23 8 | 20 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/array-append-func.sql: -------------------------------------------------------------------------------- 1 | DECLARE @a = ARRAY(111, 222, 333); 2 | DECLARE @b = ARRAY_APPEND(@a, 999, 1000); 3 | PRINT @a; -- "[111, 222, 333]" 4 | PRINT @b; -- "[111, 222, 333, 999, 1000]" 5 | --output-- 6 | [111, 222, 333] 7 | [111, 222, 333, 999, 1000] 8 | -------------------------------------------------------------------------------- /src/SqlNotebook/IDocumentControl.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebook; 2 | 3 | public interface IDocumentControl 4 | { 5 | string ItemName { get; set; } 6 | void Save(); 7 | } 8 | 9 | public interface IDocumentControlOpenNotification 10 | { 11 | void OnOpen(); 12 | } 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/THROW rethrow.sql: -------------------------------------------------------------------------------- 1 | BEGIN TRY 2 | BEGIN TRY 3 | THROW 'Oops'; 4 | END TRY 5 | BEGIN CATCH 6 | THROW; 7 | END CATCH 8 | END TRY 9 | BEGIN CATCH 10 | PRINT ERROR_MESSAGE(); 11 | END CATCH 12 | 13 | --output-- 14 | Oops 15 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/lang_upsert - Examples 1.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/lang_upsert.html 2 | CREATE TABLE vocabulary(word TEXT PRIMARY KEY, count INT DEFAULT 1); 3 | INSERT INTO vocabulary(word) VALUES('jovial') 4 | ON CONFLICT(word) DO UPDATE SET count=count+1; 5 | 6 | --output-- 7 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/SaveStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class SaveStmt : Stmt 4 | { 5 | public IdentifierOrExpr FilenameExpr { get; set; } // may be null 6 | 7 | protected override Node GetChild() => FilenameExpr; 8 | } 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/gencol 1.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/gencol.html 2 | CREATE TABLE t1( 3 | a INTEGER PRIMARY KEY, 4 | b INT, 5 | c TEXT, 6 | d INT GENERATED ALWAYS AS (a*abs(b)) VIRTUAL, 7 | e TEXT GENERATED ALWAYS AS (substr(c,b,b+1)) STORED 8 | ); 9 | --output-- 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/lang_upsert - Parsing Ambiguity.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/lang_upsert.html 2 | CREATE TABLE t1 (x PRIMARY KEY, y); 3 | CREATE TABLE t2 (x PRIMARY KEY, y); 4 | 5 | INSERT INTO t1 SELECT * FROM t2 WHERE true 6 | ON CONFLICT(x) DO UPDATE SET y=excluded.y; 7 | 8 | --output-- 9 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Row Value Comparisons 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE t1(a,b,c); 3 | INSERT INTO t1(a,b,c) VALUES(1,2,3); 4 | SELECT (1,2,3)=(SELECT * FROM t1); -- 1 5 | 6 | --output-- 7 | ( 1 , 2 , 3 ) = ( SELECT * FROM t1 ) 8 | 1 9 | - 10 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/PrintStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class PrintStmt : Stmt 4 | { 5 | public Expr Value { get; set; } 6 | 7 | protected override Node GetChild() 8 | { 9 | return Value; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/stricttables - The ANY datatype 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/stricttables.html 2 | CREATE TABLE t1(a ANY); 3 | INSERT INTO t1 VALUES('000123'); 4 | SELECT typeof(a), quote(a) FROM t1; 5 | -- result: integer 123 6 | --output-- 7 | typeof ( a ),quote ( a ) 8 | integer,123 9 | - 10 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/SqliteException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SqlNotebookScript.Core; 4 | 5 | public sealed class SqliteException : Exception 6 | { 7 | public string Snippet { get; set; } 8 | 9 | public SqliteException(string message) 10 | : base(message) { } 11 | } 12 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ThrowStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class ThrowStmt : Stmt 4 | { 5 | public bool HasErrorValues { get; set; } 6 | public Expr Message { get; set; } 7 | 8 | protected override Node GetChild() => Message; 9 | } 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS FIRST_COLUMN no column range.sql: -------------------------------------------------------------------------------- 1 | -- No column range 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table1; 3 | SELECT * FROM table1; 4 | 5 | --output-- 6 | first,second,third,fourth 7 | A,1,0,111 8 | B,2,1,222 9 | C,3,10,333 10 | D,4,11,444 11 | E,5,100,555 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/JSON_GROUP_ARRAY.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT); 2 | 3 | INSERT INTO test (value) VALUES ('apple'), ('banana'), ('cherry'); 4 | 5 | SELECT json_group_array(value) AS json_array FROM test; 6 | --output-- 7 | json_array 8 | ["apple","banana","cherry"] 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/RIGHT JOIN.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE a (c1, c2); 2 | INSERT INTO a VALUES (1, 2); 3 | 4 | CREATE TABLE b (c3, c4); 5 | INSERT INTO b VALUES (1, 3); 6 | 7 | SELECT a.c1, a.c2, b.c3, b.c4 8 | FROM a 9 | RIGHT JOIN b ON a.c1 = b.c3; 10 | 11 | --output-- 12 | c1,c2,c3,c4 13 | 1,2,1,3 14 | - 15 | -------------------------------------------------------------------------------- /src/Tests/scripts/STRING_AGG.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT); 2 | 3 | INSERT INTO test (value) VALUES ('apple'), ('banana'), ('cherry'); 4 | 5 | SELECT string_agg(value, ', ') AS aggregated_string FROM test; 6 | --output-- 7 | aggregated_string 8 | apple, banana, cherry 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/to-date-func.sql: -------------------------------------------------------------------------------- 1 | PRINT TO_DATE('2016/5/9 5:39 PM'); 2 | 3 | BEGIN TRY 4 | PRINT TO_DATE('foobar') 5 | END TRY 6 | BEGIN CATCH 7 | PRINT ERROR_MESSAGE(); 8 | END CATCH 9 | 10 | --output-- 11 | 2016-05-09 12 | TO_DATE: The "input" argument must be a valid date string. 13 | -------------------------------------------------------------------------------- /src/SqlNotebook/Import/ColumnHeadersOption.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace SqlNotebook.Import; 4 | 5 | public enum ColumnHeadersOption 6 | { 7 | [Description("Cell range includes headers")] 8 | Present, 9 | 10 | [Description("No column headers")] 11 | NotPresent, 12 | } 13 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/ScriptException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SqlNotebookScript.Interpreter; 4 | 5 | public class ScriptException : Exception 6 | { 7 | public ScriptException(string message, Exception innerException = null) 8 | : base(message, innerException) { } 9 | } 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV SELECT.sql: -------------------------------------------------------------------------------- 1 | EXPORT CSV '\file.csv' FROM ( 2 | SELECT 111 AS a, 222 AS b, 333 AS c 3 | UNION ALL 4 | SELECT 'AAA', 'BBB', 'CCC' 5 | ); 6 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 7 | --output-- 8 | [a,b,c 9 | 111,222,333 10 | AAA,BBB,CCC 11 | ] 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/stricttables - The ANY datatype 1.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/stricttables.html 2 | CREATE TABLE t1(a ANY) STRICT; 3 | INSERT INTO t1 VALUES('000123'); 4 | SELECT typeof(a), quote(a) FROM t1; 5 | -- result: text '000123' 6 | --output-- 7 | typeof ( a ),quote ( a ) 8 | text,'000123' 9 | - 10 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/Expr.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public sealed class Expr : Node 4 | { 5 | public string Sql { get; set; } 6 | public SqliteSyntaxProduction SqliteSyntax { get; set; } 7 | 8 | protected override Node GetChild() => SqliteSyntax; 9 | } 10 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Token.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript; 2 | 3 | public sealed class Token 4 | { 5 | public TokenType Type; 6 | public string Text; 7 | 8 | public override string ToString() => $"{Type}: \"{Text}\""; 9 | 10 | public ulong Utf8Start; 11 | public ulong Utf8Length; 12 | } 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV TABLE.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 3 | EXPORT CSV '\file.csv' FROM TABLE foo; 4 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 5 | 6 | --output-- 7 | [a,b,c 8 | 111,222,333 9 | AAA,BBB,CCC 10 | ] 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/FULL OUTER JOIN.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE a (c1, c2); 2 | INSERT INTO a VALUES (1, 2); 3 | 4 | CREATE TABLE b (c3, c4); 5 | INSERT INTO b VALUES (1, 3); 6 | 7 | SELECT a.c1, a.c2, b.c3, b.c4 8 | FROM a 9 | FULL OUTER JOIN b ON a.c1 = b.c3; 10 | 11 | --output-- 12 | c1,c2,c3,c4 13 | 1,2,1,3 14 | - 15 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/lang_upsert - Examples 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/lang_upsert.html 2 | CREATE TABLE phonebook(name TEXT PRIMARY KEY, phonenumber TEXT); 3 | INSERT INTO phonebook(name,phonenumber) VALUES('Alice','704-555-1212') 4 | ON CONFLICT(name) DO UPDATE SET phonenumber=excluded.phonenumber; 5 | 6 | --output-- 7 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/while-stmt.sql: -------------------------------------------------------------------------------- 1 | -- Prints the numbers 1 to 10 in increasing order. 2 | DECLARE @counter = 1; 3 | WHILE @counter <= 10 BEGIN 4 | PRINT @counter; 5 | SET @counter = @counter + 1; 6 | END 7 | 8 | --output-- 9 | 1 10 | 2 11 | 3 12 | 4 13 | 5 14 | 6 15 | 7 16 | 8 17 | 9 18 | 10 19 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV SCRIPT.sql: -------------------------------------------------------------------------------- 1 | EXPORT CSV '\file.csv' FROM SCRIPT Script2; 2 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 3 | --script-- 4 | SELECT 111 AS a, 222 AS b, 333 AS c 5 | UNION ALL 6 | SELECT 'AAA', 'BBB', 'CCC'; 7 | --output-- 8 | [a,b,c 9 | 111,222,333 10 | AAA,BBB,CCC 11 | ] 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS FIRST_COLUMN first and last, number.sql: -------------------------------------------------------------------------------- 1 | -- Both first and last column 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table5 OPTIONS (FIRST_COLUMN: 2, LAST_COLUMN: 3); 3 | SELECT * FROM table5; 4 | 5 | --output-- 6 | second,third 7 | 1,0 8 | 2,1 9 | 3,10 10 | 4,11 11 | 5,100 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS LAST_COLUMN last column only.sql: -------------------------------------------------------------------------------- 1 | -- Last column but no first column 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table1 OPTIONS (LAST_COLUMN: 3); 3 | SELECT * FROM table1; 4 | 5 | --output-- 6 | first,second,third 7 | A,1,0 8 | B,2,1 9 | C,3,10 10 | D,4,11 11 | E,5,100 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/RIGHT OUTER JOIN.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE a (c1, c2); 2 | INSERT INTO a VALUES (1, 2); 3 | 4 | CREATE TABLE b (c3, c4); 5 | INSERT INTO b VALUES (1, 3); 6 | 7 | SELECT a.c1, a.c2, b.c3, b.c4 8 | FROM a 9 | RIGHT OUTER JOIN b ON a.c1 = b.c3; 10 | 11 | --output-- 12 | c1,c2,c3,c4 13 | 1,2,1,3 14 | - 15 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/break-stmt.sql: -------------------------------------------------------------------------------- 1 | -- Prints the numbers 1 to 10. 2 | DECLARE @counter = 1; 3 | WHILE 1 BEGIN 4 | PRINT @counter; 5 | SET @counter = @counter + 1; 6 | IF @counter > 10 7 | BREAK; 8 | END 9 | --output-- 10 | 1 11 | 2 12 | 3 13 | 4 14 | 5 15 | 6 16 | 7 17 | 8 18 | 9 19 | 10 20 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS FIRST_COLUMN first and last, letter.sql: -------------------------------------------------------------------------------- 1 | -- Both first and last column 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table4 OPTIONS (FIRST_COLUMN: 'B', LAST_COLUMN: 'C'); 3 | SELECT * FROM table4; 4 | 5 | --output-- 6 | second,third 7 | 1,0 8 | 2,1 9 | 3,10 10 | 4,11 11 | 5,100 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/IN table-valued function.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/releaselog/3_14.html 2 | -- "Allow table-valued functions to appear on the right-hand side of an IN operator." 3 | SELECT value FROM generate_series(1, 5) WHERE value NOT IN generate_series(1, 2); 4 | 5 | --output-- 6 | value 7 | 3 8 | 4 9 | 5 10 | - 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Clarity of presentation 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE tab1 (a, b); 3 | 4 | DECLARE @a = 1; 5 | DECLARE @b = 2; 6 | 7 | SELECT * FROM tab1 WHERE a=@a AND b=@b; 8 | SELECT * FROM tab1 WHERE (a,b)=(@a,@b); 9 | 10 | --output-- 11 | a,b 12 | - 13 | a,b 14 | - 15 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/Block.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class Block : Node 6 | { 7 | public List Statements = new List(); 8 | 9 | protected override IEnumerable GetChildren() => Statements; 10 | } 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS LAST_COLUMN 0, all columns.sql: -------------------------------------------------------------------------------- 1 | -- 0 = all columns 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table3 OPTIONS (LAST_COLUMN: 0); 3 | SELECT * FROM table3; 4 | 5 | --output-- 6 | first,second,third,fourth 7 | A,1,0,111 8 | B,2,1,222 9 | C,3,10,333 10 | D,4,11,444 11 | E,5,100,555 12 | - 13 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/SqliteInterop/Sqlite3IndexOrderBy.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SqlNotebookScript.Core.SqliteInterop; 4 | 5 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 6 | public struct Sqlite3IndexOrderBy 7 | { 8 | public int iColumn; 9 | public byte desc; 10 | } 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV HEADER_ROW 0.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 3 | EXPORT CSV '\file.csv' FROM TABLE foo OPTIONS (HEADER_ROW: 0); 4 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 5 | 6 | --output-- 7 | [111,222,333 8 | AAA,BBB,CCC 9 | ] 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/continue-stmt.sql: -------------------------------------------------------------------------------- 1 | -- Prints the odd numbers from 1 to 9. 2 | DECLARE @counter = 0; 3 | WHILE @counter < 10 BEGIN 4 | SET @counter = @counter + 1; 5 | IF @counter % 2 = 0 -- True for even numbers. 6 | CONTINUE; 7 | PRINT @counter; 8 | END 9 | --output-- 10 | 1 11 | 3 12 | 5 13 | 7 14 | 9 15 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/to-date-time-func.sql: -------------------------------------------------------------------------------- 1 | PRINT TO_DATETIME('2016/5/9 5:39 PM'); 2 | 3 | BEGIN TRY 4 | PRINT TO_DATETIME('foobar') 5 | END TRY 6 | BEGIN CATCH 7 | PRINT ERROR_MESSAGE(); 8 | END CATCH 9 | 10 | --output-- 11 | 2016-05-09 17:39:00.000 12 | TO_DATETIME: The "input" argument must be a valid date string. 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS FIRST_COLUMN first column only, number.sql: -------------------------------------------------------------------------------- 1 | -- First column but no last column 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table3 OPTIONS (FIRST_COLUMN: 2); 3 | SELECT * FROM table3; 4 | 5 | --output-- 6 | second,third,fourth 7 | 1,0,111 8 | 2,1,222 9 | 3,10,333 10 | 4,11,444 11 | 5,100,555 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/JSON_GROUP_ARRAY with ORDER BY.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT); 2 | 3 | INSERT INTO test (value) VALUES ('apple'), ('banana'), ('cherry'); 4 | 5 | SELECT json_group_array(value ORDER BY value DESC) AS json_array FROM test; 6 | --output-- 7 | json_array 8 | ["cherry","banana","apple"] 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/STRING_AGG with ORDER BY.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT); 2 | 3 | INSERT INTO test (value) VALUES ('apple'), ('banana'), ('cherry'); 4 | 5 | SELECT string_agg(value, ', ' ORDER BY value ASC) AS aggregated_string FROM test; 6 | --output-- 7 | aggregated_string 8 | apple, banana, cherry 9 | - 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/eomonth-func.sql: -------------------------------------------------------------------------------- 1 | PRINT EOMONTH('2016-03-07'); -- "2016-03-31" 2 | PRINT EOMONTH('2016-03-07', 1); -- "2016-04-30" 3 | PRINT EOMONTH('2016-03-07', -1); -- "2016-02-29" 4 | PRINT EOMONTH('2016-01-23 22:06:53.742 -04:00'); -- "2016-01-31" 5 | --output-- 6 | 2016-03-31 7 | 2016-04-30 8 | 2016-02-29 9 | 2016-01-31 10 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/AssignmentStmt.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | public abstract class AssignmentStmt : Stmt 4 | { 5 | public string VariableName { get; set; } 6 | public Expr InitialValue { get; set; } // may be null 7 | 8 | protected override Node GetChild() => InitialValue; 9 | } 10 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV HEADER_ROW 1.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 3 | EXPORT CSV '\file.csv' FROM TABLE foo OPTIONS (HEADER_ROW: 1); 4 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 5 | 6 | --output-- 7 | [a,b,c 8 | 111,222,333 9 | AAA,BBB,CCC 10 | ] 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS FIRST_COLUMN first column only, letter.sql: -------------------------------------------------------------------------------- 1 | -- First column but no last column 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table2 OPTIONS (FIRST_COLUMN: 'B'); 3 | SELECT * FROM table2; 4 | 5 | --output-- 6 | second,third,fourth 7 | 1,0,111 8 | 2,1,222 9 | 3,10,333 10 | 4,11,444 11 | 5,100,555 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV SEPARATOR semicolon.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b, c); 2 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 3 | EXPORT CSV '\file.csv' FROM TABLE foo OPTIONS (SEPARATOR: ';') 4 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 5 | 6 | --output-- 7 | [a;b;c 8 | 111;222;333 9 | AAA;BBB;CCC 10 | ] 11 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/DummyControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace WeifenLuo.WinFormsUI.Docking 5 | { 6 | internal class DummyControl : Control 7 | { 8 | public DummyControl() 9 | { 10 | SetStyle(ControlStyles.Selectable, false); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/ThemeBase.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace WeifenLuo.WinFormsUI.Docking 4 | { 5 | public abstract class ThemeBase : Component, ITheme 6 | { 7 | public DockPanelSkin Skin { get; protected set; } 8 | 9 | public abstract void Apply(DockPanel dockPanel); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/SqliteInterop/Sqlite3IndexConstraintUsage.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SqlNotebookScript.Core.SqliteInterop; 4 | 5 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 6 | public struct Sqlite3IndexConstraintUsage 7 | { 8 | public int argvIndex; 9 | public byte omit; 10 | } 11 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/DropPageStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class DropPageStmt : Stmt 6 | { 7 | public IdentifierOrExpr PageName { get; set; } 8 | 9 | protected override IEnumerable GetChildren() => new Node[] { PageName }; 10 | } 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT TXT.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b); 2 | INSERT INTO foo VALUES ('hello', 'world'), ('aaa', 'bbb'); 3 | 4 | EXPORT TXT '\file.txt' 5 | FROM (SELECT * FROM foo); 6 | 7 | IMPORT TXT '\file.txt' INTO foo2 (num, line); 8 | 9 | SELECT * FROM foo2; 10 | --output-- 11 | num,line 12 | 1,helloworld 13 | 2,aaabbb 14 | - 15 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/DropScriptStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class DropScriptStmt : Stmt 6 | { 7 | public IdentifierOrExpr ScriptName { get; set; } 8 | 9 | protected override IEnumerable GetChildren() => new Node[] { ScriptName }; 10 | } 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/lang_returning - Typical Use.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/lang_returning.html 2 | CREATE TABLE t0( 3 | a INTEGER PRIMARY KEY, 4 | b DATE DEFAULT '2021-11-29 07:22:09', 5 | c INTEGER 6 | ); 7 | INSERT INTO t0(c) VALUES(5065768651967773830) RETURNING *; 8 | --output-- 9 | a,b,c 10 | 1,2021-11-29 07:22:09,5065768651967773830 11 | - 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Search against multi-column keys 3.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE item (ordid, prodid, qty); 3 | 4 | SELECT t1.ordid, t1.prodid, t1.qty 5 | FROM item AS t1, item AS t2 6 | WHERE (t1.prodid,t1.qty) = (t2.prodid,t2.qty) 7 | AND t2.ordid=365; 8 | 9 | --output-- 10 | ordid,prodid,qty 11 | - 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS LAST_COLUMN last beyond end of data.sql: -------------------------------------------------------------------------------- 1 | -- Last column is beyond the end of the data 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table2 OPTIONS (LAST_COLUMN: 200); 3 | SELECT * FROM table2; 4 | 5 | --output-- 6 | first,second,third,fourth 7 | A,1,0,111 8 | B,2,1,222 9 | C,3,10,333 10 | D,4,11,444 11 | E,5,100,555 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Search against multi-column keys 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE item (ordid, prodid, qty); 3 | 4 | SELECT t1.ordid, t1.prodid, t1.qty 5 | FROM item AS t1, item AS t2 6 | WHERE t1.prodid=t2.prodid 7 | AND t1.qty=t2.qty 8 | AND t2.ordid=365; 9 | 10 | --output-- 11 | ordid,prodid,qty 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/date-name-func.sql: -------------------------------------------------------------------------------- 1 | -- The following examples assume a US English computer. 2 | -- In other locales, DATENAME() will return locale-specific names. 3 | PRINT DATENAME('month', '2016-07-23'); -- "July" 4 | PRINT DATENAME('weekday', '2016-07-23'); -- "Saturday" 5 | PRINT DATENAME('dd', '2016-07-23'); -- "23" 6 | --output-- 7 | July 8 | Saturday 9 | 23 10 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Measures.cs: -------------------------------------------------------------------------------- 1 | namespace WeifenLuo.WinFormsUI.Docking 2 | { 3 | public static class Measures 4 | { 5 | public static int SplitterSize = 4; 6 | public const int AutoHideTabLineWidth = 6; 7 | } 8 | 9 | internal static class MeasurePane 10 | { 11 | public const int MinSize = 24; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/WhileStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class WhileStmt : Stmt 6 | { 7 | public Expr Condition { get; set; } 8 | public Block Block { get; set; } 9 | 10 | protected override IEnumerable GetChildren() => new Node[] { Condition, Block }; 11 | } 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/FOREACH_two_vars.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMP TABLE test_table (id INTEGER, name TEXT); 2 | INSERT INTO test_table VALUES (1, 'Alice'); 3 | INSERT INTO test_table VALUES (2, 'Bob'); 4 | -- Variables auto-declared by FOREACH 5 | FOREACH (@id, @name) IN test_table BEGIN 6 | PRINT CONCAT(@name, ' has ID ', @id); 7 | END 8 | 9 | --output-- 10 | Alice has ID 1 11 | Bob has ID 2 -------------------------------------------------------------------------------- /src/SqlNotebook/Pages/AddBlockEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebook.Pages; 2 | 3 | public sealed class AddBlockEventArgs 4 | { 5 | public DividerBlockControl Divider { get; } 6 | public BlockType Type { get; } 7 | 8 | public AddBlockEventArgs(DividerBlockControl divider, BlockType type) 9 | { 10 | Divider = divider; 11 | Type = type; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/GenericModules/GenericCursorMetadata.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Core.GenericModules; 4 | 5 | public record class GenericCursorMetadata 6 | { 7 | public GenericTableMetadata TableMetadata { get; set; } 8 | public IEnumerator Enumerator { get; set; } 9 | public bool Eof { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS FIRST_COLUMN first beyond end of data.sql: -------------------------------------------------------------------------------- 1 | -- First column is beyond the end of the data 2 | BEGIN TRY 3 | IMPORT XLS '\excel.xlsx' WORKSHEET 3 INTO table6 OPTIONS (FIRST_COLUMN: 100); 4 | END TRY 5 | BEGIN CATCH 6 | SELECT ERROR_MESSAGE() AS message; 7 | END CATCH 8 | 9 | --output-- 10 | message 11 | No columns chosen for import. 12 | - 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Search against multi-column keys 1.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE item (ordid, prodid, qty); 3 | 4 | SELECT ordid, prodid, qty 5 | FROM item 6 | WHERE (prodid, qty) IN (SELECT prodid, qty 7 | FROM item 8 | WHERE ordid = 365); 9 | 10 | --output-- 11 | ordid,prodid,qty 12 | - 13 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/CustomScalarFunction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript; 4 | 5 | public abstract class CustomScalarFunction 6 | { 7 | public abstract string Name { get; } 8 | public abstract int ParamCount { get; } 9 | public abstract bool IsDeterministic { get; } 10 | public abstract object Execute(IReadOnlyList args); 11 | } 12 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/IdentifierOrExpr.cs: -------------------------------------------------------------------------------- 1 | namespace SqlNotebookScript.Interpreter.Ast; 2 | 3 | // table-name, sn-column-name 4 | public sealed class IdentifierOrExpr : Node 5 | { 6 | // mutually exclusive, one will be null 7 | public string Identifier { get; set; } 8 | public Expr Expr { get; set; } 9 | 10 | protected override Node GetChild() => Expr; 11 | } 12 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/TryCatchStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class TryCatchStmt : Stmt 6 | { 7 | public Block TryBlock { get; set; } 8 | public Block CatchBlock { get; set; } 9 | 10 | protected override IEnumerable GetChildren() => new Node[] { TryBlock, CatchBlock }; 11 | } 12 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Sensors/Sensors/UnknownSensor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Sensors 4 | { 5 | /// Sensor type used for sensors for which there is no specific implementation. 6 | public class UnknownSensor : Sensor 7 | { 8 | // Left empty 9 | } 10 | } -------------------------------------------------------------------------------- /src/SqlNotebook/Import/ImportConversionFailOption.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace SqlNotebook.Import; 4 | 5 | public enum ImportConversionFailOption 6 | { 7 | [Description("Import the value as text")] 8 | ImportAsText = 1, 9 | 10 | [Description("Skip the row")] 11 | SkipRow = 2, 12 | 13 | [Description("Stop import with error")] 14 | Abort = 3, 15 | } 16 | -------------------------------------------------------------------------------- /src/SqlNotebook/Import/ImportTableExistsOption.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace SqlNotebook.Import; 4 | 5 | public enum ImportTableExistsOption 6 | { 7 | [Description("Append new rows")] 8 | AppendNewRows, 9 | 10 | [Description("Delete existing rows")] 11 | DeleteExistingRows, 12 | 13 | [Description("Drop table and re-create")] 14 | DropTable, 15 | } 16 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/SqliteInterop/Sqlite3IndexConstraint.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SqlNotebookScript.Core.SqliteInterop; 4 | 5 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 6 | public struct Sqlite3IndexConstraint 7 | { 8 | public int iColumn; 9 | public byte op; 10 | public byte usable; 11 | public int iTermOffset; 12 | } 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT TXT SKIP_LINES.sql: -------------------------------------------------------------------------------- 1 | -- Happy path 2 | IMPORT TXT '\utf8.txt' INTO table1 3 | OPTIONS (SKIP_LINES: 3); 4 | SELECT * FROM table1; 5 | 6 | -- Skip past the end of the file. 7 | IMPORT TXT '\utf8.txt' INTO table2 8 | OPTIONS (SKIP_LINES: 100); 9 | SELECT * FROM table2; 10 | 11 | --output-- 12 | number,line 13 | 1,jkl 14 | 2,mno 15 | - 16 | number,line 17 | - 18 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/lang_update - UPDATE FROM.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/lang_update.html#upfrom 2 | CREATE TABLE inventory (itemId, quantity); 3 | CREATE TABLE sales (itemId, quantity); 4 | 5 | UPDATE inventory 6 | SET quantity = quantity - daily.amt 7 | FROM (SELECT sum(quantity) AS amt, itemId FROM sales GROUP BY 2) AS daily 8 | WHERE inventory.itemId = daily.itemId; 9 | 10 | --output-- 11 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/Common/ShellFolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Shell 4 | { 5 | /// Represents the base class for all types of folders (filesystem and non filesystem) 6 | public abstract class ShellFolder : ShellContainer 7 | { 8 | // empty 9 | } 10 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/CustomTableFunction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript; 4 | 5 | public abstract class CustomTableFunction 6 | { 7 | public abstract string Name { get; } 8 | public abstract string CreateTableSql { get; } 9 | public abstract int HiddenColumnCount { get; } 10 | public abstract IEnumerable Execute(object[] hiddenValues); 11 | } 12 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/OptionsList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | // options-list 6 | public sealed class OptionsList : Node 7 | { 8 | public Dictionary Options { get; set; } = new Dictionary(); // lowercase key 9 | 10 | protected override IEnumerable GetChildren() => Options.Values; 11 | } 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV TABLE TRUNCATE_EXISTING_FILE default.sql: -------------------------------------------------------------------------------- 1 | EXPORT TXT '\file.csv' FROM (SELECT 'hello'); 2 | 3 | CREATE TABLE foo (a, b, c); 4 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 5 | EXPORT CSV '\file.csv' FROM TABLE foo; 6 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 7 | 8 | --output-- 9 | [hello 10 | a,b,c 11 | 111,222,333 12 | AAA,BBB,CCC 13 | ] 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Utils/BlankValuesOption.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace SqlNotebookScript.Utils; 4 | 5 | public enum BlankValuesOption 6 | { 7 | [Description("Import as empty string")] 8 | EmptyString = 1, 9 | 10 | [Description("Import as NULL")] 11 | Null = 2, 12 | 13 | [Description("Import as NULL for non-TEXT columns only")] 14 | EmptyStringOrNull = 3, 15 | } 16 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/date-add-func.sql: -------------------------------------------------------------------------------- 1 | -- Prints "2016-08-23 00:00:00.000". 2 | PRINT DATEADD('month', 1, '2016-07-23'); 3 | 4 | -- Prints "2015-01-29 12:41:25.000". 5 | PRINT DATEADD('day', -5, '2015-02-03 12:41:25'); 6 | 7 | -- Prints "2015-02-05 16:41:25.000". 8 | PRINT DATEADD('hh', 52, '2015-02-03 12:41:25'); 9 | --output-- 10 | 2016-08-23 00:00:00.000 11 | 2015-01-29 12:41:25.000 12 | 2015-02-05 16:41:25.000 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/FOREACH_empty_table.sql: -------------------------------------------------------------------------------- 1 | -- Create an empty test table 2 | CREATE TEMP TABLE empty_table (id INTEGER, name TEXT); 3 | 4 | -- Test FOREACH with empty table (should not execute body, variables auto-declared) 5 | PRINT 'Before FOREACH'; 6 | FOREACH (@id, @name) IN empty_table BEGIN 7 | PRINT 'This should not print'; 8 | END 9 | PRINT 'After FOREACH'; 10 | 11 | --output-- 12 | Before FOREACH 13 | After FOREACH -------------------------------------------------------------------------------- /src/Tests/scripts/doc/for-stmt.sql: -------------------------------------------------------------------------------- 1 | -- Prints the numbers: 1, 2, 3, 4, 5. 2 | FOR @i = 1 TO 5 3 | PRINT @i; 4 | 5 | -- Prints the numbers: 5, 4, 3, 2, 1. 6 | FOR @i = 5 TO 1 7 | PRINT @i; 8 | 9 | -- Prints the numbers: 1, 3, 5, 9. 10 | FOR @i = 1 TO 10 STEP 2 11 | PRINT @i; 12 | 13 | --output-- 14 | 1 15 | 2 16 | 3 17 | 4 18 | 5 19 | 5 20 | 4 21 | 3 22 | 2 23 | 1 24 | 1 25 | 3 26 | 5 27 | 7 28 | 9 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .nupkg 2 | .vs/ 3 | *.aps 4 | *.cachefile 5 | *.crt 6 | *.key 7 | *.ncb 8 | *.opendb 9 | *.opensdf 10 | *.pfx 11 | *.sdf 12 | *.user 13 | bin/ 14 | build.log 15 | Debug/ 16 | Desktop.ini 17 | ext/downloads/ 18 | ext/sqlean/ 19 | ext/sqlite/ 20 | format.log 21 | ipch/ 22 | obj/ 23 | packages/ 24 | Release/ 25 | src/crypto/ 26 | src/fuzzy/ 27 | src/SqlNotebook/doc/ 28 | src/stats/ 29 | Thumbs.db 30 | x64/ 31 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/CreateScriptStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class CreateScriptStmt : Stmt 6 | { 7 | public IdentifierOrExpr ScriptName { get; set; } 8 | public IdentifierOrExpr SqlCommands { get; set; } 9 | 10 | protected override IEnumerable GetChildren() => new Node[] { ScriptName, SqlCommands }; 11 | } 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV TABLE TRUNCATE_EXISTING_FILE 1.sql: -------------------------------------------------------------------------------- 1 | EXPORT TXT '\file.csv' FROM (SELECT 'hello'); 2 | 3 | CREATE TABLE foo (a, b, c); 4 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 5 | EXPORT CSV '\file.csv' FROM TABLE foo OPTIONS (TRUNCATE_EXISTING_FILE: 1); 6 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 7 | 8 | --output-- 9 | [a,b,c 10 | 111,222,333 11 | AAA,BBB,CCC 12 | ] 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT DATABASE DUCKDB.sql: -------------------------------------------------------------------------------- 1 | IMPORT DATABASE 'duckdb' 2 | CONNECTION 'Data Source=\example.duckdb' 3 | TABLE employees; 4 | 5 | SELECT * FROM employees ORDER BY id; 6 | 7 | --output-- 8 | id,name,department,salary,hire_date 9 | 1,Alice,Engineering,95000,6/1/2018 10 | 2,Bob,Sales,65000,7/15/2019 11 | 3,Charlie,HR,60000,3/22/2020 12 | 4,Diana,Engineering,98000,11/30/2017 13 | 5,Evan,Marketing,72000,1/10/2021 14 | - -------------------------------------------------------------------------------- /src/Tests/scripts/doc/date-trunc-func.sql: -------------------------------------------------------------------------------- 1 | -- Prints "2016-07-01 00:00:00.000". 2 | PRINT DATE_TRUNC('month', '2016-07-23 12:23:00'); 3 | 4 | -- Prints "2015-08-02 00:00:00.000". 5 | PRINT DATE_TRUNC('week', '2015-08-03 12:41:25'); 6 | 7 | -- Prints "2015-02-03 12:00:00.000". 8 | PRINT DATE_TRUNC('hh', '2015-02-03 12:41:25'); 9 | 10 | --output-- 11 | 2016-07-01 00:00:00.000 12 | 2015-08-02 00:00:00.000 13 | 2015-02-03 12:00:00.000 14 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT DATABASE SQLITE.sql: -------------------------------------------------------------------------------- 1 | IMPORT DATABASE 'sqlite' 2 | CONNECTION 'Data Source=\example.sqlite3' 3 | TABLE employees; 4 | 5 | SELECT * FROM employees ORDER BY id; 6 | 7 | --output-- 8 | id,name,department,salary,hire_date 9 | 1,Alice,Engineering,95000,6/1/2018 10 | 2,Bob,Sales,65000,7/15/2019 11 | 3,Charlie,HR,60000,3/22/2020 12 | 4,Diana,Engineering,98000,11/30/2017 13 | 5,Evan,Marketing,72000,1/10/2021 14 | - -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV SEPARATOR tab.sql: -------------------------------------------------------------------------------- 1 | -- Be careful when editing this file -- we need to preserve the tab characters in the output. 2 | CREATE TABLE foo (a, b, c); 3 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 4 | EXPORT CSV '\file.tsv' FROM TABLE foo OPTIONS (SEPARATOR: CHAR(9)) 5 | PRINT '[' || READ_FILE_TEXT('\file.tsv') || ']'; 6 | 7 | --output-- 8 | [a b c 9 | 111 222 333 10 | AAA BBB CCC 11 | ] 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV TABLE TRUNCATE_EXISTING_FILE 0.sql: -------------------------------------------------------------------------------- 1 | EXPORT TXT '\file.csv' FROM (SELECT 'hello'); 2 | 3 | CREATE TABLE foo (a, b, c); 4 | INSERT INTO foo VALUES (111, 222, 333), ('AAA', 'BBB', 'CCC'); 5 | EXPORT CSV '\file.csv' FROM TABLE foo OPTIONS (TRUNCATE_EXISTING_FILE: 0); 6 | PRINT '[' || READ_FILE_TEXT('\file.csv') || ']'; 7 | 8 | --output-- 9 | [hello 10 | a,b,c 11 | 111,222,333 12 | AAA,BBB,CCC 13 | ] 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/IfStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class IfStmt : Stmt 6 | { 7 | public Expr Condition { get; set; } 8 | public Block Block { get; set; } 9 | public Block ElseBlock { get; set; } // may be null 10 | 11 | protected override IEnumerable GetChildren() => new Node[] { Condition, Block, ElseBlock }; 12 | } 13 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Utils/ExceptionEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SqlNotebookScript.Utils; 4 | 5 | public sealed class ExceptionEx : Exception 6 | { 7 | public string Heading { get; } 8 | public string Details { get; } 9 | 10 | public ExceptionEx(string heading, string details) 11 | : base($"{heading}\r\n\r\n{details}") 12 | { 13 | Heading = heading; 14 | Details = details; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ForeachStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class ForeachStmt : Stmt 6 | { 7 | public List VariableNames { get; set; } 8 | public IdentifierOrExpr TableExpr { get; set; } 9 | public Block Block { get; set; } 10 | 11 | protected override IEnumerable GetChildren() => new Node[] { TableExpr, Block }; 12 | } 13 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT CSV TABLE FILE_ENCODING.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b); 2 | INSERT INTO foo VALUES 3 | ('失礼だが', '上記の記事にある3つの誤りを指摘しておきたい'), 4 | ('いまにも絶滅しようとしている野生動物もいます', '信用して」と彼は言った'); 5 | 6 | EXPORT CSV '\file.csv' FROM TABLE foo OPTIONS (FILE_ENCODING: 932); 7 | PRINT '[' || READ_FILE_TEXT('\file.csv', 932) || ']'; 8 | 9 | --output-- 10 | [a,b 11 | 失礼だが,上記の記事にある3つの誤りを指摘しておきたい 12 | いまにも絶滅しようとしている野生動物もいます,信用して」と彼は言った 13 | ] 14 | -------------------------------------------------------------------------------- /src/Tests/scripts/FOREACH_single_column.sql: -------------------------------------------------------------------------------- 1 | -- Create a single column test table 2 | CREATE TEMP TABLE single_col_table (value INTEGER); 3 | INSERT INTO single_col_table VALUES (10); 4 | INSERT INTO single_col_table VALUES (20); 5 | INSERT INTO single_col_table VALUES (30); 6 | 7 | -- Test FOREACH with single variable (auto-declared) 8 | FOREACH (@val) IN single_col_table BEGIN 9 | PRINT @val; 10 | END 11 | 12 | --output-- 13 | 10 14 | 20 15 | 30 -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ExecuteStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class ExecuteStmt : Stmt 6 | { 7 | public string ReturnVariableName { get; set; } // may be null 8 | public string ScriptName { get; set; } 9 | public List Arguments { get; set; } = new List(); 10 | protected override bool IsLeaf { get; } = true; 11 | } 12 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Scrolling Window Queries.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE contacts (lastname, firstname); 3 | INSERT INTO contacts VALUES 4 | ('A', 'A'), 5 | ('A', 'Z'), 6 | ('Z', 'A'), 7 | ('Z', 'Z'); 8 | 9 | SELECT * FROM contacts 10 | WHERE (lastname,firstname) > ('L', 'Q') 11 | ORDER BY lastname, firstname 12 | LIMIT 7; 13 | 14 | --output-- 15 | lastname,firstname 16 | Z,A 17 | Z,Z 18 | - 19 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT DATABASE DUCKDB LINK.sql: -------------------------------------------------------------------------------- 1 | IMPORT DATABASE 'duckdb' 2 | CONNECTION 'Data Source=\example.duckdb' 3 | TABLE employees 4 | OPTIONS (LINK: 1); 5 | 6 | SELECT * FROM employees ORDER BY id; 7 | 8 | --output-- 9 | id,name,department,salary,hire_date 10 | 1,Alice,Engineering,95000,6/1/2018 11 | 2,Bob,Sales,65000,7/15/2019 12 | 3,Charlie,HR,60000,3/22/2020 13 | 4,Diana,Engineering,98000,11/30/2017 14 | 5,Evan,Marketing,72000,1/10/2021 15 | - -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT DATABASE SQLITE LINK.sql: -------------------------------------------------------------------------------- 1 | IMPORT DATABASE 'sqlite' 2 | CONNECTION 'Data Source=\example.sqlite3' 3 | TABLE employees 4 | OPTIONS (LINK: 1); 5 | 6 | SELECT * FROM employees ORDER BY id; 7 | 8 | --output-- 9 | id,name,department,salary,hire_date 10 | 1,Alice,Engineering,95000,6/1/2018 11 | 2,Bob,Sales,65000,7/15/2019 12 | 3,Charlie,HR,60000,3/22/2020 13 | 4,Diana,Engineering,98000,11/30/2017 14 | 5,Evan,Marketing,72000,1/10/2021 15 | - -------------------------------------------------------------------------------- /ext/dockpanelsuite/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.suo 3 | *.user 4 | _ReSharper* 5 | *.csproj.user 6 | *.resharper.user 7 | *.userprefs 8 | *.suo 9 | *.cache 10 | *.trx 11 | *.pidb 12 | Thumbs.db 13 | [Bb]in 14 | [Dd]ebug 15 | [Oo]bj 16 | [Rr]elease 17 | [Tt]est[Rr]esult* 18 | _UpgradeReport_Files 19 | *[Pp]ublish.xml 20 | *.project 21 | *.metadata 22 | logs 23 | *.generated.cs 24 | T4MVC.cs 25 | /SharpSnmpLib/sharpsnmplib.snk 26 | /packages 27 | /Gendarme 28 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Comparison of dates stored as separate fields.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE info( 3 | year INT, -- 4 digit year 4 | month INT, -- 1 through 12 5 | day INT, -- 1 through 31 6 | other_stuff BLOB -- blah blah blah 7 | ); 8 | 9 | SELECT * FROM info 10 | WHERE (year,month,day) BETWEEN (2015,9,12) AND (2016,9,12); 11 | 12 | --output-- 13 | year,month,day,other_stuff 14 | - 15 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/ITheme.cs: -------------------------------------------------------------------------------- 1 | namespace WeifenLuo.WinFormsUI.Docking 2 | { 3 | /// 4 | /// DockPanel Suite theme interface. 5 | /// 6 | public interface ITheme 7 | { 8 | /// 9 | /// Applies the specified theme to the dock panel. 10 | /// 11 | /// The dock panel. 12 | void Apply(DockPanel dockPanel); 13 | } 14 | 15 | 16 | } -------------------------------------------------------------------------------- /src/Tests/scripts/CREATE_SCRIPT.sql: -------------------------------------------------------------------------------- 1 | -- Test CREATE SCRIPT statement 2 | CREATE SCRIPT TestScript AS 'PRINT ''Hello from created script'';'; 3 | EXECUTE TestScript; 4 | 5 | -- Test creating script that already exists (should fail) 6 | BEGIN TRY 7 | CREATE SCRIPT TestScript AS 'PRINT ''This should fail'';'; 8 | END TRY 9 | BEGIN CATCH 10 | PRINT ERROR_MESSAGE(); 11 | END CATCH 12 | 13 | --output-- 14 | Hello from created script 15 | A script named "TestScript" already exists. -------------------------------------------------------------------------------- /doc/host-name-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HOST_NAME Function 6 | 7 | 8 |

HOST_NAME Function

9 |

Returns the local computer name.

10 |

Syntax

HOST_NAME()
11 |

Return Value

The computer hostname.
12 |

Example

13 |
PRINT HOST_NAME();
14 | 15 | 16 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/Common/ShellNonFileSystemItem.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Shell 4 | { 5 | /// Represents a non filesystem item (e.g. virtual items inside Control Panel) 6 | public class ShellNonFileSystemItem : ShellObject 7 | { 8 | internal ShellNonFileSystemItem(IShellItem2 shellItem) => nativeShellItem = shellItem; 9 | } 10 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/AdoModules/AdoCursorMetadata.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | 3 | namespace SqlNotebookScript.Core.AdoModules; 4 | 5 | public record class AdoCursorMetadata 6 | { 7 | public AdoTableMetadata TableMetadata { get; set; } 8 | public IDbConnection Connection { get; set; } 9 | public IDbCommand Command { get; set; } 10 | public IDataReader Reader { get; set; } 11 | public string ReaderSql { get; set; } 12 | public bool IsEof { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/SqliteInterop/Sqlite3VtabCursor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SqlNotebookScript.Core.SqliteInterop; 5 | 6 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 7 | internal class Sqlite3VtabCursor 8 | { 9 | // --- The prefix of this struct must match sqlite3_vtab_cursor 10 | 11 | public IntPtr pVtab; 12 | 13 | // --- The suffix is up to us 14 | 15 | public int MetadataKey; 16 | } 17 | -------------------------------------------------------------------------------- /src/Tests/TestUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Tests; 5 | 6 | public sealed class TestUtil 7 | { 8 | public static string GetTestsDir() 9 | { 10 | var testsDir = typeof(ScriptTest).Assembly.Location; 11 | while (!Path.GetFileName(testsDir).Equals("Tests", StringComparison.OrdinalIgnoreCase)) 12 | { 13 | testsDir = Path.GetDirectoryName(testsDir); 14 | } 15 | return testsDir; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT TXT append.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b); 2 | INSERT INTO foo VALUES ('hello', 'world'); 3 | 4 | EXPORT TXT '\file.txt' 5 | FROM (SELECT * FROM foo); 6 | 7 | DELETE FROM foo; 8 | INSERT INTO foo VALUES ('aaa', 'bbb'); 9 | 10 | EXPORT TXT '\file.txt' 11 | FROM (SELECT * FROM foo); 12 | 13 | IMPORT TXT '\file.txt' INTO foo2 (num, line); 14 | 15 | SELECT * FROM foo2; 16 | --output-- 17 | num,line 18 | 1,helloworld 19 | 2,aaabbb 20 | - 21 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Row Value Comparisons 3.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE t2(x,y,z); 3 | INSERT INTO t2(x,y,z) VALUES(1,2,3),(2,3,4),(1,NULL,5); 4 | SELECT 5 | (1,2,3) IN (SELECT * FROM t2), -- 1 6 | (7,8,9) IN (SELECT * FROM t2), -- 0 7 | (1,3,5) IN (SELECT * FROM t2); -- NULL 8 | 9 | --output-- 10 | ( 1 , 2 , 3 ) IN ( SELECT * FROM t2 ),( 7 , 8 , 9 ) IN ( SELECT * FROM t2 ),( 1 , 3 , 5 ) IN ( SELECT * FROM t2 ) 11 | 1,0,null 12 | - 13 | -------------------------------------------------------------------------------- /project/finished/005 CREATE SCRIPT.md: -------------------------------------------------------------------------------- 1 | - [x] Add language statement for adding scripts. 2 | - [x] Syntax: 'CREATE' 'SCRIPT' 'AS' 3 | - [x] and are IdentifierOrExpr. 4 | - [x] Consider: 'CREATE' is already a SQL command. See `BEGIN TRY` as an example of what to do. 5 | - [x] If the name already exists (case insensitive) then an exception is thrown. 6 | - [x] Our .sql harness should do it, you should be able to `CREATE SCRIPT` and then `EXECUTE`. 7 | -------------------------------------------------------------------------------- /src/Tests/GlobalInit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using SqlNotebookScript.Core; 4 | 5 | namespace Tests; 6 | 7 | public sealed class GlobalInit 8 | { 9 | private GlobalInit() 10 | { 11 | Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); 12 | Notebook.InitSqlite(); 13 | } 14 | 15 | private static readonly Lazy _instance = new(() => new()); 16 | 17 | public static void Init() => _ = _instance.Value; 18 | } 19 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/date-diff-func.sql: -------------------------------------------------------------------------------- 1 | -- Prints "1" because the clock crosses midnight once. 2 | PRINT DATEDIFF('day', '2016-03-04 03:53', '2016-03-05 11:53'); 3 | 4 | -- Prints "1" because the clock crosses the top of the hour once. 5 | PRINT DATEDIFF('hh', '2016-01-01 03:59', '2016-01-01 04:01'); -- "1" 6 | 7 | -- Prints "0" because the clock does not cross the top of the hour. 8 | PRINT DATEDIFF('hh', '2016-01-01 03:50', '2016-01-01 03:52'); 9 | 10 | --output-- 11 | 1 12 | 1 13 | 0 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ExportTxtStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | // export-txt-stmt 6 | public sealed class ExportTxtStmt : Stmt 7 | { 8 | public Expr FilenameExpr { get; set; } 9 | public SqlStmt SelectStmt { get; set; } 10 | public OptionsList OptionsList { get; set; } 11 | 12 | protected override IEnumerable GetChildren() => new Node[] { FilenameExpr, SelectStmt, OptionsList }; 13 | } 14 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/lang_upsert - Examples 3.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/lang_upsert.html 2 | CREATE TABLE phonebook2( 3 | name TEXT PRIMARY KEY, 4 | phonenumber TEXT, 5 | validDate DATE 6 | ); 7 | INSERT INTO phonebook2(name,phonenumber,validDate) 8 | VALUES('Alice','704-555-1212','2018-05-08') 9 | ON CONFLICT(name) DO UPDATE SET 10 | phonenumber=excluded.phonenumber, 11 | validDate=excluded.validDate 12 | WHERE excluded.validDate>phonebook2.validDate; 13 | 14 | --output-- 15 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ImportCsvStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | // import-csv-stmt 6 | public sealed class ImportCsvStmt : Stmt 7 | { 8 | public Expr FilenameExpr { get; set; } 9 | public ImportTable ImportTable { get; set; } 10 | public OptionsList OptionsList { get; set; } 11 | 12 | protected override IEnumerable GetChildren() => new Node[] { FilenameExpr, ImportTable, OptionsList }; 13 | } 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ImportColumn.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | // import-column 6 | public sealed class ImportColumn : Node 7 | { 8 | public IdentifierOrExpr ColumnName { get; set; } 9 | public IdentifierOrExpr AsName { get; set; } // may be null 10 | public TypeConversion? TypeConversion { get; set; } 11 | 12 | protected override IEnumerable GetChildren() => new[] { ColumnName, AsName }; 13 | } 14 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ImportTable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace SqlNotebookScript.Interpreter.Ast; 5 | 6 | // import-table 7 | public sealed class ImportTable : Node 8 | { 9 | public IdentifierOrExpr TableName { get; set; } 10 | public List ImportColumns { get; set; } = new List(); 11 | 12 | protected override IEnumerable GetChildren() => new Node[] { TableName }.Concat(ImportColumns); 13 | } 14 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/DockContentEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace WeifenLuo.WinFormsUI.Docking 4 | { 5 | public class DockContentEventArgs : EventArgs 6 | { 7 | private IDockContent m_content; 8 | 9 | public DockContentEventArgs(IDockContent content) 10 | { 11 | m_content = content; 12 | } 13 | 14 | public IDockContent Content 15 | { 16 | get { return m_content; } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /project/finished/009 Update to SQLite 3.50.1.md: -------------------------------------------------------------------------------- 1 | - [x] Make `scripts/build.sh Test_doc_year_func_sql` pass. I just upgraded SQLite and it broke tons of tests; this is an example. 2 | - [x] Read `TokenType.cs`, SQLite added a token type for comments when previously comments were ignored by the tokenizer. 3 | - [x] When we call SQLite's tokenizer, we need to ignore comment tokens. We don't ever want to deal with comment tokens. 4 | - [x] Once you make your fix, make sure all tests besides the one example test now pass. 5 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT TXT truncate.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b); 2 | INSERT INTO foo VALUES ('hello', 'world'); 3 | 4 | EXPORT TXT '\file.txt' 5 | FROM (SELECT * FROM foo); 6 | 7 | DELETE FROM foo; 8 | INSERT INTO foo VALUES ('aaa', 'bbb'); 9 | 10 | EXPORT TXT '\file.txt' 11 | FROM (SELECT * FROM foo) 12 | OPTIONS (TRUNCATE_EXISTING_FILE: 1); 13 | 14 | IMPORT TXT '\file.txt' INTO foo2 (num, line); 15 | 16 | SELECT * FROM foo2; 17 | --output-- 18 | num,line 19 | 1,aaabbb 20 | - 21 | -------------------------------------------------------------------------------- /src/Tests/scripts/LIST_FILES.sql: -------------------------------------------------------------------------------- 1 | SELECT filename, extension 2 | FROM LIST_FILES('') 3 | WHERE filename = 'excel.xls'; 4 | 5 | SELECT filename, extension 6 | FROM LIST_FILES('', 0) 7 | WHERE filename = 'subdir-file.txt'; 8 | 9 | SELECT filename, extension 10 | FROM LIST_FILES('', 1) 11 | WHERE filename = 'subdir-file.txt'; 12 | 13 | --output-- 14 | filename,extension 15 | excel.xls,.xls 16 | - 17 | filename,extension 18 | - 19 | filename,extension 20 | subdir-file.txt,.txt 21 | - 22 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/list-xls-worksheets-func.sql: -------------------------------------------------------------------------------- 1 | -- Returns a table listing all the worksheets. 2 | SELECT * FROM LIST_XLS_WORKSHEETS('\excel.xls'); 3 | 4 | -- Returns the name of the second worksheet, or an 5 | -- empty table if there are fewer than 2 worksheets 6 | -- in the workbook. 7 | SELECT name FROM LIST_XLS_WORKSHEETS('\excel.xls') WHERE number = 2; 8 | 9 | --output-- 10 | number,name 11 | 1,FirstSheet 12 | 2,SecondSheet 13 | 3,ThirdSheet 14 | - 15 | name 16 | SecondSheet 17 | - 18 | -------------------------------------------------------------------------------- /doc/now-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NOW Function 6 | 7 | 8 |

NOW Function

9 |

Returns the current date and time, in the local time zone.

10 |

Syntax

NOW()
11 |

Return Value

A date string formatted like "2016-07-23 22:12:55.652".
12 |

Example

13 |
PRINT NOW();
14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/user-name-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | USER_NAME Function 6 | 7 | 8 |

USER_NAME Function

9 |

Returns the current logged-in username.

10 |

Syntax

USER_NAME()
11 |

Return Value

The username of the currently logged-in user.
12 |

Example

13 |
PRINT USER_NAME();
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/SqliteInterop/Sqlite3Vtab.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SqlNotebookScript.Core.SqliteInterop; 5 | 6 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 7 | public struct Sqlite3Vtab 8 | { 9 | // --- The prefix of this struct must match sqlite3_vtab 10 | public IntPtr pModule; 11 | public int nRef; 12 | public IntPtr zErrMsg; 13 | 14 | // --- The suffix is up to us 15 | 16 | public int MetadataKey; 17 | } 18 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Row Values In UPDATE Statements.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE tab3 (a, b, c, d, e); 3 | INSERT INTO tab3 VALUES 4 | (1, 2, 3, 4, 5), 5 | (111, 222, 333, 444, 60); 6 | CREATE TABLE tab4 (w, x, y, z); 7 | INSERT INTO tab4 VALUES 8 | (444, 999, 999, 999); 9 | 10 | UPDATE tab3 11 | SET (a,b,c) = (SELECT x,y,z 12 | FROM tab4 13 | WHERE tab4.w=tab3.d) 14 | WHERE tab3.e BETWEEN 55 AND 66; 15 | 16 | --output-- 17 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Explorer Browser Control 7 | 8 | -------------------------------------------------------------------------------- /ps1/Update-GitHubPages.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode -Version 3 2 | $ErrorActionPreference = "Stop" 3 | 4 | & "$PSScriptRoot\Update-Docs.ps1" 5 | 6 | $ghDir = (Resolve-Path "$PSScriptRoot\..\..\website-sqlnotebook.com").Path 7 | Get-ChildItem $ghDir | % { Remove-Item -Force -Recurse "$ghDir\$_" } 8 | 9 | $siteDir = (Resolve-Path "$PSScriptRoot\..\web\site").Path 10 | Push-Location $siteDir 11 | Copy-Item -Recurse ".\*" "$ghDir\" -Exclude ".git" 12 | Pop-Location 13 | 14 | Push-Location $ghDir 15 | git add -A 16 | git commit --amend 17 | Pop-Location 18 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/UncaughtErrorScriptException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SqlNotebookScript.Interpreter; 4 | 5 | public sealed class UncaughtErrorScriptException : ScriptException 6 | { 7 | public string ErrorMessage { get; } 8 | public string Snippet { get; set; } 9 | 10 | public UncaughtErrorScriptException(string errorMessage, Exception innerException = null) 11 | : base(errorMessage.ToString(), innerException) 12 | { 13 | ErrorMessage = errorMessage; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /doc/get-date-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GETDATE Function 6 | 7 | 8 |

GETDATE Function

9 |

Returns the current date and time, in the local time zone.

10 |

Syntax

GETDATE()
11 |

Return Value

A date string formatted like "2016-07-23 22:12:55.652".
12 |

Example

13 |
PRINT GETDATE();
14 | 
15 | 16 | 17 | -------------------------------------------------------------------------------- /doc/new-id-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NEWID Function 6 | 7 | 8 |

NEWID Function

9 |

Generates a new GUID string like "8503ACE5-871D-4759-8B63-D684792C4C15".

10 |

Syntax

NEWID()
11 |

Return Value

A new GUID string like "C5912150-1DE9-42EE-B265-0A65DAD8CACE".
12 |

Example

13 |
PRINT NEWID();
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Tests/scripts/EXPORT TXT Shift-JIS.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE foo (a, b); 2 | INSERT INTO foo VALUES 3 | ('失礼だが', '上記の記事にある3つの誤りを指摘しておきたい'), 4 | ('いまにも絶滅しようとしている野生動物もいます', '信用して」と彼は言った'); 5 | 6 | EXPORT TXT '\file.txt' 7 | FROM (SELECT * FROM foo) 8 | OPTIONS (FILE_ENCODING: 932); 9 | 10 | IMPORT TXT '\file.txt' 11 | INTO foo2 (num, line) 12 | OPTIONS (FILE_ENCODING: 932); 13 | 14 | SELECT * FROM foo2; 15 | 16 | --output-- 17 | num,line 18 | 1,失礼だが上記の記事にある3つの誤りを指摘しておきたい 19 | 2,いまにも絶滅しようとしている野生動物もいます信用して」と彼は言った 20 | - 21 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/Common/ShellSavedSearchCollection.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using MS.WindowsAPICodePack.Internal; 4 | 5 | namespace Microsoft.WindowsAPICodePack.Shell 6 | { 7 | /// Represents a saved search 8 | public class ShellSavedSearchCollection : ShellSearchCollection 9 | { 10 | internal ShellSavedSearchCollection(IShellItem2 shellItem) 11 | : base(shellItem) => CoreHelpers.ThrowIfNotVista(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/Utils/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace SqlNotebookScript.Utils; 5 | 6 | public static class Extensions 7 | { 8 | public static string GetExceptionMessage(this Exception self) 9 | { 10 | if (self is AggregateException agg) 11 | { 12 | return string.Join(Environment.NewLine, agg.InnerExceptions.Select(x => x.GetExceptionMessage())); 13 | } 14 | else 15 | { 16 | return self.Message; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEnums.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Controls 4 | { 5 | /// The direction argument for Navigate 6 | public enum NavigationLogDirection 7 | { 8 | /// Navigates forward through the navigation log 9 | Forward, 10 | 11 | /// Navigates backward through the travel log 12 | Backward 13 | } 14 | } -------------------------------------------------------------------------------- /doc/get-utc-date-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GETUTCDATE Function 6 | 7 | 8 |

GETUTCDATE Function

9 |

Returns the current date and time in UTC (Coordinated Universal Time).

10 |

Syntax

GETUTCDATE()
11 |

Return Value

A date string formatted like "2016-07-24 02:14:16.404".
12 |

Example

13 |
PRINT GETUTCDATE();
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Tests/scripts/READ_FILE.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM READ_FILE('\utf8.txt'); 2 | 3 | SELECT * FROM READ_FILE('\utf8.txt', 0); 4 | 5 | SELECT * FROM READ_FILE('\utf8.txt', 65001); 6 | 7 | SELECT * FROM READ_FILE('\shiftjis.txt', 932); 8 | 9 | --output-- 10 | number,line 11 | 1,abc 12 | 2,def 13 | 3,ghi 14 | 4,jkl 15 | 5,mno 16 | - 17 | number,line 18 | 1,abc 19 | 2,def 20 | 3,ghi 21 | 4,jkl 22 | 5,mno 23 | - 24 | number,line 25 | 1,abc 26 | 2,def 27 | 3,ghi 28 | 4,jkl 29 | 5,mno 30 | - 31 | number,line 32 | 1,日本語 33 | - 34 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/Common/ShellSearchCollection.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Shell 4 | { 5 | /// Represents the base class for all search-related classes. 6 | public class ShellSearchCollection : ShellContainer 7 | { 8 | internal ShellSearchCollection() 9 | { 10 | } 11 | 12 | internal ShellSearchCollection(IShellItem2 shellItem) : base(shellItem) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/DesktopWindowManager/GlassEvents.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Microsoft.WindowsAPICodePack.Shell 4 | { 5 | /// Event argument for The GlassAvailabilityChanged event 6 | public class AeroGlassCompositionChangedEventArgs : EventArgs 7 | { 8 | internal AeroGlassCompositionChangedEventArgs(bool avialbility) => GlassAvailable = avialbility; 9 | 10 | /// The new GlassAvailable state 11 | public bool GlassAvailable { get; private set; } 12 | } 13 | } -------------------------------------------------------------------------------- /scripts/format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "$( dirname "${BASH_SOURCE[0]}" )" 3 | cd .. 4 | 5 | LOGFILE=format.log 6 | dotnet tool run csharpier format src/ 2>&1 >"$LOGFILE" 7 | if [ $? -ne 0 ]; then 8 | cat "$LOGFILE" 9 | rm "$LOGFILE" 10 | echo "Error: Formatting failed" 11 | exit 1 12 | fi 13 | 14 | powershell.exe -NoProfile ps1/Update-DocFormatting.ps1 2>&1 | grep -v "Warning" 2>&1 >"$LOGFILE" 15 | if [ $? -ne 0 ]; then 16 | cat "$LOGFILE" 17 | rm "$LOGFILE" 18 | echo "Error: Formatting failed" 19 | exit 1 20 | fi 21 | 22 | rm "$LOGFILE" 23 | echo "Formatting complete." -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ForStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class ForStmt : Stmt 6 | { 7 | public string VariableName { get; set; } 8 | public Expr FirstNumberExpr { get; set; } 9 | public Expr LastNumberExpr { get; set; } 10 | public Expr StepExpr { get; set; } // may be null 11 | public Block Block { get; set; } 12 | 13 | protected override IEnumerable GetChildren() => 14 | new Node[] { FirstNumberExpr, LastNumberExpr, StepExpr, Block }; 15 | } 16 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS HEADER_ROW.sql: -------------------------------------------------------------------------------- 1 | -- Omitted = header 2 | IMPORT XLS '\excel.xls' INTO table1; 3 | SELECT * FROM table1; 4 | 5 | -- 1 = header 6 | IMPORT XLS '\excel.xls' INTO table2 OPTIONS (HEADER_ROW: 1); 7 | SELECT * FROM table2; 8 | 9 | -- 0 = no header 10 | IMPORT XLS '\excel.xls' INTO table3 OPTIONS (HEADER_ROW: 0); 11 | SELECT * FROM table3; 12 | 13 | --output-- 14 | foo,bar 15 | 111,HELLO 16 | 222,WORLD 17 | - 18 | foo,bar 19 | 111,HELLO 20 | 222,WORLD 21 | - 22 | column1,column2 23 | foo,bar 24 | 111,HELLO 25 | 222,WORLD 26 | - 27 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/windowfunctions - Introduction to Window Functions 2.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/windowfunctions.html 2 | CREATE TABLE t0(x INTEGER PRIMARY KEY, y TEXT); 3 | INSERT INTO t0 VALUES (1, 'aaa'), (2, 'ccc'), (3, 'bbb'); 4 | 5 | SELECT x, y, row_number() OVER win1, rank() OVER win2 6 | FROM t0 7 | WINDOW win1 AS (ORDER BY y RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), 8 | win2 AS (PARTITION BY y ORDER BY x) 9 | ORDER BY x; 10 | 11 | --output-- 12 | x,y,row_number ( ) OVER win1,rank ( ) OVER win2 13 | 1,aaa,1,1 14 | 2,ccc,3,1 15 | 3,bbb,2,1 16 | - 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.json text eol=crlf 3 | *.cs text eol=crlf 4 | *.resx text eol=crlf 5 | *.csproj text eol=crlf 6 | *.sln text eol=crlf 7 | *.xshd text eol=crlf 8 | *.md text eol=crlf 9 | *.html text eol=crlf 10 | .gitignore text eol=crlf 11 | .gitattributes text eol=crlf 12 | *.png binary 13 | *.bmp binary 14 | *.ico binary 15 | *.dll binary 16 | *.lib binary 17 | *.exp binary 18 | *.snk binary 19 | *.cur binary 20 | *.pfx binary 21 | ext/* linguist-vendored 22 | *.sql text eol=crlf 23 | *.pikchr text eol=crlf 24 | *.svg text eol=crlf 25 | *.csharpierrc text eol=crlf 26 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ImportXlsStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | // import-xls-stmt 6 | public sealed class ImportXlsStmt : Stmt 7 | { 8 | public Expr FilenameExpr { get; set; } 9 | public Expr WhichSheetExpr { get; set; } // may be null 10 | public ImportTable ImportTable { get; set; } 11 | public OptionsList OptionsList { get; set; } 12 | 13 | protected override IEnumerable GetChildren() => 14 | new Node[] { FilenameExpr, WhichSheetExpr, ImportTable, OptionsList }; 15 | } 16 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/Common/ShellNonFileSystemFolder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Shell 4 | { 5 | /// Represents a Non FileSystem folder (e.g. My Computer, Control Panel) 6 | public class ShellNonFileSystemFolder : ShellFolder 7 | { 8 | internal ShellNonFileSystemFolder() 9 | { 10 | // Empty 11 | } 12 | 13 | internal ShellNonFileSystemFolder(IShellItem2 shellItem) => nativeShellItem = shellItem; 14 | } 15 | } -------------------------------------------------------------------------------- /src/Tests/scripts/FOREACH_basic.sql: -------------------------------------------------------------------------------- 1 | -- Create a test table 2 | CREATE TEMP TABLE test_table (id INTEGER, name TEXT, value INTEGER); 3 | INSERT INTO test_table VALUES (1, 'Alice', 100); 4 | INSERT INTO test_table VALUES (2, 'Bob', 200); 5 | INSERT INTO test_table VALUES (3, 'Charlie', 300); 6 | 7 | -- Test basic FOREACH functionality (variables auto-declared) 8 | FOREACH (@id, @name, @value) IN test_table BEGIN 9 | PRINT CONCAT(@name, ' has ID ', @id, ' and value ', @value); 10 | END 11 | 12 | --output-- 13 | Alice has ID 1 and value 100 14 | Bob has ID 2 and value 200 15 | Charlie has ID 3 and value 300 -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV SKIP_LINES.sql: -------------------------------------------------------------------------------- 1 | -- Omitted = don't skip anything 2 | IMPORT CSV '\utf8.csv' INTO table1; 3 | SELECT * FROM table1; 4 | 5 | -- 0 = don't skip anything 6 | IMPORT CSV '\utf8.csv' INTO table2 OPTIONS (SKIP_LINES: 0) 7 | SELECT * FROM table2; 8 | 9 | -- Test skipping some lines and returning the rest. 10 | IMPORT CSV '\utf8.csv' INTO table3 OPTIONS (SKIP_LINES: 1) 11 | SELECT * FROM table3; 12 | 13 | --output-- 14 | foo,bar 15 | 111,HELLO 16 | 222,WORLD 17 | - 18 | foo,bar 19 | 111,HELLO 20 | 222,WORLD 21 | - 22 | 111,HELLO 23 | 222,WORLD 24 | - 25 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Sensors/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. If you need to access a type in this assembly 7 | // from COM, set the ComVisible attribute to true on that type. 8 | [assembly: ComVisible(false)] 9 | 10 | // The following GUID is for the ID of the typelib if this project is exposed to COM 11 | [assembly: Guid("fb8ba01e-a476-4a0b-a337-e4d862688557")] -------------------------------------------------------------------------------- /src/SqlNotebookCmd/SqlNotebookCmd.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net9.0-windows 5 | enable 6 | enable 7 | x64;ARM64 8 | latest 9 | $(NoWarn);NETSDK1138 10 | True 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Sensors/Interop/SensorNativeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using System.Runtime.InteropServices; 4 | 5 | namespace Microsoft.WindowsAPICodePack.Sensors 6 | { 7 | internal static class SensorNativeMethods 8 | { 9 | [DllImport("kernel32.dll")] 10 | [return: MarshalAs(UnmanagedType.Bool)] 11 | internal static extern bool SystemTimeToFileTime( 12 | ref SystemTime lpSystemTime, 13 | out System.Runtime.InteropServices.ComTypes.FILETIME lpFileTime); 14 | } 15 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/ScalarFunctions/DownloadFunction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.ScalarFunctions; 4 | 5 | public sealed class DownloadFunction : CustomScalarFunction 6 | { 7 | public override string Name => "download"; 8 | 9 | public override int ParamCount => 1; 10 | 11 | public override bool IsDeterministic => false; 12 | 13 | public override object Execute(IReadOnlyList args) 14 | { 15 | var url = args[0].ToString(); 16 | return SharedHttp.Client.GetStringAsync(url).GetAwaiter().GetResult(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Tests/scripts/FOREACH_nested.sql: -------------------------------------------------------------------------------- 1 | -- Create test tables for nesting 2 | CREATE TEMP TABLE outer_table (letter TEXT); 3 | INSERT INTO outer_table VALUES ('A'); 4 | INSERT INTO outer_table VALUES ('B'); 5 | 6 | CREATE TEMP TABLE inner_table (number INTEGER); 7 | INSERT INTO inner_table VALUES (1); 8 | INSERT INTO inner_table VALUES (2); 9 | 10 | -- Test nested FOREACH loops (variables auto-declared) 11 | FOREACH (@letter) IN outer_table BEGIN 12 | FOREACH (@number) IN inner_table BEGIN 13 | PRINT CONCAT(@letter, @number); 14 | END 15 | END 16 | 17 | --output-- 18 | A1 19 | A2 20 | B1 21 | B2 -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/Interop/Dialogs/DialogShowState.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Dialogs 4 | { 5 | /// Dialog Show State 6 | public enum DialogShowState 7 | { 8 | /// Pre Show 9 | PreShow, 10 | 11 | /// Currently Showing 12 | Showing, 13 | 14 | /// Currently Closing 15 | Closing, 16 | 17 | /// Closed 18 | Closed 19 | } 20 | } -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=crlf 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Dialogs 4 | { 5 | /// Specifies the initial display location for a task dialog. 6 | public enum TaskDialogStartupLocation 7 | { 8 | /// The window placed in the center of the screen. 9 | CenterScreen, 10 | 11 | /// The window centered relative to the window that launched the dialog. 12 | CenterOwner 13 | } 14 | } -------------------------------------------------------------------------------- /src/Tests/scripts/doc/windowfunctions - Introduction to Window Functions 1.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/windowfunctions.html 2 | CREATE TABLE t0(x INTEGER PRIMARY KEY, y TEXT); 3 | INSERT INTO t0 VALUES (1, 'aaa'), (2, 'ccc'), (3, 'bbb'); 4 | 5 | -- The following SELECT statement returns: 6 | -- 7 | -- x | y | row_number 8 | ----------------------- 9 | -- 1 | aaa | 1 10 | -- 2 | ccc | 3 11 | -- 3 | bbb | 2 12 | -- 13 | SELECT x, y, row_number() OVER (ORDER BY y) AS row_number FROM t0 ORDER BY x; 14 | 15 | --output-- 16 | x,y,row_number 17 | 1,aaa,1 18 | 2,ccc,3 19 | 3,bbb,2 20 | - 21 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/ExtendedLinguisticServices/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. If you need to access a type in this assembly 7 | // from COM, set the ComVisible attribute to true on that type. 8 | [assembly: ComVisible(false)] 9 | 10 | // The following _guid is for the ID of the typelib if this project is exposed to COM 11 | [assembly: Guid("938c7476-7ae8-47f9-8c8a-e4e9ea182c23")] -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/KnownFolders/RetrievalOptions.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Shell 4 | { 5 | /// Contains special retrieval options for known folders. 6 | internal enum RetrievalOptions 7 | { 8 | None = 0, 9 | Create = 0x00008000, 10 | DontVerify = 0x00004000, 11 | DontUnexpand = 0x00002000, 12 | NoAlias = 0x00001000, 13 | Init = 0x00000800, 14 | DefaultPath = 0x00000400, 15 | NotParentRelative = 0x00000200 16 | } 17 | } -------------------------------------------------------------------------------- /ext/README.md: -------------------------------------------------------------------------------- 1 | # Third Party Libraries 2 | 3 | ## dockpanelsuite 4 | - https://github.com/dockpanelsuite/dockpanelsuite/archive/84647c729c6709497b2d9a51313094134a9e8433.zip 5 | - License: MIT 6 | - The source has been modified from upstream. 7 | 8 | ## fatcow 9 | - http://www.fatcow.com/free-icons (R.I.P.) 10 | - License: Creative Commons Attribution 3.0 11 | 12 | ## sqlite 13 | - License: Public domain 14 | - Downloaded by `ps1/Update-Deps.ps1`. 15 | 16 | ## Windows-API-Code-Pack 17 | - https://github.com/contre/Windows-API-Code-Pack-1.1/archive/a8377ef8bb6fa95ff8800dd4c79089537087d539.zip 18 | - License: Microsoft software license 19 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Dialogs 4 | { 5 | /// Specifies the options for expand/collapse sections in dialogs. 6 | public enum TaskDialogExpandedDetailsLocation 7 | { 8 | /// Do not show the content. 9 | Hide, 10 | 11 | /// Show the content. 12 | ExpandContent, 13 | 14 | /// Expand the footer content. 15 | ExpandFooter 16 | } 17 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ExportCsvStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | public sealed class ExportCsvStmt : Stmt 6 | { 7 | public Expr FilenameExpr { get; set; } 8 | public IdentifierOrExpr TableNameOrNull { get; set; } 9 | public IdentifierOrExpr ScriptNameOrNull { get; set; } 10 | public SqlStmt SelectStmtOrNull { get; set; } 11 | public OptionsList OptionsList { get; set; } 12 | 13 | protected override IEnumerable GetChildren() => 14 | new Node[] { FilenameExpr, TableNameOrNull, ScriptNameOrNull, SelectStmtOrNull, OptionsList }; 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SQL Notebook — casual data exploration in SQL 2 | 3 | Import your data from CSV, Excel, Microsoft SQL Server, PostgreSQL, and MySQL. Use a Jupyter-style notebook interface for exploratory queries, and write stored procedures for reusable logic. SQL Notebook is powered by an extended SQLite engine, supporting both standard SQL queries and SQL Notebook-specific commands and functions. 4 | 5 |

6 | Learn more at the SQL Notebook website 7 |

8 |

9 | 10 |

11 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/declare-stmt.sql: -------------------------------------------------------------------------------- 1 | -- @a, @b, and @c are local variables. 2 | DECLARE @a = 1 + 2; 3 | PRINT @a; -- "3" 4 | 5 | DECLARE @b = (SELECT COUNT(*) FROM sqlite_master); 6 | PRINT @b; -- "0" 7 | 8 | DECLARE @c; 9 | IF @c IS NULL 10 | PRINT 'c is null'; -- Prints. 11 | 12 | -- Creates a parameter variable called @optionalParam. Because 13 | -- an initial value of 5 is specified, the caller is not required 14 | -- to provide a value for this parameter, but may do so if it wants 15 | -- to override the default value. 16 | DECLARE PARAMETER @optionalParam = 5; 17 | PRINT @optionalParam; 18 | 19 | --output-- 20 | 3 21 | 0 22 | c is null 23 | 5 24 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/DataTables/MemorySimpleDataTable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.DataTables; 4 | 5 | public sealed class MemorySimpleDataTable : SimpleDataTable 6 | { 7 | public MemorySimpleDataTable(IReadOnlyList columns, IReadOnlyList rows, long fullCount) 8 | { 9 | Columns = columns; 10 | Rows = rows; 11 | FullCount = fullCount; 12 | 13 | var dict = new Dictionary(); 14 | int i = 0; 15 | foreach (var columnName in columns) 16 | { 17 | dict[columnName] = i++; 18 | } 19 | _columnIndices = dict; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /scripts/get-native-arch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | # Detect the native architecture: x64 or ARM64? 5 | # 6 | # Don't use $PROCESSOR_ARCHITECTURE directly; that reports the architecture of bash.exe which is always x64 even in the 7 | # supposedly arm64 build of Git for Windows. 8 | # 9 | # Instead, invoke PowerShell and check it there, because powershell.exe is always the correct architecture. 10 | ARCH=$(powershell.exe -NoProfile -Command "[System.Environment]::GetEnvironmentVariable('PROCESSOR_ARCHITECTURE', 'Machine')") 11 | case "$ARCH" in 12 | "ARM64") PLATFORM="ARM64" ;; 13 | *) PLATFORM="x64" ;; # Default to x64 for all other values 14 | esac 15 | 16 | echo -n "$PLATFORM" 17 | -------------------------------------------------------------------------------- /src/SqlNotebook/Import/ImportPreviewControl.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using System.Windows.Forms; 3 | 4 | namespace SqlNotebook.Import; 5 | 6 | public partial class ImportPreviewControl : UserControl 7 | { 8 | private readonly DataGridView _grid; 9 | 10 | public ImportPreviewControl(DataTable table) 11 | { 12 | InitializeComponent(); 13 | 14 | Controls.Add(_grid = DataGridViewUtil.NewDataGridView()); 15 | _grid.Dock = DockStyle.Fill; 16 | _grid.DataSource = table; 17 | _grid.AutoSizeColumns(this.Scaled(500)); 18 | 19 | Disposed += delegate 20 | { 21 | table.Dispose(); 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT TXT TAKE_LINES.sql: -------------------------------------------------------------------------------- 1 | -- Happy path 2 | IMPORT TXT '\utf8.txt' INTO table1 3 | OPTIONS (TAKE_LINES: 2); 4 | SELECT * FROM table1; 5 | 6 | -- Take more lines than are present. 7 | IMPORT TXT '\utf8.txt' INTO table2 8 | OPTIONS (TAKE_LINES: 100); 9 | SELECT * FROM table2; 10 | 11 | -- Pass -1, which takes the whole file. 12 | IMPORT TXT '\utf8.txt' INTO table3 13 | OPTIONS (TAKE_LINES: -1); 14 | SELECT * FROM table3; 15 | 16 | --output-- 17 | number,line 18 | 1,abc 19 | 2,def 20 | - 21 | number,line 22 | 1,abc 23 | 2,def 24 | 3,ghi 25 | 4,jkl 26 | 5,mno 27 | - 28 | number,line 29 | 1,abc 30 | 2,def 31 | 3,ghi 32 | 4,jkl 33 | 5,mno 34 | - 35 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using System; 4 | 5 | namespace Microsoft.WindowsAPICodePack.Dialogs.Controls 6 | { 7 | /// Specifies a property, event and method that indexed controls need to implement. 8 | /// not sure where else to put this, so leaving here for now. 9 | internal interface ICommonFileDialogIndexedControls 10 | { 11 | event EventHandler SelectedIndexChanged; 12 | 13 | int SelectedIndex { get; set; } 14 | 15 | void RaiseSelectedIndexChangedEvent(); 16 | } 17 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/AdoModules/AdoCreateInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace SqlNotebookScript.Core.AdoModules; 5 | 6 | public record class AdoCreateInfo 7 | { 8 | public Func ConnectionCreator { get; init; } 9 | 10 | /// 11 | /// Should contain {0} as a placeholder for the escaped table name including surrounding quotes. 12 | /// 13 | public string SelectRandomSampleSql { get; init; } 14 | 15 | // For SQL Server we need to fall back to a non-TABLESAMPLE for views 16 | public string SelectRandomSampleSqlFallback { get; init; } 17 | 18 | // " or ` 19 | public char EscapeChar; 20 | } 21 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS LAST_ROW.sql: -------------------------------------------------------------------------------- 1 | -- Last row but no first row 2 | IMPORT XLS '\excel.xlsx' WORKSHEET 2 INTO table1 OPTIONS (LAST_ROW: 3); 3 | SELECT * FROM table1; 4 | 5 | -- Last row is beyond the end of the data 6 | IMPORT XLS '\excel.xlsx' WORKSHEET 2 INTO table2 OPTIONS (LAST_ROW: 200); 7 | SELECT * FROM table2; 8 | 9 | -- 0 = whole file 10 | IMPORT XLS '\excel.xlsx' WORKSHEET 2 INTO table3 OPTIONS (LAST_ROW: 0); 11 | SELECT * FROM table3; 12 | 13 | --output-- 14 | colA,colB 15 | 111,222 16 | 333,444 17 | - 18 | colA,colB 19 | 111,222 20 | 333,444 21 | 555,666 22 | 777,888 23 | - 24 | colA,colB 25 | 111,222 26 | 333,444 27 | 555,666 28 | 777,888 29 | - 30 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/Interop/Common/ShellCOMClasses.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace Microsoft.WindowsAPICodePack.Shell 7 | { 8 | [ComImport, 9 | Guid(ShellIIDGuid.IShellLibrary), 10 | CoClass(typeof(ShellLibraryCoClass))] 11 | internal interface INativeShellLibrary : IShellLibrary 12 | { 13 | } 14 | 15 | [ComImport, 16 | ClassInterface(ClassInterfaceType.None), 17 | TypeLibType(TypeLibTypeFlags.FCanCreate), 18 | Guid(ShellCLSIDGuid.ShellLibrary)] 19 | internal class ShellLibraryCoClass 20 | { 21 | } 22 | } -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/ImportTxtStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SqlNotebookScript.Interpreter.Ast; 4 | 5 | // import-txt-stmt 6 | public sealed class ImportTxtStmt : Stmt 7 | { 8 | public Expr FilenameExpr { get; set; } 9 | public IdentifierOrExpr TableName { get; set; } 10 | public IdentifierOrExpr LineNumberColumnName { get; set; } // may be null 11 | public IdentifierOrExpr TextColumnName { get; set; } // may be null 12 | public OptionsList OptionsList { get; set; } 13 | 14 | protected override IEnumerable GetChildren() => 15 | new Node[] { FilenameExpr, TableName, LineNumberColumnName, TextColumnName, OptionsList }; 16 | } 17 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/ShellExtensions/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System.Security; 3 | 4 | //Use the original security model 5 | //See: http://msdn.microsoft.com/en-us/library/ee191569.aspx 6 | [assembly: SecurityRules(SecurityRuleSet.Level1)] 7 | 8 | // Setting ComVisible to false makes the types in this assembly not visible to COM components. If you need to access a type in this assembly 9 | // from COM, set the ComVisible attribute to true on that type. 10 | [assembly: ComVisible(false)] 11 | 12 | // The following GUID is for the ID of the typelib if this project is exposed to COM 13 | [assembly: Guid("dd26f0bf-d274-4c1a-8db2-f5d54ef255d3")] -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV BLANK_VALUES 1.sql: -------------------------------------------------------------------------------- 1 | -- Blank values: Import as an empty string. 2 | -- If conversion fails, skip row 3 | IMPORT CSV '\blank-values.csv' INTO table1 (a INTEGER, b INTEGER, c INTEGER) 4 | OPTIONS (BLANK_VALUES: 1, IF_CONVERSION_FAILS: 2); 5 | 6 | SELECT * FROM table1; 7 | 8 | -- Blank values: Import as an empty string. 9 | -- If conversion fails, import as text 10 | IMPORT CSV '\blank-values.csv' INTO table2 (a INTEGER, b INTEGER, c INTEGER) 11 | OPTIONS (BLANK_VALUES: 1, IF_CONVERSION_FAILS: 1); 12 | 13 | SELECT *, TYPEOF(b) AS type FROM table2; 14 | 15 | --output-- 16 | a,b,c 17 | 444,555,666 18 | - 19 | a,b,c,type 20 | 111,,333,text 21 | 444,555,666,integer 22 | - 23 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Core/SqliteInterop/Sqlite3IndexInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SqlNotebookScript.Core.SqliteInterop; 5 | 6 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 7 | public struct Sqlite3IndexInfo 8 | { 9 | public int nConstraint; 10 | public IntPtr aConstraint; 11 | public int nOrderBy; 12 | public IntPtr aOrderBy; 13 | public IntPtr aConstraintUsage; 14 | public int idxNum; 15 | public IntPtr idxStr; 16 | public int needToFreeIdxStr; 17 | public int orderByConsumed; 18 | public double estimatedCost; 19 | public long estimatedRows; 20 | public int idxFlags; 21 | public ulong colUsed; 22 | } 23 | -------------------------------------------------------------------------------- /doc/print-stmt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PRINT Statement 6 | 7 | 8 |

PRINT Statement

Prints the expression to the script or 9 | console output.
10 |

Syntax

PRINT expression;
11 |

Parameters

12 |
    13 |
  • expression: scalar
    14 | The value to be printed.
  • 15 |
16 |

Example

17 |
PRINT 5;
PRINT 1 + 2;
PRINT 'Hello world';
PRINT (SELECT COUNT(*) FROM sqlite_master);
18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /src/SqlNotebook/Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Release 8 | x64 9 | bin\publish 10 | FileSystem 11 | net9.0-windows 12 | win-x64 13 | true 14 | False 15 | True 16 | 17 | -------------------------------------------------------------------------------- /src/SqlNotebook/Import/Database/IImportSession.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Common; 3 | using System.Windows.Forms; 4 | 5 | namespace SqlNotebook.Import.Database; 6 | 7 | public interface IImportSession 8 | { 9 | bool FromConnectForm(IWin32Window owner); 10 | IReadOnlyList<(string Schema, string Table)> TableNames { get; } 11 | string GenerateSql(IEnumerable selectedTables, bool link); 12 | DbConnection CreateConnection(); 13 | DatabaseConnectionForm.BasicOptions GetBasicOptions(DbConnectionStringBuilder builder); 14 | void SetBasicOptions(DbConnectionStringBuilder builder, DatabaseConnectionForm.BasicOptions opt); 15 | void Clear(DbConnectionStringBuilder builder); 16 | } 17 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV BLANK_VALUES DEFAULT.sql: -------------------------------------------------------------------------------- 1 | -- Blank values: Import as NULL. (default) 2 | -- If conversion fails, skip row 3 | IMPORT CSV '\blank-values.csv' INTO table1 (a INTEGER, b INTEGER, c INTEGER) 4 | OPTIONS (IF_CONVERSION_FAILS: 2); 5 | 6 | SELECT *, TYPEOF(b) AS type FROM table1; 7 | 8 | -- Blank values: Import as NULL. (default) 9 | -- If conversion fails, import as text 10 | IMPORT CSV '\blank-values.csv' INTO table2 (a INTEGER, b INTEGER, c INTEGER) 11 | OPTIONS (IF_CONVERSION_FAILS: 1); 12 | 13 | SELECT *, TYPEOF(b) AS type FROM table2; 14 | 15 | --output-- 16 | a,b,c,type 17 | 111,null,333,null 18 | 444,555,666,integer 19 | - 20 | a,b,c,type 21 | 111,null,333,null 22 | 444,555,666,integer 23 | - 24 | -------------------------------------------------------------------------------- /src/Tests/scripts/doc/rowvalue - Update multiple columns of a table based on a query.sql.sql: -------------------------------------------------------------------------------- 1 | -- https://sqlite.org/rowvalue.html 2 | CREATE TABLE ftsdocs (idxed, name, label, url, mtime, rid, type); 3 | CREATE TABLE event (mtime, objid); 4 | CREATE TABLE blob (uuid, rid); 5 | 6 | UPDATE ftsdocs SET 7 | idxed=1, 8 | name=NULL, 9 | (label,url,mtime) = 10 | (SELECT printf('Check-in [%%.16s] on %%s',blob.uuid, 11 | datetime(event.mtime)), 12 | printf('/timeline?y=ci&c=%%.20s',blob.uuid), 13 | event.mtime 14 | FROM event, blob 15 | WHERE event.objid=ftsdocs.rid 16 | AND blob.rid=ftsdocs.rid) 17 | WHERE ftsdocs.type='c' AND NOT ftsdocs.idxed 18 | 19 | --output-- 20 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/ScalarFunctions/RegexpFunction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.RegularExpressions; 3 | using SqlNotebookScript.Utils; 4 | 5 | namespace SqlNotebookScript.ScalarFunctions; 6 | 7 | public sealed class RegexpFunction : CustomScalarFunction 8 | { 9 | public override bool IsDeterministic => true; 10 | public override string Name => "regexp"; 11 | public override int ParamCount => 2; 12 | 13 | public override object Execute(IReadOnlyList args) 14 | { 15 | var pattern = ArgUtil.GetStrArg(args[0], "pattern", Name); 16 | var text = args[1].ToString(); 17 | var regex = new Regex(pattern); 18 | return regex.IsMatch(text) ? 1 : 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV BLANK_VALUES 2.sql: -------------------------------------------------------------------------------- 1 | -- Blank values: Import as NULL. 2 | -- If conversion fails, skip row 3 | IMPORT CSV '\blank-values.csv' INTO table1 (a INTEGER, b INTEGER, c INTEGER) 4 | OPTIONS (BLANK_VALUES: 2, IF_CONVERSION_FAILS: 2); 5 | 6 | SELECT *, TYPEOF(b) AS type FROM table1; 7 | 8 | -- Blank values: Import as NULL. 9 | -- If conversion fails, import as text 10 | IMPORT CSV '\blank-values.csv' INTO table2 (a INTEGER, b INTEGER, c INTEGER) 11 | OPTIONS (BLANK_VALUES: 2, IF_CONVERSION_FAILS: 1); 12 | 13 | SELECT *, TYPEOF(b) AS type FROM table2; 14 | 15 | --output-- 16 | a,b,c,type 17 | 111,null,333,null 18 | 444,555,666,integer 19 | - 20 | a,b,c,type 21 | 111,null,333,null 22 | 444,555,666,integer 23 | - 24 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS BLANK_VALUES 1.sql: -------------------------------------------------------------------------------- 1 | -- Blank values: Import as an empty string. 2 | -- If conversion fails, skip row 3 | IMPORT XLS '\excel-blank-values.xlsx' WORKSHEET 1 INTO table1 (a INTEGER, b INTEGER, c INTEGER) 4 | OPTIONS (BLANK_VALUES: 1, IF_CONVERSION_FAILS: 2); 5 | 6 | SELECT * FROM table1; 7 | 8 | -- Blank values: Import as an empty string. 9 | -- If conversion fails, import as text 10 | IMPORT XLS '\excel-blank-values.xlsx' WORKSHEET 1 INTO table2 (a INTEGER, b INTEGER, c INTEGER) 11 | OPTIONS (BLANK_VALUES: 1, IF_CONVERSION_FAILS: 1); 12 | 13 | SELECT *, TYPEOF(b) AS type FROM table2; 14 | 15 | --output-- 16 | a,b,c 17 | 444,555,666 18 | - 19 | a,b,c,type 20 | 111,,333,text 21 | 444,555,666,integer 22 | - 23 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/SafeHandles/ZeroInvalidHandle.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace MS.WindowsAPICodePack.Internal 7 | { 8 | /// Base class for Safe handles with Null IntPtr as invalid 9 | public abstract class ZeroInvalidHandle : SafeHandle 10 | { 11 | /// Default constructor 12 | protected ZeroInvalidHandle() 13 | : base(IntPtr.Zero, true) 14 | { 15 | } 16 | 17 | /// Determines if this is a valid handle 18 | public override bool IsInvalid => handle == IntPtr.Zero; 19 | } 20 | } -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/DrawingRoutines.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Drawing.Drawing2D; 3 | 4 | namespace WeifenLuo.WinFormsUI.Docking { 5 | public static class DrawingRoutines { 6 | public static void SafelyDrawLinearGradient(Rectangle rectangle, Color startColor, Color endColor, 7 | LinearGradientMode mode, Graphics graphics) 8 | { 9 | if (rectangle.Width > 0 && rectangle.Height > 0) 10 | { 11 | using (LinearGradientBrush brush = new LinearGradientBrush(rectangle, startColor, endColor, mode)) 12 | { 13 | graphics.FillRectangle(brush, rectangle); 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/SqlNotebook/UserControlDockContent.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | using SqlNotebookScript.Utils; 3 | using WeifenLuo.WinFormsUI.Docking; 4 | 5 | namespace SqlNotebook; 6 | 7 | public partial class UserControlDockContent : DockContent 8 | { 9 | public IDocumentControl Content { get; private set; } 10 | 11 | public UserControlDockContent(string title, UserControl control, DockAreas dockAreas = DockAreas.Document) 12 | { 13 | InitializeComponent(); 14 | Text = title.EscapeAmpersand(); 15 | control.Dock = DockStyle.Fill; 16 | Controls.Add(control); 17 | Content = control as IDocumentControl; 18 | 19 | // disable floating windows 20 | DockAreas = dockAreas; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/SqlNotebookScript/Interpreter/Ast/SqlStmt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace SqlNotebookScript.Interpreter.Ast; 5 | 6 | public sealed class SqlStmt : Stmt 7 | { 8 | public string Sql { get; set; } 9 | public SqliteSyntaxProduction SqliteSyntax { get; set; } 10 | public int FirstTokenIndex { get; set; } 11 | 12 | // statements may be added here by the preprocessor 13 | public List RunBefore { get; set; } = new List(); 14 | public List RunAfter { get; set; } = new List(); 15 | 16 | protected override IEnumerable GetChildren() => 17 | new Node[] { SqliteSyntax } 18 | .Concat(RunBefore) 19 | .Concat(RunAfter); 20 | } 21 | -------------------------------------------------------------------------------- /web/doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SQL Notebook 8 | 9 | 10 | 11 | 12 |

    Documentation

    13 |

    SQL Notebook ships with an in-app searchable help system that includes all of the documentation listed here. Press F1 14 | inside the application to see the list of help topics.

    15 |

    There is extensive documentation available for SQLite, the engine that provides the foundation for SQL Notebook. 16 | Click here to view the SQLite documentation.

    17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /doc/year-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | YEAR Function 6 | 7 | 8 |

    YEAR Function

    9 |

    Returns the year part of a date/time string.

    10 |

    Syntax

    YEAR(date)
    11 |

    Arguments

    12 |
      13 |
    • date: text
      14 | A text value that can be parsed into a date/time.
    • 15 |
    16 |

    Return Value

    An integer representing the specified year.
    17 |

    Example

    18 |
    PRINT YEAR('2016-03-07');  -- "2016"
    PRINT YEAR('2015-07-23 22:06:53.742 -04:00'); -- "2015"
    19 | 20 | 21 | -------------------------------------------------------------------------------- /ext/dockpanelsuite/WinFormsUI/Docking/Helpers/Win32Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | 5 | namespace WeifenLuo.WinFormsUI.Docking 6 | { 7 | public static class Win32Helper 8 | { 9 | private static readonly bool _isRunningOnMono = Type.GetType("Mono.Runtime") != null; 10 | 11 | public static bool IsRunningOnMono { get { return _isRunningOnMono; } } 12 | 13 | internal static Control ControlAtPoint(Point pt) 14 | { 15 | return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt)); 16 | } 17 | 18 | internal static uint MakeLong(int low, int high) 19 | { 20 | return (uint)((high << 16) + low); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT CSV BLANK_VALUES 3.sql: -------------------------------------------------------------------------------- 1 | -- Blank values: Import as empty string or NULL. 2 | -- If conversion fails, skip row 3 | IMPORT CSV '\blank-values.csv' INTO table1 (a INTEGER, b INTEGER, c INTEGER) 4 | OPTIONS (BLANK_VALUES: 3, IF_CONVERSION_FAILS: 2); 5 | 6 | SELECT *, TYPEOF(b) AS type FROM table1; 7 | 8 | -- Blank values: Import as empty string or NULL. 9 | -- If conversion fails, skip row 10 | IMPORT CSV '\blank-values.csv' INTO table2 (a INTEGER, b TEXT, c INTEGER) 11 | OPTIONS (BLANK_VALUES: 3, IF_CONVERSION_FAILS: 2); 12 | 13 | SELECT *, TYPEOF(b) AS type FROM table2; 14 | 15 | --output-- 16 | a,b,c,type 17 | 111,null,333,null 18 | 444,555,666,integer 19 | - 20 | a,b,c,type 21 | 111,,333,text 22 | 444,555,666,text 23 | - 24 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogControl.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace Microsoft.WindowsAPICodePack.Dialogs 4 | { 5 | /// Declares the abstract base class for all custom task dialog controls. 6 | public abstract class TaskDialogControl : DialogControl 7 | { 8 | /// Creates a new instance of a task dialog control. 9 | protected TaskDialogControl() { } 10 | 11 | /// Creates a new instance of a task dialog control with the specified name. 12 | /// The name for this control. 13 | protected TaskDialogControl(string name) : base(name) { } 14 | } 15 | } -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/SafeHandles/SafeIconHandle.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace MS.WindowsAPICodePack.Internal 4 | { 5 | /// Safe Icon Handle 6 | public class SafeIconHandle : ZeroInvalidHandle 7 | { 8 | /// Release the handle 9 | /// true if handled is release successfully, false otherwise 10 | protected override bool ReleaseHandle() 11 | { 12 | if (CoreNativeMethods.DestroyIcon(handle)) 13 | { 14 | return true; 15 | } 16 | else 17 | { 18 | return false; 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Shell/Taskbar/TaskbarInterfaces.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | using Microsoft.WindowsAPICodePack.Shell; 4 | namespace Microsoft.WindowsAPICodePack.Taskbar 5 | { 6 | /// 7 | /// Interface for jump list items 8 | /// 9 | public interface IJumpListItem 10 | { 11 | /// 12 | /// Gets or sets this item's path 13 | /// 14 | string Path { get; set; } 15 | } 16 | 17 | /// 18 | /// Interface for jump list tasks 19 | /// 20 | public abstract class JumpListTask 21 | { 22 | internal abstract IShellLinkW NativeShellLink { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Tests/scripts/IMPORT XLS BLANK_VALUES DEFAULT.sql: -------------------------------------------------------------------------------- 1 | -- Blank values: Import as NULL. (default) 2 | -- If conversion fails, skip row 3 | IMPORT XLS '\excel-blank-values.xlsx' WORKSHEET 1 INTO table1 (a INTEGER, b INTEGER, c INTEGER) 4 | OPTIONS (IF_CONVERSION_FAILS: 2); 5 | 6 | SELECT *, TYPEOF(b) AS type FROM table1; 7 | 8 | -- Blank values: Import as NULL. (default) 9 | -- If conversion fails, import as text 10 | IMPORT XLS '\excel-blank-values.xlsx' WORKSHEET 1 INTO table2 (a INTEGER, b INTEGER, c INTEGER) 11 | OPTIONS (IF_CONVERSION_FAILS: 1); 12 | 13 | SELECT *, TYPEOF(b) AS type FROM table2; 14 | 15 | --output-- 16 | a,b,c,type 17 | 111,null,333,null 18 | 444,555,666,integer 19 | - 20 | a,b,c,type 21 | 111,null,333,null 22 | 444,555,666,integer 23 | - 24 | -------------------------------------------------------------------------------- /doc/day-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DAY Function 6 | 7 | 8 |

    DAY Function

    9 |

    Returns the day-of-month part of a date/time string.

    10 |

    Syntax

    DAY(date)
    11 |

    Parameters

    12 |
      13 |
    • date: time
      14 | A text value that can be parsed into a date/time.
    • 15 |
    16 |

    Return Value

    An integer representing the specified day of the month.
    17 |

    Examples

    18 |
    PRINT DAY('2016-03-07');  -- "7"
    PRINT DAY('2016-07-23 22:06:53.742 -04:00'); -- "23"
    19 | 20 | 21 | -------------------------------------------------------------------------------- /ext/Windows-API-Code-Pack/source/WindowsAPICodePack/Core/SafeHandles/SafeRegionHandle.cs: -------------------------------------------------------------------------------- 1 | //Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | namespace MS.WindowsAPICodePack.Internal 4 | { 5 | /// Safe Region Handle 6 | public class SafeRegionHandle : ZeroInvalidHandle 7 | { 8 | /// Release the handle 9 | /// true if handled is release successfully, false otherwise 10 | protected override bool ReleaseHandle() 11 | { 12 | if (CoreNativeMethods.DeleteObject(handle)) 13 | { 14 | return true; 15 | } 16 | else 17 | { 18 | return false; 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /doc/month-func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MONTH Function 6 | 7 | 8 |

    MONTH Function

    9 |

    Returns the month part of a date/time string, represented as an integer 1-12.

    10 |

    Syntax

    MONTH(date)
    11 |

    Parameters

    12 |
      13 |
    • date: text
      14 | A text value that can be parsed into a date/time.
    • 15 |
    16 |

    Return Value

    An integer representing the month.
    17 |

    Example

    18 |
    PRINT MONTH('2016-03-07');  -- "3"
    PRINT MONTH('2016-07-23 22:06:53.742 -04:00'); -- "7"
    19 | 20 | 21 | --------------------------------------------------------------------------------