diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c375680f77..00d9dde30a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,255 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-08 18:22 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbtask.h + * harbour/source/vm/maindllh/Makefile + * harbour/source/vm/task.c + * harbour/source/vm/hvmall.c + * harbour/source/rtl/cputime.c + * harbour/contrib/hbmysql/hbmysql.hbc + * harbour/contrib/xhb/xhb.hbc + * harbour/contrib/xhb/xhberrc.c + * harbour/contrib/xhb/xhbver.ch + * harbour/contrib/hbodbc/hbodbc.hbc + * harbour/contrib/hbtpathy/hbtpathy.hbc + * harbour/contrib/hbsqlit3/tests/hooks.prg + * harbour/contrib/hbsqlit3/tests/backup.prg + * harbour/contrib/hbsqlit3/tests/authoriz.prg + * harbour/contrib/hbsqlit3/hbsqlit3.hbc + * harbour/contrib/hbmzip/hbmzip.hbc + * harbour/contrib/hbqt/QDragEnterEvent.cpp + * harbour/contrib/hbqt/QWebSecurityOrigin.cpp + * harbour/contrib/hbqt/QConicalGradient.cpp + * harbour/contrib/hbqt/TQWidgetItem.prg + * harbour/contrib/hbqt/QGradient.cpp + * harbour/contrib/hbqt/TQDropEvent.prg + * harbour/contrib/hbqt/QStandardItemModel.cpp + * harbour/contrib/hbqt/TQTextObject.prg + * harbour/contrib/hbqt/QPicture.cpp + * harbour/contrib/hbqt/TQStyleHintReturn.prg + * harbour/contrib/hbqt/QStyledItemDelegate.cpp + * harbour/contrib/hbqt/QAbstractListModel.cpp + * harbour/contrib/hbqt/TQFontDatabase.prg + * harbour/contrib/hbqt/QResource.cpp + * harbour/contrib/hbqt/TQWebHistory.prg + * harbour/contrib/hbqt/QMouseEvent.cpp + * harbour/contrib/hbqt/TQAbstractItemModel.prg + * harbour/contrib/hbqt/QStyleOptionHeader.cpp + * harbour/contrib/hbqt/QWheelEvent.cpp + * harbour/contrib/hbqt/QRadialGradient.cpp + * harbour/contrib/hbqt/QCursor.cpp + * harbour/contrib/hbqt/QFocusEvent.cpp + * harbour/contrib/hbqt/QStyleHintReturn.cpp + * harbour/contrib/hbqt/QStyleOptionToolButton.cpp + * harbour/contrib/hbqt/QStylePainter.cpp + * harbour/contrib/hbqt/QWebPluginFactory.cpp + * harbour/contrib/hbqt/TQSystemTrayIcon.prg + * harbour/contrib/hbqt/QLinearGradient.cpp + * harbour/contrib/hbqt/QDragLeaveEvent.cpp + * harbour/contrib/hbqt/TQStyleOptionViewItem.prg + * harbour/contrib/hbqt/QStyleOptionToolBox.cpp + * harbour/contrib/hbqt/QStyleOptionTabBarBase.cpp + * harbour/contrib/hbqt/QStringList.cpp + * harbour/contrib/hbqt/TQStyleOptionTitleBar.prg + * harbour/contrib/hbqt/TQSound.prg + * harbour/contrib/hbqt/TQGradient.prg + * harbour/contrib/hbqt/TQWebSettings.prg + * harbour/contrib/hbqt/TQApplication.prg + * harbour/contrib/hbqt/QStyleOptionViewItem.cpp + * harbour/contrib/hbqt/TQCoreApplication.prg + * harbour/contrib/hbqt/TQKeySequence.prg + * harbour/contrib/hbqt/QStyleOptionToolBar.cpp + * harbour/contrib/hbqt/QStyleOptionTitleBar.cpp + * harbour/contrib/hbqt/TQResource.prg + * harbour/contrib/hbqt/QStyleOptionButton.cpp + * harbour/contrib/hbqt/QSizePolicy.cpp + * harbour/contrib/hbqt/QWebSettings.cpp + * harbour/contrib/hbqt/TQStyleOptionSizeGrip.prg + * harbour/contrib/hbqt/TQStyleOptionGroupBox.prg + * harbour/contrib/hbqt/TQStylePainter.prg + * harbour/contrib/hbqt/TQWebPluginFactory.prg + * harbour/contrib/hbqt/QKeySequence.cpp + * harbour/contrib/hbqt/QKeyEvent.cpp + * harbour/contrib/hbqt/QStyleOptionSlider.cpp + * harbour/contrib/hbqt/TQDragMoveEvent.prg + * harbour/contrib/hbqt/QWidgetItem.cpp + * harbour/contrib/hbqt/QStyleOptionSizeGrip.cpp + * harbour/contrib/hbqt/TQWebHistoryItem.prg + * harbour/contrib/hbqt/QTextObject.cpp + * harbour/contrib/hbqt/QStyleOptionGroupBox.cpp + * harbour/contrib/hbqt/QImage.cpp + * harbour/contrib/hbqt/QLine.cpp + * harbour/contrib/hbqt/TQStyleOptionProgressBar.prg + * harbour/contrib/hbqt/QWebHistory.cpp + * harbour/contrib/hbqt/TQStyleHintReturnVariant.prg + * harbour/contrib/hbqt/TQWebSecurityOrigin.prg + * harbour/contrib/hbqt/TQStyleOptionTab.prg + * harbour/contrib/hbqt/TQStringListModel.prg + * harbour/contrib/hbqt/QWebHitTestResult.cpp + * harbour/contrib/hbqt/TQStandardItemModel.prg + * harbour/contrib/hbqt/QSystemTrayIcon.cpp + * harbour/contrib/hbqt/QStyleOptionDockWidget.cpp + * harbour/contrib/hbqt/TQFileSystemModel.prg + * harbour/contrib/hbqt/QStyleOptionTabWidgetFrame.cpp + * harbour/contrib/hbqt/QStyleOptionFocusRect.cpp + * harbour/contrib/hbqt/QMoveEvent.cpp + * harbour/contrib/hbqt/TQImageWriter.prg + * harbour/contrib/hbqt/TQAbstractListModel.prg + * harbour/contrib/hbqt/QWidgetAction.cpp + * harbour/contrib/hbqt/TQModelIndex.prg + * harbour/contrib/hbqt/QStringListModel.cpp + * harbour/contrib/hbqt/TQKeyEvent.prg + * harbour/contrib/hbqt/TQStyleOptionMenuItem.prg + * harbour/contrib/hbqt/TQStyleOptionHeader.prg + * harbour/contrib/hbqt/QFileSystemModel.cpp + * harbour/contrib/hbqt/TQWebHistoryInterface.prg + * harbour/contrib/hbqt/TQStyleOptionComboBox.prg + * harbour/contrib/hbqt/TQBrush.prg + * harbour/contrib/hbqt/TQStyleOptionToolButton.prg + * harbour/contrib/hbqt/QImageWriter.cpp + * harbour/contrib/hbqt/TQLine.prg + * harbour/contrib/hbqt/TQAbstractTableModel.prg + * harbour/contrib/hbqt/TQStyleOptionTabBarBase.prg + * harbour/contrib/hbqt/QStyleOptionMenuItem.cpp + * harbour/contrib/hbqt/TQImageReader.prg + * harbour/contrib/hbqt/QDropEvent.cpp + * harbour/contrib/hbqt/TQColor.prg + * harbour/contrib/hbqt/TQStyleOptionComplex.prg + * harbour/contrib/hbqt/TQWebHitTestResult.prg + * harbour/contrib/hbqt/QLatin1String.cpp + * harbour/contrib/hbqt/QStandardItem.cpp + * harbour/contrib/hbqt/TQLatin1Char.prg + * harbour/contrib/hbqt/QWebHistoryInterface.cpp + * harbour/contrib/hbqt/QStyleOptionComboBox.cpp + * harbour/contrib/hbqt/TQStyleOptionSpinBox.prg + * harbour/contrib/hbqt/TQPalette.prg + * harbour/contrib/hbqt/TQResizeEvent.prg + * harbour/contrib/hbqt/TQStyleOptionFocusRect.prg + * harbour/contrib/hbqt/QAbstractItemModel.cpp + * harbour/contrib/hbqt/QImageReader.cpp + * harbour/contrib/hbqt/TQDragEnterEvent.prg + * harbour/contrib/hbqt/TQWidgetAction.prg + * harbour/contrib/hbqt/QWebHistoryItem.cpp + * harbour/contrib/hbqt/TQStyleOptionButton.prg + * harbour/contrib/hbqt/QDateTime.cpp + * harbour/contrib/hbqt/QPalette.cpp + * harbour/contrib/hbqt/QStyleOptionProgressBar.cpp + * harbour/contrib/hbqt/QResizeEvent.cpp + * harbour/contrib/hbqt/TQStyledItemDelegate.prg + * harbour/contrib/hbqt/QStyleHintReturnVariant.cpp + * harbour/contrib/hbqt/QList.cpp + * harbour/contrib/hbqt/QStyleOptionTab.cpp + * harbour/contrib/hbqt/TQStyleOption.prg + * harbour/contrib/hbqt/TQMouseEvent.prg + * harbour/contrib/hbqt/TQStyleOptionSlider.prg + * harbour/contrib/hbqt/QWebFrame.cpp + * harbour/contrib/hbqt/QSound.cpp + * harbour/contrib/hbqt/QDirModel.cpp + * harbour/contrib/hbqt/TQWheelEvent.prg + * harbour/contrib/hbqt/TQRadialGradient.prg + * harbour/contrib/hbqt/QStyleOptionFrame.cpp + * harbour/contrib/hbqt/TQCursor.prg + * harbour/contrib/hbqt/TQStandardItem.prg + * harbour/contrib/hbqt/TQLatin1String.prg + * harbour/contrib/hbqt/TQFocusEvent.prg + * harbour/contrib/hbqt/TQImage.prg + * harbour/contrib/hbqt/TQLinearGradient.prg + * harbour/contrib/hbqt/TQDragLeaveEvent.prg + * harbour/contrib/hbqt/QModelIndex.cpp + * harbour/contrib/hbqt/TQStyleHintReturnMask.prg + * harbour/contrib/hbqt/QStyleOption.cpp + * harbour/contrib/hbqt/TQStyleOptionToolBox.prg + * harbour/contrib/hbqt/TQStringList.prg + * harbour/contrib/hbqt/hbqt.ch + * harbour/contrib/hbqt/TQDateTime.prg + * harbour/contrib/hbqt/TQStyleOptionDockWidget.prg + * harbour/contrib/hbqt/TQStyleOptionTabWidgetFrame.prg + * harbour/contrib/hbqt/QFontDatabase.cpp + * harbour/contrib/hbqt/QAbstractTableModel.cpp + * harbour/contrib/hbqt/QStyleHintReturnMask.cpp + * harbour/contrib/hbqt/TQMoveEvent.prg + * harbour/contrib/hbqt/TQList.prg + * harbour/contrib/hbqt/TQStyleOptionToolBar.prg + * harbour/contrib/hbqt/QDragMoveEvent.cpp + * harbour/contrib/hbqt/TQConicalGradient.prg + * harbour/contrib/hbqt/QStyleOptionComplex.cpp + * harbour/contrib/hbqt/TQWebFrame.prg + * harbour/contrib/hbqt/TQSizePolicy.prg + * harbour/contrib/hbqt/QLatin1Char.cpp + * harbour/contrib/hbqt/TQDirModel.prg + * harbour/contrib/hbqt/QStyleOptionSpinBox.cpp + * harbour/contrib/hbqt/TQStyleOptionFrame.prg + * harbour/contrib/hbqt/TQPicture.prg + * harbour/contrib/hbfbird/hbfbird.hbc + * harbour/contrib/hbziparc/hbziparc.hbc + * harbour/contrib/hbxbp/xbpappevent.prg + * harbour/contrib/hbxbp/xbpsle.prg + * harbour/contrib/hbxbp/xbplistbox.prg + * harbour/contrib/hbxbp/xbpcheckbox.prg + * harbour/contrib/hbxbp/xbpmenubar.prg + * harbour/contrib/hbxbp/xbpradiobutton.prg + * harbour/contrib/hbxbp/xbpfiledialog.prg + * harbour/contrib/hbxbp/gra.ch + * harbour/contrib/hbxbp/tests/demoxbp.prg + * harbour/contrib/hbxbp/xbptabpage.prg + * harbour/contrib/hbxbp/xbpwindow.prg + * harbour/contrib/hbxbp/xbpcombobox.prg + * harbour/contrib/hbxbp/xbpstatusbar.prg + * harbour/contrib/hbxbp/xbppushbutton.prg + * harbour/contrib/hbxbp/Makefile + * harbour/contrib/hbxbp/xbpbitmap.prg + * harbour/contrib/hbxbp/xbp.ch + * harbour/contrib/hbxbp/xbpscrollbar.prg + * harbour/contrib/hbxbp/xbpfontdialog.prg + * harbour/contrib/hbxbp/xbphtmlviewer.prg + * harbour/contrib/hbxbp/xbpstatic.prg + * harbour/contrib/hbxbp/xbptreeview.prg + * harbour/contrib/hbxbp/xbpdialog.prg + * harbour/contrib/hbxbp/xbpstyle.prg + * harbour/contrib/hbxbp/xbptoolbar.prg + * harbour/contrib/hbxbp/xbp3state.prg + * harbour/contrib/hbxbp/xbpparthandler.prg + * harbour/contrib/hbxbp/xbpspinbutton.prg + * harbour/contrib/hbxbp/xbpdataref.prg + * harbour/contrib/hbxbp/appevent.ch + * harbour/contrib/hbxbp/xbpgeneric.prg + * harbour/contrib/hbxbp/xbpmle.prg + * harbour/contrib/hbnf/hbnf.hbc + * harbour/contrib/hbcurl/hbcurl.hbc + * harbour/contrib/rddsql/rddsql.hbc + * harbour/contrib/hbhpdf/hbhpdf.hbc + * harbour/contrib/rddado/rddado.hbc + * harbour/contrib/gtwvg/gtwvg.hbc + * harbour/contrib/hbpgsql/hbpgsql.hbc + * harbour/contrib/rddads/rddads.hbc + * harbour/contrib/hbclipsm/hbclipsm.hbc + * harbour/contrib/hbfimage/hbfimage.hbc + * harbour/contrib/hbgd/hbgd.hbc + * harbour/contrib/hbmisc/hbmisc.hbc + * harbour/contrib/hbtip/hbtip.hbc + * harbour/contrib/hbwin/hbwin.hbc + * harbour/contrib/hbvpdf/hbvpdf.hbc + * harbour/contrib/hbbtree/hbbtree.hbc + * harbour/contrib/hbcrypt/hbcrypt.hbc + * harbour/contrib/hbssl/hbssl.hbc + * harbour/examples/pp/pp.hbp + * harbour/examples/hbdoc/hbdoc.hbp + * harbour/examples/hbmsql/hbmsql.hbc + * harbour/examples/hbsqlit2/hbsqlit2.hbc + * harbour/examples/hbapollo/hbapollo.hbc + * harbour/examples/pe/pe.hbp + * harbour/examples/guestbk/guestbk.hbp + * harbour/examples/hbgf/tests/hbgf.hbc + * harbour/examples/dbu/dbu.hbp + * harbour/examples/terminal/terminal.hbc + * harbour/examples/terminal/trm_app.hbp + * harbour/examples/hscript/hscript.hbp + * harbour/examples/hbwhat/hbwhat.hbc + * harbour/examples/rl/rl.hbp + ! fixed hardcode CRLF + * set svn attributes svn:eol-style and svn:keywords + 2009-07-08 15:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/fm.c ! fixed reference counter initialization in hb_xrealloc( NULL, size ); diff --git a/harbour/contrib/gtwvg/gtwvg.hbc b/harbour/contrib/gtwvg/gtwvg.hbc index 73126c20bc..3a906d799e 100644 --- a/harbour/contrib/gtwvg/gtwvg.hbc +++ b/harbour/contrib/gtwvg/gtwvg.hbc @@ -1,10 +1,10 @@ -# -# $Id$ -# - -{!win}skip=yes - -gt=gtwvg -libs=..\hbwin\hbwin.hbc -gui=yes -mt=yes +# +# $Id$ +# + +{!win}skip=yes + +gt=gtwvg +libs=..\hbwin\hbwin.hbc +gui=yes +mt=yes diff --git a/harbour/contrib/hbbtree/hbbtree.hbc b/harbour/contrib/hbbtree/hbbtree.hbc index 97c0914825..b536d04745 100644 --- a/harbour/contrib/hbbtree/hbbtree.hbc +++ b/harbour/contrib/hbbtree/hbbtree.hbc @@ -1,7 +1,7 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbbtree +# +# $Id$ +# + +incpaths=. + +libs=hbbtree diff --git a/harbour/contrib/hbclipsm/hbclipsm.hbc b/harbour/contrib/hbclipsm/hbclipsm.hbc index 90e36e0ef6..84f97dc338 100644 --- a/harbour/contrib/hbclipsm/hbclipsm.hbc +++ b/harbour/contrib/hbclipsm/hbclipsm.hbc @@ -1,7 +1,7 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbclipsm +# +# $Id$ +# + +incpaths=. + +libs=hbclipsm diff --git a/harbour/contrib/hbcrypt/hbcrypt.hbc b/harbour/contrib/hbcrypt/hbcrypt.hbc index a224628080..cd0930adbc 100644 --- a/harbour/contrib/hbcrypt/hbcrypt.hbc +++ b/harbour/contrib/hbcrypt/hbcrypt.hbc @@ -1,5 +1,5 @@ -# -# $Id$ -# - -libs=hbcrypt +# +# $Id$ +# + +libs=hbcrypt diff --git a/harbour/contrib/hbcurl/hbcurl.hbc b/harbour/contrib/hbcurl/hbcurl.hbc index 5fcbc244d8..6f6dfd5135 100644 --- a/harbour/contrib/hbcurl/hbcurl.hbc +++ b/harbour/contrib/hbcurl/hbcurl.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbcurl -libs=libcurl +# +# $Id$ +# + +incpaths=. + +libs=hbcurl +libs=libcurl diff --git a/harbour/contrib/hbfbird/hbfbird.hbc b/harbour/contrib/hbfbird/hbfbird.hbc index 249e5e8985..622f4b54c6 100644 --- a/harbour/contrib/hbfbird/hbfbird.hbc +++ b/harbour/contrib/hbfbird/hbfbird.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbfbird -libs=fbclient +# +# $Id$ +# + +incpaths=. + +libs=hbfbird +libs=fbclient diff --git a/harbour/contrib/hbfimage/hbfimage.hbc b/harbour/contrib/hbfimage/hbfimage.hbc index 53c82aeaf9..697ae61da9 100644 --- a/harbour/contrib/hbfimage/hbfimage.hbc +++ b/harbour/contrib/hbfimage/hbfimage.hbc @@ -1,10 +1,10 @@ -# -# $Id$ -# - -{dos}skip=yes - -incpaths=. - -libs=hbfimage -libs=freeimage +# +# $Id$ +# + +{dos}skip=yes + +incpaths=. + +libs=hbfimage +libs=freeimage diff --git a/harbour/contrib/hbgd/hbgd.hbc b/harbour/contrib/hbgd/hbgd.hbc index 6a4d5b06dc..009732894b 100644 --- a/harbour/contrib/hbgd/hbgd.hbc +++ b/harbour/contrib/hbgd/hbgd.hbc @@ -1,9 +1,9 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbgd -{win}libs=bgd -{linux}libs=gdlib png jpeg freetype m +# +# $Id$ +# + +incpaths=. + +libs=hbgd +{win}libs=bgd +{linux}libs=gdlib png jpeg freetype m diff --git a/harbour/contrib/hbhpdf/hbhpdf.hbc b/harbour/contrib/hbhpdf/hbhpdf.hbc index 17f48442c3..642a4a610c 100644 --- a/harbour/contrib/hbhpdf/hbhpdf.hbc +++ b/harbour/contrib/hbhpdf/hbhpdf.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbhpdf -libs=libhpdf libpng +# +# $Id$ +# + +incpaths=. + +libs=hbhpdf +libs=libhpdf libpng diff --git a/harbour/contrib/hbmisc/hbmisc.hbc b/harbour/contrib/hbmisc/hbmisc.hbc index 2873b65fa4..b742cfb757 100644 --- a/harbour/contrib/hbmisc/hbmisc.hbc +++ b/harbour/contrib/hbmisc/hbmisc.hbc @@ -1,5 +1,5 @@ -# -# $Id$ -# - -libs=hbmisc +# +# $Id$ +# + +libs=hbmisc diff --git a/harbour/contrib/hbmysql/hbmysql.hbc b/harbour/contrib/hbmysql/hbmysql.hbc index 07490bca3d..e5fc837b6d 100644 --- a/harbour/contrib/hbmysql/hbmysql.hbc +++ b/harbour/contrib/hbmysql/hbmysql.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbmysql -libs=libmysql +# +# $Id$ +# + +incpaths=. + +libs=hbmysql +libs=libmysql diff --git a/harbour/contrib/hbmzip/hbmzip.hbc b/harbour/contrib/hbmzip/hbmzip.hbc index 67db145018..b84faa4084 100644 --- a/harbour/contrib/hbmzip/hbmzip.hbc +++ b/harbour/contrib/hbmzip/hbmzip.hbc @@ -1,7 +1,7 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbmzip +# +# $Id$ +# + +incpaths=. + +libs=hbmzip diff --git a/harbour/contrib/hbnf/hbnf.hbc b/harbour/contrib/hbnf/hbnf.hbc index 4e3493a583..22bc7af4ba 100644 --- a/harbour/contrib/hbnf/hbnf.hbc +++ b/harbour/contrib/hbnf/hbnf.hbc @@ -1,7 +1,7 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbnf +# +# $Id$ +# + +incpaths=. + +libs=hbnf diff --git a/harbour/contrib/hbodbc/hbodbc.hbc b/harbour/contrib/hbodbc/hbodbc.hbc index ed88fa1ce3..826d32d74b 100644 --- a/harbour/contrib/hbodbc/hbodbc.hbc +++ b/harbour/contrib/hbodbc/hbodbc.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbodbc -{win}libs=odbc32 +# +# $Id$ +# + +incpaths=. + +libs=hbodbc +{win}libs=odbc32 diff --git a/harbour/contrib/hbpgsql/hbpgsql.hbc b/harbour/contrib/hbpgsql/hbpgsql.hbc index 0893b77526..3c9f17c06b 100644 --- a/harbour/contrib/hbpgsql/hbpgsql.hbc +++ b/harbour/contrib/hbpgsql/hbpgsql.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbpgsql -libs=libpq +# +# $Id$ +# + +incpaths=. + +libs=hbpgsql +libs=libpq diff --git a/harbour/contrib/hbsqlit3/hbsqlit3.hbc b/harbour/contrib/hbsqlit3/hbsqlit3.hbc index b2636e3f88..65a0e289ac 100644 --- a/harbour/contrib/hbsqlit3/hbsqlit3.hbc +++ b/harbour/contrib/hbsqlit3/hbsqlit3.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbsqlit3 -libs=sqlite3 +# +# $Id$ +# + +incpaths=. + +libs=hbsqlit3 +libs=sqlite3 diff --git a/harbour/contrib/hbsqlit3/tests/authoriz.prg b/harbour/contrib/hbsqlit3/tests/authoriz.prg index b69355f029..248bc527b8 100644 --- a/harbour/contrib/hbsqlit3/tests/authoriz.prg +++ b/harbour/contrib/hbsqlit3/tests/authoriz.prg @@ -1,255 +1,255 @@ -/* - * $Id$ - */ - -/* - * SQLite3 Demo. Using sqlite3_set_authorizer() - * - * Copyright 2009 P.Chornyj - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - * See COPYING for licensing terms. - * - */ - -/* - * Using sqlite3_set_authorizer() - * - * This routine registers a authorizer callback with a particular - * database connection, supplied in the first argument. - * The authorizer callback is invoked as SQL statements are being compiled - * by sqlite3_prepare(). - * - * When the callback returns SQLITE_OK, that means the operation requested - * is ok. - * When the callback returns SQLITE_DENY, the sqlite3_prepare() or - * equivalent call that triggered the authorizer will fail with an error - * message explaining that access is denied. - * If the authorizer code is SQLITE_READ and the callback returns - * SQLITE_IGNORE then the prepared statement statement is constructed to - * substitute a NULL value in place of the table column that would have - * been read if SQLITE_OK had been returned. - * The SQLITE_IGNORE return can be used to deny an untrusted user access - * to individual columns of a table. - * - * The first parameter to the authorizer callback is an integer - * action code that specifies the particular action to be authorized. - * The second through fourth parameters to the callback are strings - * that contain additional details about the action to be authorized. - */ - -#include "common.ch" -#include "hbsqlit3.ch" - -FUNCTION main() - LOCAL cFile := ":memory:", cSQLTEXT - LOCAL pDb, cb - // - IF Empty( pDb := PrepareDB(cFile) ) - RETURN 1 - ENDIF - // Authorizer1 - sqlite3_set_authorizer( pDb, @Authorizer() /*"Authorizer"*/ ) - - QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) - cb := @CallBack() // "CallBack" - Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) - - sqlite3_sleep( 3000 ) - // Authorizer2 - Qout( cErrorMsg(sqlite3_set_authorizer(pDb, @Authorizer2() /*"Authorizer2"*/)) ) - - QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) - Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) - - sqlite3_sleep( 3000 ) - // Authorizer3 - Qout( cErrorMsg(sqlite3_set_authorizer(pDb, @Authorizer3() /*"Authorizer3"*/)) ) - - QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) - Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb), FALSE) ) - - sqlite3_sleep( 3000 ) - // - pDb := Nil // close database - // -RETURN 0 - -/** -*/ -FUNCTION Authorizer( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) -LOCAL oldColor := SetColor( "R/N" ) - // - Qout( "=>", StrZero(nAction, 2), cName1, cName2, cDatabaseName, cTriggerOrViewName ) - - SetColor( oldColor ) - // -RETURN SQLITE_OK - -/** -*/ -FUNCTION Authorizer2( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) -LOCAL oldColor := SetColor( "R/N" ) - // - Qout( "=>", StrZero(nAction, 2), cName1, cName2, cDatabaseName, cTriggerOrViewName ) - - SetColor( oldColor ) - // -RETURN iif( cName2 == "pasw", SQLITE_IGNORE, SQLITE_OK ) - -/** -*/ -FUNCTION Authorizer3( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) - // -RETURN iif( nAction == SQLITE_SELECT, SQLITE_DENY, SQLITE_OK ) - -/** -*/ -FUNCTION CallBack( nColCount, aValue, aColName ) -LOCAL nI -LOCAL oldColor := SetColor( "G/N" ) - // - FOR nI := 1 TO nColCount - Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) - NEXT - - SetColor( oldColor ) - // -RETURN 0 - -/** -*/ -STATIC FUNCTION cErrorMsg( nError, lShortMsg ) - LOCAL aErrorCodes := { ; - { SQLITE_ERROR , "SQLITE_ERROR" , "SQL error or missing database" }, ; - { SQLITE_INTERNAL , "SQLITE_INTERNAL" , "NOT USED. Internal logic error in SQLite" }, ; - { SQLITE_PERM , "SQLITE_PERM" , "Access permission denied" }, ; - { SQLITE_ABORT , "SQLITE_ABORT" , "Callback routine requested an abort" }, ; - { SQLITE_BUSY , "SQLITE_BUSY" , "The database file is locked" }, ; - { SQLITE_LOCKED , "SQLITE_LOCKED" , "A table in the database is locked" }, ; - { SQLITE_NOMEM , "SQLITE_NOMEM" , "A malloc() failed" }, ; - { SQLITE_READONLY , "SQLITE_READONLY" , "Attempt to write a readonly database" }, ; - { SQLITE_INTERRUPT , "SQLITE_INTERRUPT" , "Operation terminated by sqlite3_interrupt()" }, ; - { SQLITE_IOERR , "SQLITE_IOERR" , "Some kind of disk I/O error occurred" }, ; - { SQLITE_CORRUPT , "SQLITE_CORRUPT" , "The database disk image is malformed" }, ; - { SQLITE_NOTFOUND , "SQLITE_NOTFOUND" , "NOT USED. Table or record not found" }, ; - { SQLITE_FULL , "SQLITE_FULL" , "Insertion failed because database is full" }, ; - { SQLITE_CANTOPEN , "SQLITE_CANTOPEN" , "Unable to open the database file" }, ; - { SQLITE_PROTOCOL , "SQLITE_PROTOCOL" , "NOT USED. Database lock protocol error" }, ; - { SQLITE_EMPTY , "SQLITE_EMPTY" , "Database is empty" }, ; - { SQLITE_SCHEMA , "SQLITE_SCHEMA" , "The database schema changed" }, ; - { SQLITE_TOOBIG , "SQLITE_TOOBIG" , "String or BLOB exceeds size limit" }, ; - { SQLITE_CONSTRAINT , "SQLITE_CONSTRAINT" , "Abort due to constraint violation" }, ; - { SQLITE_MISMATCH , "SQLITE_MISMATCH" , "Data type mismatch" }, ; - { SQLITE_MISUSE , "SQLITE_MISUSE" , "Library used incorrectly" }, ; - { SQLITE_NOLFS , "SQLITE_NOLFS" , "Uses OS features not supported on host" }, ; - { SQLITE_AUTH , "SQLITE_AUTH" , "Authorization denied" }, ; - { SQLITE_FORMAT , "SQLITE_FORMAT" , "Auxiliary database format error" }, ; - { SQLITE_RANGE , "SQLITE_RANGE" , "2nd parameter to sqlite3_bind out of range" }, ; - { SQLITE_NOTADB , "SQLITE_NOTADB" , "File opened that is not a database file" }, ; - { SQLITE_ROW , "SQLITE_ROW" , "sqlite3_step() has another row ready" }, ; - { SQLITE_DONE , "SQLITE_DONE" , "sqlite3_step() has finished executing" } ; - }, nIndex, cErrorMsg := "UNKNOWN" - // - DEFAULT lShortMsg TO TRUE - - IF hb_IsNumeric( nError ) - IF nError == 0 - cErrorMsg := "SQLITE_OK" - ELSE - nIndex := AScan( aErrorCodes, {|x| x[1] == nError } ) - cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) - ENDIF - ENDIF - // -RETURN cErrorMsg - -/** -*/ -STATIC FUNCTION PrepareDB( cFile ) - LOCAL cSQLTEXT, cMsg - LOCAL pDb, pStmt - LOCAL hPerson := { ; - "Bob" => 52, ; - "Fred" => 32, ; - "Sasha" => 17, ; - "Andy" => 20, ; - "Ivet" => 28 ; - }, enum - // - pDb := sqlite3_open( cFile, TRUE ) - IF Empty( pDb ) - QOut( "Can't open/create database : ", cFile ) - - RETURN NIL - ENDIF - - cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER, pasw TEXT(32) )" - cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) - - IF cMsg <> "SQLITE_OK" - QOut( "Can't create table : person" ) - pDb := NIL // close database - - RETURN NIL - ENDIF - // - cSQLTEXT := "INSERT INTO person( name, age, pasw ) VALUES( :name, :age, :pasw )" - pStmt := sqlite3_prepare( pDb, cSQLTEXT ) - IF Empty( pStmt ) - QOut( "Can't prepare statement : ", cSQLTEXT ) - pDb := NIL - - RETURN NIL - ENDIF - - FOR EACH enum IN hPerson - sqlite3_reset( pStmt ) - sqlite3_bind_text( pStmt, 1, enum:__enumKey ) - sqlite3_bind_int( pStmt, 2, enum:__enumValue ) - sqlite3_bind_text( pStmt, 3, hb_md5(enum:__enumKey) ) - sqlite3_step( pStmt ) - NEXT - - sqlite3_clear_bindings( pStmt ) - sqlite3_finalize( pStmt ) - // +/* + * $Id$ + */ + +/* + * SQLite3 Demo. Using sqlite3_set_authorizer() + * + * Copyright 2009 P.Chornyj + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + * See COPYING for licensing terms. + * + */ + +/* + * Using sqlite3_set_authorizer() + * + * This routine registers a authorizer callback with a particular + * database connection, supplied in the first argument. + * The authorizer callback is invoked as SQL statements are being compiled + * by sqlite3_prepare(). + * + * When the callback returns SQLITE_OK, that means the operation requested + * is ok. + * When the callback returns SQLITE_DENY, the sqlite3_prepare() or + * equivalent call that triggered the authorizer will fail with an error + * message explaining that access is denied. + * If the authorizer code is SQLITE_READ and the callback returns + * SQLITE_IGNORE then the prepared statement statement is constructed to + * substitute a NULL value in place of the table column that would have + * been read if SQLITE_OK had been returned. + * The SQLITE_IGNORE return can be used to deny an untrusted user access + * to individual columns of a table. + * + * The first parameter to the authorizer callback is an integer + * action code that specifies the particular action to be authorized. + * The second through fourth parameters to the callback are strings + * that contain additional details about the action to be authorized. + */ + +#include "common.ch" +#include "hbsqlit3.ch" + +FUNCTION main() + LOCAL cFile := ":memory:", cSQLTEXT + LOCAL pDb, cb + // + IF Empty( pDb := PrepareDB(cFile) ) + RETURN 1 + ENDIF + // Authorizer1 + sqlite3_set_authorizer( pDb, @Authorizer() /*"Authorizer"*/ ) + + QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) + cb := @CallBack() // "CallBack" + Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) + + sqlite3_sleep( 3000 ) + // Authorizer2 + Qout( cErrorMsg(sqlite3_set_authorizer(pDb, @Authorizer2() /*"Authorizer2"*/)) ) + + QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) + Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) + + sqlite3_sleep( 3000 ) + // Authorizer3 + Qout( cErrorMsg(sqlite3_set_authorizer(pDb, @Authorizer3() /*"Authorizer3"*/)) ) + + QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) + Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb), FALSE) ) + + sqlite3_sleep( 3000 ) + // + pDb := Nil // close database + // +RETURN 0 + +/** +*/ +FUNCTION Authorizer( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) +LOCAL oldColor := SetColor( "R/N" ) + // + Qout( "=>", StrZero(nAction, 2), cName1, cName2, cDatabaseName, cTriggerOrViewName ) + + SetColor( oldColor ) + // +RETURN SQLITE_OK + +/** +*/ +FUNCTION Authorizer2( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) +LOCAL oldColor := SetColor( "R/N" ) + // + Qout( "=>", StrZero(nAction, 2), cName1, cName2, cDatabaseName, cTriggerOrViewName ) + + SetColor( oldColor ) + // +RETURN iif( cName2 == "pasw", SQLITE_IGNORE, SQLITE_OK ) + +/** +*/ +FUNCTION Authorizer3( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) + // +RETURN iif( nAction == SQLITE_SELECT, SQLITE_DENY, SQLITE_OK ) + +/** +*/ +FUNCTION CallBack( nColCount, aValue, aColName ) +LOCAL nI +LOCAL oldColor := SetColor( "G/N" ) + // + FOR nI := 1 TO nColCount + Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) + NEXT + + SetColor( oldColor ) + // +RETURN 0 + +/** +*/ +STATIC FUNCTION cErrorMsg( nError, lShortMsg ) + LOCAL aErrorCodes := { ; + { SQLITE_ERROR , "SQLITE_ERROR" , "SQL error or missing database" }, ; + { SQLITE_INTERNAL , "SQLITE_INTERNAL" , "NOT USED. Internal logic error in SQLite" }, ; + { SQLITE_PERM , "SQLITE_PERM" , "Access permission denied" }, ; + { SQLITE_ABORT , "SQLITE_ABORT" , "Callback routine requested an abort" }, ; + { SQLITE_BUSY , "SQLITE_BUSY" , "The database file is locked" }, ; + { SQLITE_LOCKED , "SQLITE_LOCKED" , "A table in the database is locked" }, ; + { SQLITE_NOMEM , "SQLITE_NOMEM" , "A malloc() failed" }, ; + { SQLITE_READONLY , "SQLITE_READONLY" , "Attempt to write a readonly database" }, ; + { SQLITE_INTERRUPT , "SQLITE_INTERRUPT" , "Operation terminated by sqlite3_interrupt()" }, ; + { SQLITE_IOERR , "SQLITE_IOERR" , "Some kind of disk I/O error occurred" }, ; + { SQLITE_CORRUPT , "SQLITE_CORRUPT" , "The database disk image is malformed" }, ; + { SQLITE_NOTFOUND , "SQLITE_NOTFOUND" , "NOT USED. Table or record not found" }, ; + { SQLITE_FULL , "SQLITE_FULL" , "Insertion failed because database is full" }, ; + { SQLITE_CANTOPEN , "SQLITE_CANTOPEN" , "Unable to open the database file" }, ; + { SQLITE_PROTOCOL , "SQLITE_PROTOCOL" , "NOT USED. Database lock protocol error" }, ; + { SQLITE_EMPTY , "SQLITE_EMPTY" , "Database is empty" }, ; + { SQLITE_SCHEMA , "SQLITE_SCHEMA" , "The database schema changed" }, ; + { SQLITE_TOOBIG , "SQLITE_TOOBIG" , "String or BLOB exceeds size limit" }, ; + { SQLITE_CONSTRAINT , "SQLITE_CONSTRAINT" , "Abort due to constraint violation" }, ; + { SQLITE_MISMATCH , "SQLITE_MISMATCH" , "Data type mismatch" }, ; + { SQLITE_MISUSE , "SQLITE_MISUSE" , "Library used incorrectly" }, ; + { SQLITE_NOLFS , "SQLITE_NOLFS" , "Uses OS features not supported on host" }, ; + { SQLITE_AUTH , "SQLITE_AUTH" , "Authorization denied" }, ; + { SQLITE_FORMAT , "SQLITE_FORMAT" , "Auxiliary database format error" }, ; + { SQLITE_RANGE , "SQLITE_RANGE" , "2nd parameter to sqlite3_bind out of range" }, ; + { SQLITE_NOTADB , "SQLITE_NOTADB" , "File opened that is not a database file" }, ; + { SQLITE_ROW , "SQLITE_ROW" , "sqlite3_step() has another row ready" }, ; + { SQLITE_DONE , "SQLITE_DONE" , "sqlite3_step() has finished executing" } ; + }, nIndex, cErrorMsg := "UNKNOWN" + // + DEFAULT lShortMsg TO TRUE + + IF hb_IsNumeric( nError ) + IF nError == 0 + cErrorMsg := "SQLITE_OK" + ELSE + nIndex := AScan( aErrorCodes, {|x| x[1] == nError } ) + cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) + ENDIF + ENDIF + // +RETURN cErrorMsg + +/** +*/ +STATIC FUNCTION PrepareDB( cFile ) + LOCAL cSQLTEXT, cMsg + LOCAL pDb, pStmt + LOCAL hPerson := { ; + "Bob" => 52, ; + "Fred" => 32, ; + "Sasha" => 17, ; + "Andy" => 20, ; + "Ivet" => 28 ; + }, enum + // + pDb := sqlite3_open( cFile, TRUE ) + IF Empty( pDb ) + QOut( "Can't open/create database : ", cFile ) + + RETURN NIL + ENDIF + + cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER, pasw TEXT(32) )" + cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) + + IF cMsg <> "SQLITE_OK" + QOut( "Can't create table : person" ) + pDb := NIL // close database + + RETURN NIL + ENDIF + // + cSQLTEXT := "INSERT INTO person( name, age, pasw ) VALUES( :name, :age, :pasw )" + pStmt := sqlite3_prepare( pDb, cSQLTEXT ) + IF Empty( pStmt ) + QOut( "Can't prepare statement : ", cSQLTEXT ) + pDb := NIL + + RETURN NIL + ENDIF + + FOR EACH enum IN hPerson + sqlite3_reset( pStmt ) + sqlite3_bind_text( pStmt, 1, enum:__enumKey ) + sqlite3_bind_int( pStmt, 2, enum:__enumValue ) + sqlite3_bind_text( pStmt, 3, hb_md5(enum:__enumKey) ) + sqlite3_step( pStmt ) + NEXT + + sqlite3_clear_bindings( pStmt ) + sqlite3_finalize( pStmt ) + // RETURN pDb \ No newline at end of file diff --git a/harbour/contrib/hbsqlit3/tests/backup.prg b/harbour/contrib/hbsqlit3/tests/backup.prg index 4816a3967c..d4531a310a 100644 --- a/harbour/contrib/hbsqlit3/tests/backup.prg +++ b/harbour/contrib/hbsqlit3/tests/backup.prg @@ -1,236 +1,236 @@ -/* - * $Id$ - */ - -/* - * SQLite3 Demo. Using sqlite3_backup_*() - * - * Copyright 2009 P.Chornyj - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - * See COPYING for licensing terms. - * - */ - -/* - * Using sqlite3_backup_*() - * - * This API is used to overwrite the contents of one database with that - * of another. It is useful either for creating backups of databases or - * for copying in-memory databases to or from persistent files. - * - * sqlite3_backup_init() is called once to initialize the backup, - * sqlite3_backup_step() is called one or more times to transfer the data - * between the two databases, and finally - * sqlite3_backup_finish() is called to release all resources associated - * with the backup operation. - */ - -#include "common.ch" -#include "hbsqlit3.ch" - -FUNCTION main() - LOCAL cFileSource := ":memory:", cFileDest := "backup.db", cSQLTEXT - LOCAL pDbSource, pDbDest, pBackup, cb, nDbFlags - // - IF sqlite3_libversion_number() < 3006011 - RETURN 1 - ENDIF - - IF Empty( pDbSource := PrepareDB(cFileSource) ) - RETURN 1 - ENDIF - - nDbFlags := SQLITE_OPEN_CREATE + SQLITE_OPEN_READWRITE + ; - SQLITE_OPEN_EXCLUSIVE - pDbDest := sqlite3_open_v2( cFileDest, nDbFlags ) - - IF Empty( pDbDest ) - QOut( "Can't open database : ", cFileDest ) - - RETURN 1 - ENDIF - - sqlite3_trace( pDbDest, TRUE, "backup.log" ) - - // - pBackup := sqlite3_backup_init( pDbDest, "main", pDbSource, "main" ) - IF Empty( pBackup ) - QOut( "Can't initialize backup" ) - - RETURN 1 - ELSE - QOut( "Start backup.." ) - ENDIF - - IF sqlite3_backup_step(pBackup, -1) == SQLITE_DONE - QOut( "Backup successful." ) - ENDIF - - sqlite3_backup_finish( pBackup ) /* !!! */ - - pDbSource := Nil /* close :memory: database */ - - /* Little test for sqlite3_exec with callback */ - QOut( "" ) - QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) - cb := @CallBack() // "CallBack" - Qout( cErrorMsg(sqlite3_exec(pDbDest, cSQLTEXT, cb)) ) - - pDbDest := Nil // close database - - sqlite3_sleep( 3000 ) - // -RETURN 0 - -/** -*/ -FUNCTION CallBack( nColCount, aValue, aColName ) -LOCAL nI -LOCAL oldColor := SetColor( "G/N" ) - // - FOR nI := 1 TO nColCount - Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) - NEXT - - SetColor( oldColor ) - // -RETURN 0 - -/** -*/ -STATIC FUNCTION cErrorMsg( nError, lShortMsg ) - LOCAL aErrorCodes := { ; - { SQLITE_ERROR , "SQLITE_ERROR" , "SQL error or missing database" }, ; - { SQLITE_INTERNAL , "SQLITE_INTERNAL" , "NOT USED. Internal logic error in SQLite" }, ; - { SQLITE_PERM , "SQLITE_PERM" , "Access permission denied" }, ; - { SQLITE_ABORT , "SQLITE_ABORT" , "Callback routine requested an abort" }, ; - { SQLITE_BUSY , "SQLITE_BUSY" , "The database file is locked" }, ; - { SQLITE_LOCKED , "SQLITE_LOCKED" , "A table in the database is locked" }, ; - { SQLITE_NOMEM , "SQLITE_NOMEM" , "A malloc() failed" }, ; - { SQLITE_READONLY , "SQLITE_READONLY" , "Attempt to write a readonly database" }, ; - { SQLITE_INTERRUPT , "SQLITE_INTERRUPT" , "Operation terminated by sqlite3_interrupt()" }, ; - { SQLITE_IOERR , "SQLITE_IOERR" , "Some kind of disk I/O error occurred" }, ; - { SQLITE_CORRUPT , "SQLITE_CORRUPT" , "The database disk image is malformed" }, ; - { SQLITE_NOTFOUND , "SQLITE_NOTFOUND" , "NOT USED. Table or record not found" }, ; - { SQLITE_FULL , "SQLITE_FULL" , "Insertion failed because database is full" }, ; - { SQLITE_CANTOPEN , "SQLITE_CANTOPEN" , "Unable to open the database file" }, ; - { SQLITE_PROTOCOL , "SQLITE_PROTOCOL" , "NOT USED. Database lock protocol error" }, ; - { SQLITE_EMPTY , "SQLITE_EMPTY" , "Database is empty" }, ; - { SQLITE_SCHEMA , "SQLITE_SCHEMA" , "The database schema changed" }, ; - { SQLITE_TOOBIG , "SQLITE_TOOBIG" , "String or BLOB exceeds size limit" }, ; - { SQLITE_CONSTRAINT , "SQLITE_CONSTRAINT" , "Abort due to constraint violation" }, ; - { SQLITE_MISMATCH , "SQLITE_MISMATCH" , "Data type mismatch" }, ; - { SQLITE_MISUSE , "SQLITE_MISUSE" , "Library used incorrectly" }, ; - { SQLITE_NOLFS , "SQLITE_NOLFS" , "Uses OS features not supported on host" }, ; - { SQLITE_AUTH , "SQLITE_AUTH" , "Authorization denied" }, ; - { SQLITE_FORMAT , "SQLITE_FORMAT" , "Auxiliary database format error" }, ; - { SQLITE_RANGE , "SQLITE_RANGE" , "2nd parameter to sqlite3_bind out of range" }, ; - { SQLITE_NOTADB , "SQLITE_NOTADB" , "File opened that is not a database file" }, ; - { SQLITE_ROW , "SQLITE_ROW" , "sqlite3_step() has another row ready" }, ; - { SQLITE_DONE , "SQLITE_DONE" , "sqlite3_step() has finished executing" } ; - }, nIndex, cErrorMsg := "UNKNOWN" - // - DEFAULT lShortMsg TO TRUE - - IF hb_IsNumeric( nError ) - IF nError == 0 - cErrorMsg := "SQLITE_OK" - ELSE - nIndex := AScan( aErrorCodes, {|x| x[1] == nError } ) - cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) - ENDIF - ENDIF - // -RETURN cErrorMsg - -/** -*/ -STATIC FUNCTION PrepareDB( cFile ) - LOCAL cSQLTEXT, cMsg - LOCAL pDb, pStmt - LOCAL hPerson := { ; - "Bob" => 52, ; - "Fred" => 32, ; - "Sasha" => 17, ; - "Andy" => 20, ; - "Ivet" => 28 ; - }, enum - // - pDb := sqlite3_open( cFile, TRUE ) - IF Empty( pDb ) - QOut( "Can't open/create database : ", cFile ) - - RETURN NIL - ENDIF - - sqlite3_trace( pDb, TRUE, "backup.log" ) - - cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER )" - cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) - - IF cMsg <> "SQLITE_OK" - QOut( "Can't create table : person" ) - pDb := NIL // close database - - RETURN NIL - ENDIF - // - cSQLTEXT := "INSERT INTO person( name, age ) VALUES( :name, :age )" - pStmt := sqlite3_prepare( pDb, cSQLTEXT ) - IF Empty( pStmt ) - QOut( "Can't prepare statement : ", cSQLTEXT ) - pDb := NIL - - RETURN NIL - ENDIF - - FOR EACH enum IN hPerson - sqlite3_reset( pStmt ) - sqlite3_bind_text( pStmt, 1, enum:__enumKey ) - sqlite3_bind_int( pStmt, 2, enum:__enumValue ) - sqlite3_step( pStmt ) - NEXT - - sqlite3_clear_bindings( pStmt ) - sqlite3_finalize( pStmt ) - // +/* + * $Id$ + */ + +/* + * SQLite3 Demo. Using sqlite3_backup_*() + * + * Copyright 2009 P.Chornyj + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + * See COPYING for licensing terms. + * + */ + +/* + * Using sqlite3_backup_*() + * + * This API is used to overwrite the contents of one database with that + * of another. It is useful either for creating backups of databases or + * for copying in-memory databases to or from persistent files. + * + * sqlite3_backup_init() is called once to initialize the backup, + * sqlite3_backup_step() is called one or more times to transfer the data + * between the two databases, and finally + * sqlite3_backup_finish() is called to release all resources associated + * with the backup operation. + */ + +#include "common.ch" +#include "hbsqlit3.ch" + +FUNCTION main() + LOCAL cFileSource := ":memory:", cFileDest := "backup.db", cSQLTEXT + LOCAL pDbSource, pDbDest, pBackup, cb, nDbFlags + // + IF sqlite3_libversion_number() < 3006011 + RETURN 1 + ENDIF + + IF Empty( pDbSource := PrepareDB(cFileSource) ) + RETURN 1 + ENDIF + + nDbFlags := SQLITE_OPEN_CREATE + SQLITE_OPEN_READWRITE + ; + SQLITE_OPEN_EXCLUSIVE + pDbDest := sqlite3_open_v2( cFileDest, nDbFlags ) + + IF Empty( pDbDest ) + QOut( "Can't open database : ", cFileDest ) + + RETURN 1 + ENDIF + + sqlite3_trace( pDbDest, TRUE, "backup.log" ) + + // + pBackup := sqlite3_backup_init( pDbDest, "main", pDbSource, "main" ) + IF Empty( pBackup ) + QOut( "Can't initialize backup" ) + + RETURN 1 + ELSE + QOut( "Start backup.." ) + ENDIF + + IF sqlite3_backup_step(pBackup, -1) == SQLITE_DONE + QOut( "Backup successful." ) + ENDIF + + sqlite3_backup_finish( pBackup ) /* !!! */ + + pDbSource := Nil /* close :memory: database */ + + /* Little test for sqlite3_exec with callback */ + QOut( "" ) + QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) + cb := @CallBack() // "CallBack" + Qout( cErrorMsg(sqlite3_exec(pDbDest, cSQLTEXT, cb)) ) + + pDbDest := Nil // close database + + sqlite3_sleep( 3000 ) + // +RETURN 0 + +/** +*/ +FUNCTION CallBack( nColCount, aValue, aColName ) +LOCAL nI +LOCAL oldColor := SetColor( "G/N" ) + // + FOR nI := 1 TO nColCount + Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) + NEXT + + SetColor( oldColor ) + // +RETURN 0 + +/** +*/ +STATIC FUNCTION cErrorMsg( nError, lShortMsg ) + LOCAL aErrorCodes := { ; + { SQLITE_ERROR , "SQLITE_ERROR" , "SQL error or missing database" }, ; + { SQLITE_INTERNAL , "SQLITE_INTERNAL" , "NOT USED. Internal logic error in SQLite" }, ; + { SQLITE_PERM , "SQLITE_PERM" , "Access permission denied" }, ; + { SQLITE_ABORT , "SQLITE_ABORT" , "Callback routine requested an abort" }, ; + { SQLITE_BUSY , "SQLITE_BUSY" , "The database file is locked" }, ; + { SQLITE_LOCKED , "SQLITE_LOCKED" , "A table in the database is locked" }, ; + { SQLITE_NOMEM , "SQLITE_NOMEM" , "A malloc() failed" }, ; + { SQLITE_READONLY , "SQLITE_READONLY" , "Attempt to write a readonly database" }, ; + { SQLITE_INTERRUPT , "SQLITE_INTERRUPT" , "Operation terminated by sqlite3_interrupt()" }, ; + { SQLITE_IOERR , "SQLITE_IOERR" , "Some kind of disk I/O error occurred" }, ; + { SQLITE_CORRUPT , "SQLITE_CORRUPT" , "The database disk image is malformed" }, ; + { SQLITE_NOTFOUND , "SQLITE_NOTFOUND" , "NOT USED. Table or record not found" }, ; + { SQLITE_FULL , "SQLITE_FULL" , "Insertion failed because database is full" }, ; + { SQLITE_CANTOPEN , "SQLITE_CANTOPEN" , "Unable to open the database file" }, ; + { SQLITE_PROTOCOL , "SQLITE_PROTOCOL" , "NOT USED. Database lock protocol error" }, ; + { SQLITE_EMPTY , "SQLITE_EMPTY" , "Database is empty" }, ; + { SQLITE_SCHEMA , "SQLITE_SCHEMA" , "The database schema changed" }, ; + { SQLITE_TOOBIG , "SQLITE_TOOBIG" , "String or BLOB exceeds size limit" }, ; + { SQLITE_CONSTRAINT , "SQLITE_CONSTRAINT" , "Abort due to constraint violation" }, ; + { SQLITE_MISMATCH , "SQLITE_MISMATCH" , "Data type mismatch" }, ; + { SQLITE_MISUSE , "SQLITE_MISUSE" , "Library used incorrectly" }, ; + { SQLITE_NOLFS , "SQLITE_NOLFS" , "Uses OS features not supported on host" }, ; + { SQLITE_AUTH , "SQLITE_AUTH" , "Authorization denied" }, ; + { SQLITE_FORMAT , "SQLITE_FORMAT" , "Auxiliary database format error" }, ; + { SQLITE_RANGE , "SQLITE_RANGE" , "2nd parameter to sqlite3_bind out of range" }, ; + { SQLITE_NOTADB , "SQLITE_NOTADB" , "File opened that is not a database file" }, ; + { SQLITE_ROW , "SQLITE_ROW" , "sqlite3_step() has another row ready" }, ; + { SQLITE_DONE , "SQLITE_DONE" , "sqlite3_step() has finished executing" } ; + }, nIndex, cErrorMsg := "UNKNOWN" + // + DEFAULT lShortMsg TO TRUE + + IF hb_IsNumeric( nError ) + IF nError == 0 + cErrorMsg := "SQLITE_OK" + ELSE + nIndex := AScan( aErrorCodes, {|x| x[1] == nError } ) + cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) + ENDIF + ENDIF + // +RETURN cErrorMsg + +/** +*/ +STATIC FUNCTION PrepareDB( cFile ) + LOCAL cSQLTEXT, cMsg + LOCAL pDb, pStmt + LOCAL hPerson := { ; + "Bob" => 52, ; + "Fred" => 32, ; + "Sasha" => 17, ; + "Andy" => 20, ; + "Ivet" => 28 ; + }, enum + // + pDb := sqlite3_open( cFile, TRUE ) + IF Empty( pDb ) + QOut( "Can't open/create database : ", cFile ) + + RETURN NIL + ENDIF + + sqlite3_trace( pDb, TRUE, "backup.log" ) + + cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER )" + cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) + + IF cMsg <> "SQLITE_OK" + QOut( "Can't create table : person" ) + pDb := NIL // close database + + RETURN NIL + ENDIF + // + cSQLTEXT := "INSERT INTO person( name, age ) VALUES( :name, :age )" + pStmt := sqlite3_prepare( pDb, cSQLTEXT ) + IF Empty( pStmt ) + QOut( "Can't prepare statement : ", cSQLTEXT ) + pDb := NIL + + RETURN NIL + ENDIF + + FOR EACH enum IN hPerson + sqlite3_reset( pStmt ) + sqlite3_bind_text( pStmt, 1, enum:__enumKey ) + sqlite3_bind_int( pStmt, 2, enum:__enumValue ) + sqlite3_step( pStmt ) + NEXT + + sqlite3_clear_bindings( pStmt ) + sqlite3_finalize( pStmt ) + // RETURN pDb \ No newline at end of file diff --git a/harbour/contrib/hbsqlit3/tests/hooks.prg b/harbour/contrib/hbsqlit3/tests/hooks.prg index 010139c68b..3ae07e9d29 100644 --- a/harbour/contrib/hbsqlit3/tests/hooks.prg +++ b/harbour/contrib/hbsqlit3/tests/hooks.prg @@ -1,251 +1,251 @@ -/* - * $Id$ - */ - -/* - * SQLite3 Demo. Using sqlite3_commit_hook(), sqlite3_rollback_hook() - * - * Copyright 2009 P.Chornyj - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - * See COPYING for licensing terms. - * - */ - -#include "common.ch" -#include "hbsqlit3.ch" - -FUNCTION main() - LOCAL cSQLTEXT, cFile := ":memory:" - LOCAL pDb, cb := @CallBack() - // - IF Empty( pDb := PrepareDB(cFile) ) - RETURN 1 - ENDIF - // - sqlite3_commit_hook( pDb, "HookCommitY" ) - - QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Andy'" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) - - QOut( cSQLTEXT := "BEGIN EXCLUSIVE TRANSACTION" ) - Qout( "return value: ",cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) - - QOut( cSQLTEXT := "DELETE FROM person WHERE name == 'Andy'" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) - - QOut( cSQLTEXT := "END TRANSACTION" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) - - QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Andy'" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) - - QOut( Replicate("-", Len(cSQLTEXT)) ) - - sqlite3_sleep( 10000 ) - // - sqlite3_commit_hook( pDb, @HookCommitN() ) - sqlite3_rollback_hook( pDb, @HookRollback() ) - - QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Ivet'" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) - - QOut( cSQLTEXT := "BEGIN EXCLUSIVE TRANSACTION" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) - - QOut( cSQLTEXT := "DELETE FROM person WHERE name == 'Ivet'" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) - - QOut( cSQLTEXT := "END TRANSACTION" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) - - QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Ivet'" ) - Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) - // - pDb := NIL - - sqlite3_sleep( 10000 ) - // -RETURN 0 - -/** -*/ -FUNCTION CallBack( nColCount, aValue, aColName ) -LOCAL nI -LOCAL oldColor := SetColor( "G/N" ) - // - FOR nI := 1 TO nColCount - Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) - NEXT - - SetColor( oldColor ) - // -RETURN 0 - -/** -*/ -FUNCTION HookCommitY() -LOCAL oldColor := SetColor( "R+/N" ) - // - Qout( "!! COMMIT" ) - - SetColor( oldColor ) - // -RETURN 0 - -FUNCTION HookCommitN() -LOCAL oldColor := SetColor( "B+/N" ) - // - Qout( "?? COMMIT or ROLLBACK" ) - - SetColor( oldColor ) - // -RETURN 1 // not 0 - -FUNCTION HookRollback() -LOCAL oldColor := SetColor( "R+/N" ) - // - Qout( "!! ROLLBACK" ) - - SetColor( oldColor ) - // -RETURN 1 - -/** -*/ -STATIC FUNCTION cErrorMsg( nError, lShortMsg ) - LOCAL aErrorCodes := { ; - { SQLITE_ERROR , "SQLITE_ERROR" , "SQL error or missing database" }, ; - { SQLITE_INTERNAL , "SQLITE_INTERNAL" , "NOT USED. Internal logic error in SQLite" }, ; - { SQLITE_PERM , "SQLITE_PERM" , "Access permission denied" }, ; - { SQLITE_ABORT , "SQLITE_ABORT" , "Callback routine requested an abort" }, ; - { SQLITE_BUSY , "SQLITE_BUSY" , "The database file is locked" }, ; - { SQLITE_LOCKED , "SQLITE_LOCKED" , "A table in the database is locked" }, ; - { SQLITE_NOMEM , "SQLITE_NOMEM" , "A malloc() failed" }, ; - { SQLITE_READONLY , "SQLITE_READONLY" , "Attempt to write a readonly database" }, ; - { SQLITE_INTERRUPT , "SQLITE_INTERRUPT" , "Operation terminated by sqlite3_interrupt()" }, ; - { SQLITE_IOERR , "SQLITE_IOERR" , "Some kind of disk I/O error occurred" }, ; - { SQLITE_CORRUPT , "SQLITE_CORRUPT" , "The database disk image is malformed" }, ; - { SQLITE_NOTFOUND , "SQLITE_NOTFOUND" , "NOT USED. Table or record not found" }, ; - { SQLITE_FULL , "SQLITE_FULL" , "Insertion failed because database is full" }, ; - { SQLITE_CANTOPEN , "SQLITE_CANTOPEN" , "Unable to open the database file" }, ; - { SQLITE_PROTOCOL , "SQLITE_PROTOCOL" , "NOT USED. Database lock protocol error" }, ; - { SQLITE_EMPTY , "SQLITE_EMPTY" , "Database is empty" }, ; - { SQLITE_SCHEMA , "SQLITE_SCHEMA" , "The database schema changed" }, ; - { SQLITE_TOOBIG , "SQLITE_TOOBIG" , "String or BLOB exceeds size limit" }, ; - { SQLITE_CONSTRAINT , "SQLITE_CONSTRAINT" , "Abort due to constraint violation" }, ; - { SQLITE_MISMATCH , "SQLITE_MISMATCH" , "Data type mismatch" }, ; - { SQLITE_MISUSE , "SQLITE_MISUSE" , "Library used incorrectly" }, ; - { SQLITE_NOLFS , "SQLITE_NOLFS" , "Uses OS features not supported on host" }, ; - { SQLITE_AUTH , "SQLITE_AUTH" , "Authorization denied" }, ; - { SQLITE_FORMAT , "SQLITE_FORMAT" , "Auxiliary database format error" }, ; - { SQLITE_RANGE , "SQLITE_RANGE" , "2nd parameter to sqlite3_bind out of range" }, ; - { SQLITE_NOTADB , "SQLITE_NOTADB" , "File opened that is not a database file" }, ; - { SQLITE_ROW , "SQLITE_ROW" , "sqlite3_step() has another row ready" }, ; - { SQLITE_DONE , "SQLITE_DONE" , "sqlite3_step() has finished executing" } ; - }, nIndex, cErrorMsg := "UNKNOWN" - // - DEFAULT lShortMsg TO TRUE - - IF hb_IsNumeric( nError ) - IF nError == 0 - cErrorMsg := "SQLITE_OK" - ELSE - nIndex := AScan( aErrorCodes, {|x| x[1] == nError } ) - cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) - ENDIF - ENDIF - // -RETURN cErrorMsg - -/** -*/ -STATIC FUNCTION PrepareDB( cFile ) - LOCAL cSQLTEXT, cMsg - LOCAL pDb, pStmt - LOCAL hPerson := { ; - "Bob" => 52, ; - "Fred" => 32, ; - "Sasha" => 17, ; - "Andy" => 20, ; - "Ivet" => 28 ; - }, enum - // - pDb := sqlite3_open( cFile, TRUE ) - IF Empty( pDb ) - QOut( "Can't open/create database : ", cFile ) - - RETURN NIL - ENDIF - - Qout( cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER )" ) - cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) - - IF cMsg <> "SQLITE_OK" - QOut( "Can't create table : person" ) - pDb := NIL // close database - - RETURN NIL - ENDIF - // - cSQLTEXT := "INSERT INTO person( name, age ) VALUES( :name, :age )" - pStmt := sqlite3_prepare( pDb, cSQLTEXT ) - IF Empty( pStmt ) - QOut( "Can't prepare statement : ", cSQLTEXT ) - pDb := NIL - - RETURN NIL - ENDIF - - QOut( sqlite3_sql(pStmt) ) - QOut( Replicate("-", Len(cSQLTEXT)) ) - - FOR EACH enum IN hPerson - sqlite3_reset( pStmt ) - sqlite3_bind_text( pStmt, 1, enum:__enumKey ) - sqlite3_bind_int( pStmt, 2, enum:__enumValue ) - sqlite3_step( pStmt ) - NEXT - - sqlite3_clear_bindings( pStmt ) - sqlite3_finalize( pStmt ) - // +/* + * $Id$ + */ + +/* + * SQLite3 Demo. Using sqlite3_commit_hook(), sqlite3_rollback_hook() + * + * Copyright 2009 P.Chornyj + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + * See COPYING for licensing terms. + * + */ + +#include "common.ch" +#include "hbsqlit3.ch" + +FUNCTION main() + LOCAL cSQLTEXT, cFile := ":memory:" + LOCAL pDb, cb := @CallBack() + // + IF Empty( pDb := PrepareDB(cFile) ) + RETURN 1 + ENDIF + // + sqlite3_commit_hook( pDb, "HookCommitY" ) + + QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Andy'" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) + + QOut( cSQLTEXT := "BEGIN EXCLUSIVE TRANSACTION" ) + Qout( "return value: ",cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) + + QOut( cSQLTEXT := "DELETE FROM person WHERE name == 'Andy'" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) + + QOut( cSQLTEXT := "END TRANSACTION" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) + + QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Andy'" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) + + QOut( Replicate("-", Len(cSQLTEXT)) ) + + sqlite3_sleep( 10000 ) + // + sqlite3_commit_hook( pDb, @HookCommitN() ) + sqlite3_rollback_hook( pDb, @HookRollback() ) + + QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Ivet'" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) + + QOut( cSQLTEXT := "BEGIN EXCLUSIVE TRANSACTION" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) + + QOut( cSQLTEXT := "DELETE FROM person WHERE name == 'Ivet'" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) + + QOut( cSQLTEXT := "END TRANSACTION" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT)) ) + + QOut( cSQLTEXT := "SELECT * FROM person WHERE name == 'Ivet'" ) + Qout( "return value: ", cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) ) + // + pDb := NIL + + sqlite3_sleep( 10000 ) + // +RETURN 0 + +/** +*/ +FUNCTION CallBack( nColCount, aValue, aColName ) +LOCAL nI +LOCAL oldColor := SetColor( "G/N" ) + // + FOR nI := 1 TO nColCount + Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) + NEXT + + SetColor( oldColor ) + // +RETURN 0 + +/** +*/ +FUNCTION HookCommitY() +LOCAL oldColor := SetColor( "R+/N" ) + // + Qout( "!! COMMIT" ) + + SetColor( oldColor ) + // +RETURN 0 + +FUNCTION HookCommitN() +LOCAL oldColor := SetColor( "B+/N" ) + // + Qout( "?? COMMIT or ROLLBACK" ) + + SetColor( oldColor ) + // +RETURN 1 // not 0 + +FUNCTION HookRollback() +LOCAL oldColor := SetColor( "R+/N" ) + // + Qout( "!! ROLLBACK" ) + + SetColor( oldColor ) + // +RETURN 1 + +/** +*/ +STATIC FUNCTION cErrorMsg( nError, lShortMsg ) + LOCAL aErrorCodes := { ; + { SQLITE_ERROR , "SQLITE_ERROR" , "SQL error or missing database" }, ; + { SQLITE_INTERNAL , "SQLITE_INTERNAL" , "NOT USED. Internal logic error in SQLite" }, ; + { SQLITE_PERM , "SQLITE_PERM" , "Access permission denied" }, ; + { SQLITE_ABORT , "SQLITE_ABORT" , "Callback routine requested an abort" }, ; + { SQLITE_BUSY , "SQLITE_BUSY" , "The database file is locked" }, ; + { SQLITE_LOCKED , "SQLITE_LOCKED" , "A table in the database is locked" }, ; + { SQLITE_NOMEM , "SQLITE_NOMEM" , "A malloc() failed" }, ; + { SQLITE_READONLY , "SQLITE_READONLY" , "Attempt to write a readonly database" }, ; + { SQLITE_INTERRUPT , "SQLITE_INTERRUPT" , "Operation terminated by sqlite3_interrupt()" }, ; + { SQLITE_IOERR , "SQLITE_IOERR" , "Some kind of disk I/O error occurred" }, ; + { SQLITE_CORRUPT , "SQLITE_CORRUPT" , "The database disk image is malformed" }, ; + { SQLITE_NOTFOUND , "SQLITE_NOTFOUND" , "NOT USED. Table or record not found" }, ; + { SQLITE_FULL , "SQLITE_FULL" , "Insertion failed because database is full" }, ; + { SQLITE_CANTOPEN , "SQLITE_CANTOPEN" , "Unable to open the database file" }, ; + { SQLITE_PROTOCOL , "SQLITE_PROTOCOL" , "NOT USED. Database lock protocol error" }, ; + { SQLITE_EMPTY , "SQLITE_EMPTY" , "Database is empty" }, ; + { SQLITE_SCHEMA , "SQLITE_SCHEMA" , "The database schema changed" }, ; + { SQLITE_TOOBIG , "SQLITE_TOOBIG" , "String or BLOB exceeds size limit" }, ; + { SQLITE_CONSTRAINT , "SQLITE_CONSTRAINT" , "Abort due to constraint violation" }, ; + { SQLITE_MISMATCH , "SQLITE_MISMATCH" , "Data type mismatch" }, ; + { SQLITE_MISUSE , "SQLITE_MISUSE" , "Library used incorrectly" }, ; + { SQLITE_NOLFS , "SQLITE_NOLFS" , "Uses OS features not supported on host" }, ; + { SQLITE_AUTH , "SQLITE_AUTH" , "Authorization denied" }, ; + { SQLITE_FORMAT , "SQLITE_FORMAT" , "Auxiliary database format error" }, ; + { SQLITE_RANGE , "SQLITE_RANGE" , "2nd parameter to sqlite3_bind out of range" }, ; + { SQLITE_NOTADB , "SQLITE_NOTADB" , "File opened that is not a database file" }, ; + { SQLITE_ROW , "SQLITE_ROW" , "sqlite3_step() has another row ready" }, ; + { SQLITE_DONE , "SQLITE_DONE" , "sqlite3_step() has finished executing" } ; + }, nIndex, cErrorMsg := "UNKNOWN" + // + DEFAULT lShortMsg TO TRUE + + IF hb_IsNumeric( nError ) + IF nError == 0 + cErrorMsg := "SQLITE_OK" + ELSE + nIndex := AScan( aErrorCodes, {|x| x[1] == nError } ) + cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) + ENDIF + ENDIF + // +RETURN cErrorMsg + +/** +*/ +STATIC FUNCTION PrepareDB( cFile ) + LOCAL cSQLTEXT, cMsg + LOCAL pDb, pStmt + LOCAL hPerson := { ; + "Bob" => 52, ; + "Fred" => 32, ; + "Sasha" => 17, ; + "Andy" => 20, ; + "Ivet" => 28 ; + }, enum + // + pDb := sqlite3_open( cFile, TRUE ) + IF Empty( pDb ) + QOut( "Can't open/create database : ", cFile ) + + RETURN NIL + ENDIF + + Qout( cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER )" ) + cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) + + IF cMsg <> "SQLITE_OK" + QOut( "Can't create table : person" ) + pDb := NIL // close database + + RETURN NIL + ENDIF + // + cSQLTEXT := "INSERT INTO person( name, age ) VALUES( :name, :age )" + pStmt := sqlite3_prepare( pDb, cSQLTEXT ) + IF Empty( pStmt ) + QOut( "Can't prepare statement : ", cSQLTEXT ) + pDb := NIL + + RETURN NIL + ENDIF + + QOut( sqlite3_sql(pStmt) ) + QOut( Replicate("-", Len(cSQLTEXT)) ) + + FOR EACH enum IN hPerson + sqlite3_reset( pStmt ) + sqlite3_bind_text( pStmt, 1, enum:__enumKey ) + sqlite3_bind_int( pStmt, 2, enum:__enumValue ) + sqlite3_step( pStmt ) + NEXT + + sqlite3_clear_bindings( pStmt ) + sqlite3_finalize( pStmt ) + // RETURN pDb \ No newline at end of file diff --git a/harbour/contrib/hbssl/hbssl.hbc b/harbour/contrib/hbssl/hbssl.hbc index a44c411b45..1ebafd69c8 100644 --- a/harbour/contrib/hbssl/hbssl.hbc +++ b/harbour/contrib/hbssl/hbssl.hbc @@ -1,10 +1,10 @@ -# -# $Id$ -# - -{dos}skip=yes - -incpaths=. - -libs=hbssl -{win}libs=libeay32 ssleay32 +# +# $Id$ +# + +{dos}skip=yes + +incpaths=. + +libs=hbssl +{win}libs=libeay32 ssleay32 diff --git a/harbour/contrib/hbtip/hbtip.hbc b/harbour/contrib/hbtip/hbtip.hbc index 8baf7e5792..e3ec39d448 100644 --- a/harbour/contrib/hbtip/hbtip.hbc +++ b/harbour/contrib/hbtip/hbtip.hbc @@ -1,9 +1,9 @@ -# -# $Id$ -# - -{dos}skip=yes - -incpaths=. - -libs=hbtip +# +# $Id$ +# + +{dos}skip=yes + +incpaths=. + +libs=hbtip diff --git a/harbour/contrib/hbtpathy/hbtpathy.hbc b/harbour/contrib/hbtpathy/hbtpathy.hbc index 14e3d6940d..d18cda0c22 100644 --- a/harbour/contrib/hbtpathy/hbtpathy.hbc +++ b/harbour/contrib/hbtpathy/hbtpathy.hbc @@ -1,9 +1,9 @@ -# -# $Id$ -# - -{!(linux|win|os2)}skip=yes - -incpaths=. - -libs=hbtpathy +# +# $Id$ +# + +{!(linux|win|os2)}skip=yes + +incpaths=. + +libs=hbtpathy diff --git a/harbour/contrib/hbvpdf/hbvpdf.hbc b/harbour/contrib/hbvpdf/hbvpdf.hbc index c84c10c487..75a0339bab 100644 --- a/harbour/contrib/hbvpdf/hbvpdf.hbc +++ b/harbour/contrib/hbvpdf/hbvpdf.hbc @@ -1,7 +1,7 @@ -# -# $Id$ -# - -incpaths=. - -libs=hbvpdf +# +# $Id$ +# + +incpaths=. + +libs=hbvpdf diff --git a/harbour/contrib/hbwin/hbwin.hbc b/harbour/contrib/hbwin/hbwin.hbc index 6723b95219..99a3889871 100644 --- a/harbour/contrib/hbwin/hbwin.hbc +++ b/harbour/contrib/hbwin/hbwin.hbc @@ -1,9 +1,9 @@ -# -# $Id$ -# - -{!allwin}skip=yes - -incpaths=. - -libs=hbwin +# +# $Id$ +# + +{!allwin}skip=yes + +incpaths=. + +libs=hbwin diff --git a/harbour/contrib/hbziparc/hbziparc.hbc b/harbour/contrib/hbziparc/hbziparc.hbc index 2c7f2af65b..7c68b82676 100644 --- a/harbour/contrib/hbziparc/hbziparc.hbc +++ b/harbour/contrib/hbziparc/hbziparc.hbc @@ -1,6 +1,6 @@ -# -# $Id$ -# - -libs=hbziparc -libs=../hbmzip/hbmzip.hbc +# +# $Id$ +# + +libs=hbziparc +libs=../hbmzip/hbmzip.hbc diff --git a/harbour/contrib/rddado/rddado.hbc b/harbour/contrib/rddado/rddado.hbc index 12c5211447..20caa04fd0 100644 --- a/harbour/contrib/rddado/rddado.hbc +++ b/harbour/contrib/rddado/rddado.hbc @@ -1,10 +1,10 @@ -# -# $Id$ -# - -{!allwin}skip=yes - -incpaths=. - -libs=rddado -libs=..\hbwin\hbwin.hbc +# +# $Id$ +# + +{!allwin}skip=yes + +incpaths=. + +libs=rddado +libs=..\hbwin\hbwin.hbc diff --git a/harbour/contrib/rddads/rddads.hbc b/harbour/contrib/rddads/rddads.hbc index 05818015ce..88e2125671 100644 --- a/harbour/contrib/rddads/rddads.hbc +++ b/harbour/contrib/rddads/rddads.hbc @@ -1,10 +1,10 @@ -# -# $Id$ -# - -{!(linux|win)}skip=yes - -incpaths=. - -libs=rddads -libs=ace32 +# +# $Id$ +# + +{!(linux|win)}skip=yes + +incpaths=. + +libs=rddads +libs=ace32 diff --git a/harbour/contrib/rddsql/rddsql.hbc b/harbour/contrib/rddsql/rddsql.hbc index a11aa84482..f1090be5b1 100644 --- a/harbour/contrib/rddsql/rddsql.hbc +++ b/harbour/contrib/rddsql/rddsql.hbc @@ -1,5 +1,5 @@ -# -# $Id$ -# - -libs=rddsql +# +# $Id$ +# + +libs=rddsql diff --git a/harbour/contrib/xhb/xhb.hbc b/harbour/contrib/xhb/xhb.hbc index ab755e96ae..571b10a176 100644 --- a/harbour/contrib/xhb/xhb.hbc +++ b/harbour/contrib/xhb/xhb.hbc @@ -1,13 +1,13 @@ -# -# $Id$ -# - -incpaths=. - -libs=xhb - -# xhb has these as part of core, so we're adding them to emulate it. -# They are not needed to use xhb lib itself. -libs=../hbct/hbct.hbc -libs=../hbtip/hbtip.hbc -libs=../hbwin/hbwin.hbc +# +# $Id$ +# + +incpaths=. + +libs=xhb + +# xhb has these as part of core, so we're adding them to emulate it. +# They are not needed to use xhb lib itself. +libs=../hbct/hbct.hbc +libs=../hbtip/hbtip.hbc +libs=../hbwin/hbwin.hbc diff --git a/harbour/contrib/xhb/xhberrc.c b/harbour/contrib/xhb/xhberrc.c index 7c212adcbb..831061403e 100644 --- a/harbour/contrib/xhb/xhberrc.c +++ b/harbour/contrib/xhb/xhberrc.c @@ -1,123 +1,123 @@ -/* - * $Id: errorsys.prg,v 1.60 2009/02/23 21:00:20 ronpinkas Exp $ - */ - -/* - * Harbour Project source code: - * The default error handler - * - * Copyright 1999 Antonio Linares - * www - http://www.harbour-project.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ - -#define HB_OS_WIN_USED - -#include "hbapi.h" -#include "hbapiitm.h" -#include "hbvm.h" -#include "hbvmpub.h" -#include "hbstack.h" -#include "hbthread.h" - -#if 0 - -static PHB_SYMB s_xHbFunc = NULL; - -LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS *ExceptionInfo ) -{ - if( s_xHbFunc ) - { - HB_ITEM Exception; - PHB_DYNS pDyn = hb_dynsymFind( "HB_CSTRUCTURE" ); - - Exception.type = HB_IT_NIL; - - if( pDyn ) - { - hb_vmPushSymbol( pDyn->pSymbol ); - hb_vmPushNil(); - hb_itemPushStaticString( "EXCEPTION_POINTERS", 18 ); - hb_vmPushLong( 8 ); - hb_vmDo( 2 ); - - if( hb_stackReturnItem()->type == HB_IT_OBJECT ) - { - HB_ITEM_NEW( Buffer ); - HB_ITEM Adopt; - - hb_itemForwardValue( &Exception, hb_stackReturnItem() ); - - hb_itemPutCLStatic( &Buffer, (char *) ExceptionInfo, sizeof( EXCEPTION_POINTERS ) ); - - Adopt.type = HB_IT_LOGICAL; - Adopt.item.asLogical.value = FALSE; - - hb_objSendMsg( &Exception, "Buffer", 2, &Buffer, &Adopt ); - } - } - - hb_vmPushSymbol( s_xHbFunc ); - hb_vmPushNil(); - hb_itemPushForward( &Exception ); - hb_vmDo( 1 ); - } - - return hb_itemGetNL( hb_stackReturnItem() ); -} - -#endif - -HB_FUNC( SETUNHANDLEDEXCEPTIONFILTER ) -{ -#if 0 - LPTOP_LEVEL_EXCEPTION_FILTER pDefaultHandler; - - s_xHbFunc = ( PHB_SYMB ) hb_parptr( 1 ); - - pDefaultHandler = SetUnhandledExceptionFilter( PRGUnhandledExceptionFilter ); - - hb_retnl( ( LONG ) pDefaultHandler ); -#endif - /* Dummy in Harbour */ - hb_retnl( 0 ); -} +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * The default error handler + * + * Copyright 1999 Antonio Linares + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#define HB_OS_WIN_USED + +#include "hbapi.h" +#include "hbapiitm.h" +#include "hbvm.h" +#include "hbvmpub.h" +#include "hbstack.h" +#include "hbthread.h" + +#if 0 + +static PHB_SYMB s_xHbFunc = NULL; + +LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS *ExceptionInfo ) +{ + if( s_xHbFunc ) + { + HB_ITEM Exception; + PHB_DYNS pDyn = hb_dynsymFind( "HB_CSTRUCTURE" ); + + Exception.type = HB_IT_NIL; + + if( pDyn ) + { + hb_vmPushSymbol( pDyn->pSymbol ); + hb_vmPushNil(); + hb_itemPushStaticString( "EXCEPTION_POINTERS", 18 ); + hb_vmPushLong( 8 ); + hb_vmDo( 2 ); + + if( hb_stackReturnItem()->type == HB_IT_OBJECT ) + { + HB_ITEM_NEW( Buffer ); + HB_ITEM Adopt; + + hb_itemForwardValue( &Exception, hb_stackReturnItem() ); + + hb_itemPutCLStatic( &Buffer, (char *) ExceptionInfo, sizeof( EXCEPTION_POINTERS ) ); + + Adopt.type = HB_IT_LOGICAL; + Adopt.item.asLogical.value = FALSE; + + hb_objSendMsg( &Exception, "Buffer", 2, &Buffer, &Adopt ); + } + } + + hb_vmPushSymbol( s_xHbFunc ); + hb_vmPushNil(); + hb_itemPushForward( &Exception ); + hb_vmDo( 1 ); + } + + return hb_itemGetNL( hb_stackReturnItem() ); +} + +#endif + +HB_FUNC( SETUNHANDLEDEXCEPTIONFILTER ) +{ +#if 0 + LPTOP_LEVEL_EXCEPTION_FILTER pDefaultHandler; + + s_xHbFunc = ( PHB_SYMB ) hb_parptr( 1 ); + + pDefaultHandler = SetUnhandledExceptionFilter( PRGUnhandledExceptionFilter ); + + hb_retnl( ( LONG ) pDefaultHandler ); +#endif + /* Dummy in Harbour */ + hb_retnl( 0 ); +} diff --git a/harbour/contrib/xhb/xhbver.ch b/harbour/contrib/xhb/xhbver.ch index a0812e1001..5e792a7753 100644 --- a/harbour/contrib/xhb/xhbver.ch +++ b/harbour/contrib/xhb/xhbver.ch @@ -1,92 +1,92 @@ -/* - * $Id: hbver.ch,v 1.1 2005/03/09 05:38:01 andijahja Exp $ - */ - -/* - * Harbour Project source code: - * Header file for version information - * - * Copyright 2005 Andi Jahja - * www - http://www.harbour-project.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ - -#ifndef HB_VERX_CH_ -#define HB_VERX_CH_ - -#define _HB_VER_MAJOR 1 /* int */ -#define _HB_VER_MINOR 2 /* int */ -#define _HB_VER_REVISION 3 /* int */ -#define _HB_VER_LEX 4 /* char */ -#define _HB_VER_AS_STRING 5 /* char */ -#define _HB_PCODE_VER 6 /* int */ -#define _HB_VER_COMPILER 7 /* char */ -#define _HB_VER_PLATFORM 8 /* char */ -#define _HB_VER_BUILD_DATE 9 /* char */ -#define _HB_VER_BUILD_TIME 10 /* char */ -#define _HB_VER_LENTRY 11 /* char */ -#define _HB_VER_CHLCVS 12 /* char */ -#define _HB_VER_C_USR 13 /* char */ -#define _HB_VER_L_USR 14 /* char */ -#define _HB_VER_PRG_USR 15 /* char */ -#define _HB_EXTENSION 16 /* bool */ -#define _HB_C52_UNDOC 17 /* bool */ -#define _HB_C52_STRICT 18 /* bool */ -#define _HB_COMPAT_C53 19 /* bool */ -#define _HB_COMPAT_XPP 20 /* bool */ -#define _HB_COMPAT_VO 21 /* bool */ -#define _HB_COMPAT_FLAGSHIP 22 /* bool */ -#define _HB_COMPAT_FOXPRO 23 /* bool */ -#define _HB_COMPAT_DBASE 24 /* bool */ -#define _HB_HARBOUR_OBJ_GENERATION 25 /* bool */ -#define _HB_HARBOUR_STRICT_ANSI_C 26 /* bool */ -#define _HB_CPLUSPLUS 27 /* bool */ -#define _HB_HARBOUR_YYDEBUG 28 /* bool */ -#define _HB_SYMBOL_NAME_LEN 29 /* int */ -#define _HB_MULTITHREAD 30 /* bool */ -#define _HB_VM_OPTIMIZATION 31 /* int */ -#define _HB_LANG_ID 32 /* char */ -#define _HB_ARRAY_MODE 33 /* int */ -#define _HB_CREDITS 34 /* array */ -#define _HB_VER_LAST 35 /* last */ - -#endif /* HB_VERX_CH_ */ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Header file for version information + * + * Copyright 2005 Andi Jahja + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#ifndef HB_VERX_CH_ +#define HB_VERX_CH_ + +#define _HB_VER_MAJOR 1 /* int */ +#define _HB_VER_MINOR 2 /* int */ +#define _HB_VER_REVISION 3 /* int */ +#define _HB_VER_LEX 4 /* char */ +#define _HB_VER_AS_STRING 5 /* char */ +#define _HB_PCODE_VER 6 /* int */ +#define _HB_VER_COMPILER 7 /* char */ +#define _HB_VER_PLATFORM 8 /* char */ +#define _HB_VER_BUILD_DATE 9 /* char */ +#define _HB_VER_BUILD_TIME 10 /* char */ +#define _HB_VER_LENTRY 11 /* char */ +#define _HB_VER_CHLCVS 12 /* char */ +#define _HB_VER_C_USR 13 /* char */ +#define _HB_VER_L_USR 14 /* char */ +#define _HB_VER_PRG_USR 15 /* char */ +#define _HB_EXTENSION 16 /* bool */ +#define _HB_C52_UNDOC 17 /* bool */ +#define _HB_C52_STRICT 18 /* bool */ +#define _HB_COMPAT_C53 19 /* bool */ +#define _HB_COMPAT_XPP 20 /* bool */ +#define _HB_COMPAT_VO 21 /* bool */ +#define _HB_COMPAT_FLAGSHIP 22 /* bool */ +#define _HB_COMPAT_FOXPRO 23 /* bool */ +#define _HB_COMPAT_DBASE 24 /* bool */ +#define _HB_HARBOUR_OBJ_GENERATION 25 /* bool */ +#define _HB_HARBOUR_STRICT_ANSI_C 26 /* bool */ +#define _HB_CPLUSPLUS 27 /* bool */ +#define _HB_HARBOUR_YYDEBUG 28 /* bool */ +#define _HB_SYMBOL_NAME_LEN 29 /* int */ +#define _HB_MULTITHREAD 30 /* bool */ +#define _HB_VM_OPTIMIZATION 31 /* int */ +#define _HB_LANG_ID 32 /* char */ +#define _HB_ARRAY_MODE 33 /* int */ +#define _HB_CREDITS 34 /* array */ +#define _HB_VER_LAST 35 /* last */ + +#endif /* HB_VERX_CH_ */ diff --git a/harbour/examples/dbu/dbu.hbp b/harbour/examples/dbu/dbu.hbp index 6307403efc..e2209b8f98 100644 --- a/harbour/examples/dbu/dbu.hbp +++ b/harbour/examples/dbu/dbu.hbp @@ -1,13 +1,13 @@ -# -# $Id$ -# - -dbu.prg -dbucopy.prg -dbuedit.prg -dbuhelp.prg -dbuindx.prg -dbunet.prg -dbustru.prg -dbuutil.prg -dbuview.prg +# +# $Id$ +# + +dbu.prg +dbucopy.prg +dbuedit.prg +dbuhelp.prg +dbuindx.prg +dbunet.prg +dbustru.prg +dbuutil.prg +dbuview.prg diff --git a/harbour/examples/guestbk/guestbk.hbp b/harbour/examples/guestbk/guestbk.hbp index 2d3586cd1e..34890fa05c 100644 --- a/harbour/examples/guestbk/guestbk.hbp +++ b/harbour/examples/guestbk/guestbk.hbp @@ -1,5 +1,5 @@ -# -# $Id$ -# - -guestbk.prg inifiles.prg testcgi.prg +# +# $Id$ +# + +guestbk.prg inifiles.prg testcgi.prg diff --git a/harbour/examples/hbapollo/hbapollo.hbc b/harbour/examples/hbapollo/hbapollo.hbc index 815ac537ab..54250ea0ea 100644 --- a/harbour/examples/hbapollo/hbapollo.hbc +++ b/harbour/examples/hbapollo/hbapollo.hbc @@ -1,11 +1,11 @@ -# -# $Id$ -# - -{dos}skip=yes - -incpaths=. -libpaths=lib/${hb_arch}/${hb_comp} - -libs=hbapollo -libs={win}sde61 +# +# $Id$ +# + +{dos}skip=yes + +incpaths=. +libpaths=lib/${hb_arch}/${hb_comp} + +libs=hbapollo +libs={win}sde61 diff --git a/harbour/examples/hbdoc/hbdoc.hbp b/harbour/examples/hbdoc/hbdoc.hbp index eb6ae52fcb..cbb7464334 100644 --- a/harbour/examples/hbdoc/hbdoc.hbp +++ b/harbour/examples/hbdoc/hbdoc.hbp @@ -1,16 +1,16 @@ -# -# $Id$ -# - -hbdoc.prg -ft_funcs.prg -genasc.prg -genchm.prg -genhpc.prg -genhtm.prg -genng.prg -genos2.prg -genpdf1.prg -genrtf.prg -gentrf.prg -hbdfrdln.c +# +# $Id$ +# + +hbdoc.prg +ft_funcs.prg +genasc.prg +genchm.prg +genhpc.prg +genhtm.prg +genng.prg +genos2.prg +genpdf1.prg +genrtf.prg +gentrf.prg +hbdfrdln.c diff --git a/harbour/examples/hbgf/tests/hbgf.hbc b/harbour/examples/hbgf/tests/hbgf.hbc index 22465af3ae..d8bf721f0e 100644 --- a/harbour/examples/hbgf/tests/hbgf.hbc +++ b/harbour/examples/hbgf/tests/hbgf.hbc @@ -1,7 +1,7 @@ -# -# $Id$ -# - -{win}libs=hbgfwin -{os2}libs=hbgfos2 -{linux|darwin|bsd|sunos}libs=hbgfgtk +# +# $Id$ +# + +{win}libs=hbgfwin +{os2}libs=hbgfos2 +{linux|darwin|bsd|sunos}libs=hbgfgtk diff --git a/harbour/examples/hbmsql/hbmsql.hbc b/harbour/examples/hbmsql/hbmsql.hbc index 89558d30b6..075829a07a 100644 --- a/harbour/examples/hbmsql/hbmsql.hbc +++ b/harbour/examples/hbmsql/hbmsql.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=. -libpaths=lib/${hb_arch}/${hb_comp} - -libs=hbmsql +# +# $Id$ +# + +incpaths=. +libpaths=lib/${hb_arch}/${hb_comp} + +libs=hbmsql diff --git a/harbour/examples/hbsqlit2/hbsqlit2.hbc b/harbour/examples/hbsqlit2/hbsqlit2.hbc index e86c2e73c6..86243b3b49 100644 --- a/harbour/examples/hbsqlit2/hbsqlit2.hbc +++ b/harbour/examples/hbsqlit2/hbsqlit2.hbc @@ -1,9 +1,9 @@ -# -# $Id$ -# - -incpaths=. -libpaths=lib/${hb_arch}/${hb_comp} - -libs=hbsqlit2 -libs=sqlite2 +# +# $Id$ +# + +incpaths=. +libpaths=lib/${hb_arch}/${hb_comp} + +libs=hbsqlit2 +libs=sqlite2 diff --git a/harbour/examples/hbwhat/hbwhat.hbc b/harbour/examples/hbwhat/hbwhat.hbc index 647fa5403e..1639bc3e84 100644 --- a/harbour/examples/hbwhat/hbwhat.hbc +++ b/harbour/examples/hbwhat/hbwhat.hbc @@ -1,11 +1,11 @@ -# -# $Id$ -# - -{!win}skip=yes - -incpaths=. -libpaths=lib/${hb_arch}/${hb_comp} - -libs=hbwhat -libs=xhb.hbc +# +# $Id$ +# + +{!win}skip=yes + +incpaths=. +libpaths=lib/${hb_arch}/${hb_comp} + +libs=hbwhat +libs=xhb.hbc diff --git a/harbour/examples/hscript/hscript.hbp b/harbour/examples/hscript/hscript.hbp index fbe7df444d..b0d0a90e2c 100644 --- a/harbour/examples/hscript/hscript.hbp +++ b/harbour/examples/hscript/hscript.hbp @@ -1,5 +1,5 @@ -# -# $Id$ -# - -hscript.prg -lhbnf +# +# $Id$ +# + +hscript.prg -lhbnf diff --git a/harbour/examples/pe/pe.hbp b/harbour/examples/pe/pe.hbp index 02c52e7115..cf7b08f931 100644 --- a/harbour/examples/pe/pe.hbp +++ b/harbour/examples/pe/pe.hbp @@ -1,5 +1,5 @@ -# -# $Id$ -# - -pe.prg editorhi.prg editorlo.c +# +# $Id$ +# + +pe.prg editorhi.prg editorlo.c diff --git a/harbour/examples/pp/pp.hbp b/harbour/examples/pp/pp.hbp index 5cfe74b4fa..9ab3a80b25 100644 --- a/harbour/examples/pp/pp.hbp +++ b/harbour/examples/pp/pp.hbp @@ -1,5 +1,5 @@ -# -# $Id$ -# - -pp.c hbppcomp.c hbppcore.c hbpptbl.c hbpragma.c +# +# $Id$ +# + +pp.c hbppcomp.c hbppcore.c hbpptbl.c hbpragma.c diff --git a/harbour/examples/rl/rl.hbp b/harbour/examples/rl/rl.hbp index f447094014..3238b0a5ee 100644 --- a/harbour/examples/rl/rl.hbp +++ b/harbour/examples/rl/rl.hbp @@ -1,11 +1,11 @@ -# -# $Id$ -# - --orl --m -n --main=setup - -rlfront.prg -rlback.prg -rldialg.prg +# +# $Id$ +# + +-orl +-m -n +-main=setup + +rlfront.prg +rlback.prg +rldialg.prg diff --git a/harbour/examples/terminal/terminal.hbc b/harbour/examples/terminal/terminal.hbc index e202bf1f5e..0e74f2ddf4 100644 --- a/harbour/examples/terminal/terminal.hbc +++ b/harbour/examples/terminal/terminal.hbc @@ -1,8 +1,8 @@ -# -# $Id$ -# - -incpaths=../../contrib/gtwvg -{win}libs=gtwvg -mt=yes -gui=yes +# +# $Id$ +# + +incpaths=../../contrib/gtwvg +{win}libs=gtwvg +mt=yes +gui=yes diff --git a/harbour/examples/terminal/trm_app.hbp b/harbour/examples/terminal/trm_app.hbp index 2e7d7c7583..7ae6963c5e 100644 --- a/harbour/examples/terminal/trm_app.hbp +++ b/harbour/examples/terminal/trm_app.hbp @@ -1,7 +1,7 @@ -# -# $Id$ -# - -trm_app.prg -terminal.prg -trm_misc.c +# +# $Id$ +# + +trm_app.prg +terminal.prg +trm_misc.c