.. :
.. include:: commonchm.txt
***********************************
1sqlite
***********************************
.. <chminfo>
<insert nodes="//common/maininfo/*"/>
<alinks>_1sqlite_maininfo_</alinks>
<klinks>1sqlite</klinks>
</chminfo>
.. contents::
:backlinks: none
, SQLite.
** 1.0.2.3**
http://www.sqlite.org.
- (orefkov@gmail.com)
( , SQLite,
1. ,
SQLite "in memory" ( ),
.)
, - 1, ""
SQLite " "
1 "" 1.
1 .
( . ` - 1 SQLite`_)
:
- SQLite 3.6.22
- SQLite ,
lower, upper, like, , .
- collate _1 - .
- - 1 SQLite .
- - 1 .
- "" 1-.
- 1.
- sql .
- SQLite .
- SQLite 1,
.
- sqlite 1 DBF 1++.
1 ::
("_1sqlite.dll");
SQLite
--------------------------------------------
.. <chminfo>
<insert nodes="//common/propsmethods/*"/>
</chminfo>
SQLite , .
str2id
===============
**:** str2id()
**:**
- : 36
**:** .
**:** - 36 .
id2str
===============
**:** id2str(, )
**:**
- :
- -
**:** .
**:** - 36 .
,
, .
- 1 SQLite
----------------------------------------------
SQLite
- " ",
SQL-, - ,
, , ,
- .
, SQLite " ".
::
create virtual table using ()
- ,
- .
SQL-, ,
SQLite ,
-.
SQLite.
.
, , /
.
, - 1, SQLite
*dbeng*, SQLite
- 1. ,
dbeng "" dbeng32.dll,
1 SQL- , ""
"" , -1 ,
(OLEDB, ODBC) .
1 dbeng ,
-. -,
, -
, SQL- -.
, .
, SQLite *rowid*,
. dbeng
-.
dbeng
"" - , SQLite
, , dbeng -
, . -
1++,
. ::
idx_1_2_
"idx", "_" , .
.
SQLite numeric.
SQLite , double.
double 16 , 1,
17, . , double
( 17 , 0.3 0.30000000000000001).
, `0.3 - 0.1 = 0.2` .
round.
, `round(0.3 - 0.1, 1) = 0.2` .
1 SQLite ::
// -
= ("SQLiteBase");
("1sqlite.dll");
= ("SQLiteBase");
;
//
.(":memory:");
// .
= .();
// , ,
.("PRAGMA journal_mode = OFF");
// SQLite
.("create virtual table using dbeng(.)");
// , ,
("=" + .("
|select count(*)
|from
|where .isfolder = 2
|").(1, 1));
===============================
.. <chminfo>
<klinks>,</klinks>
</chminfo>
, ::
|Reference.
::
create virtual table using dbeng(.)
create virtual table Customers using dbeng(Reference.)
:
- , (descr, code, id, isfolder ..)
- ,
( SP73636)
- " ", ,
( - )
- (. 1Cv7.DD)
===================================
.. <chminfo>
<klinks>, </klinks>
</chminfo>
, ::
|Document.
::
create virtual table using dbeng(.)
create virtual table Invoices using dbeng(Document.)
:
- , (iddoc )
- ,
( SP73636)
- " ", ,
( - )
- " ",
, .
- "", ,
- (. 1Cv7.DD)
===================================
.. <chminfo>
<klinks>, </klinks>
</chminfo>
, ::
|DocumentLines.
::
create virtual table using dbeng(.)
create virtual table InvoicesLines using dbeng(DocumentLines.)
:
- , (iddoc, lineno )
- ,
( SP73636)
- (. 1Cv7.DD)
======================================
.. <chminfo>
<klinks>, </klinks>
</chminfo>
(1SJOURN) , ::
|Journal
::
create virtual table using dbeng()
create virtual table Journal using dbeng(Journal)
:
- , (iddoc, iddocdef )
- "", ,
- ,
-
- (. 1Cv7.DD)
=====================================
.. <chminfo>
<klinks>, </klinks>
</chminfo>
, ::
|Register.
::
create virtual table using dbeng(.)
create virtual table Sales using dbeng(Register.)
:
- , (iddoc, lineno, debkred )
- ,
( SP73636)
- ,
- , .
- (. 1Cv7.DD)
===================================
.. <chminfo>
<klinks>, </klinks>
</chminfo>
, ::
|RegisterTotals.
::
create virtual table using dbeng(.)
create virtual table SalesTotals using dbeng(RegisterTotals.)
:
- , (period )
- ,
( SP73636)
- ,
- (. 1Cv7.DD)
==================================
.. <chminfo>
<klinks>, </klinks>
</chminfo>
, ::
|CalcJournal.
::
create virtual table using dbeng(.)
create virtual table Payments using dbeng(CalcJournal.)
:
- , (period )
- ,
( SP73636)
- (. 1Cv7.DD)
1Sxxx
==================================
.. <chminfo>
<klinks>,1Sxxx</klinks>
</chminfo>
1, 1S ( 1SJOURN), , ::
_1|_1S.1
::
create virtual table using dbeng(_1.Accs)
create virtual table Consts using dbeng(_1S.Const)
:
- - , .
- (. 1Cv7.DD)
1
=====================================
.. <chminfo split="0">
<klinks>,</klinks>
</chminfo>
1.0.1.4
, .
, 1,
.
FROM :
, ,
'.' '_', '_',
, '__' ( ).
::
select ... from _ as
_,
., *create virtaul table* .
::
select ... from __1S_crdoc as
1SCRDOC
::
select ... from ___ as
_.
** 1.0.2.3**
, 1, []
::
select .id from [.] as
select iddoc from [.]
------------------
:
SQLiteBase, , SQLiteQuery,
.
.
SQLiteBase,
SQLiteQuery, sql-,
.
SQLiteBase
=================
.. <chminfo splitchild="0">
<insert nodes="//common/propsmethods/*"/>
</chminfo>
SQLite -.
::
= ("SQLiteBase");
~~~~~~~
.. <chminfo split="0" splitchild="1">
<insert nodes="//common/propsmethods/*"/>
</chminfo>
/ Open
++++++++++++++
**:** ()
**:**
- , : .
**:**
**:** / .
, .
":memory:", .
, ,
SQLite.
/ IsOpen
++++++++++++++++
**:** ()
**:**
**:** . 1 - , 0 - .
**:** , .
/ Close
+++++++++++++++
**:** ()
**:**
**:** .
**:** .
,
. ,
" ".
/ NewQuery
++++++++++++++++++++++
.. _`SQLiteBase::`:
**:** ()
**:**
**:** ` SQLiteQuery`_
**:** SQLiteQuery.
/ DoProfile
++++++++++++++++++++
**:** ()
**:**
**:**
**:** .
.
,
. ,
, ,
.
/ Profile
+++++++++++++++
**:** ()
**:**
**:** . .
**:** .
SQLite ,
VDBE - .
,
,
,
.
.
- , - .
,
.
/ PutVT
+++++++++++++++++
**:** (, , [])
**:**
- - : . ,
- - : . .
- - : . 1 - , 0 -
. . 0.
**:**
**:** , .
, .
.
.
,
` 1 ( )`_
/ PutObjects
+++++++++++++++++++++++++++
**:** (, , [], [])
**:**
- - : , , . .
- - : . .
- - : . 1 - , 0 -
. . 0.
- - : .
. .
- .
**:**
**:** , .
val.
, .
char(9).
,
.
( ), -
/ .
. -, sql-
1 .
, ,
, . ,
/ - ,
.
,
, .
, .
SQLiteQuery
==================
.. <chminfo splitchild="0">
<insert nodes="//common/propsmethods/*"/>
</chminfo>
.
`SQLiteBase::`_.
,
. .
~~~~~~~
.. <chminfo split="0" splitchild="1">
<insert nodes="//common/propsmethods/*"/>
</chminfo>
/ Debug
++++++++++++++++
**:** ([])
**:**
- - : . 0 - , 0 - .
. : 1.
**:** .
**:** / .
, -.
1, .
. ,
,
.
/ ExecuteQuery
++++++++++++++++++++++++++++++
.. _`SQLiteQuery::`:
**:** (, [], [])
**:**
- - : . .
- - : . .
. - .
- - : .
. . - .
**:** , - .
, **:
- ** : .
- ** :
** , .
** ( , 0),
, 1 -
,
.
, , .
- ** :
** , .
.
- ** , 0 1 -
.
- ** 2 3 -
, ( ) -
, (
) - , 0 - , 0 -
. .
** , 0 2,
,
.
- ** :
, , . 0.
- ** ,
SQLite, ,
.
**:** sql-.
, ,
.
.
,
, , **,
**.
** ,
SQLite .
.
,
, , . ** ,
.
. ,
,
,
'.' '_'.
** -
, . 0.
-, , ,
. ,
.
/ ParseSqlText
+++++++++++++++++++++++++++++++++++++
**:** ()
**:**
- - : . .
**:** , .
**:** "" ,
, "".
, ,
, .
/ Prepeare
++++++++++++++++++++++
.. <chminfo>
<alinks>1sqlite_prep</alinks>
<klinks> </klinks>
<seealso>1sqlite_prep</seealso>
</chminfo>
**:** ()
**:**
- - : . .
**:** .
**:** sql-.
.
`SQLiteQuery::`_,
sql- `SQLiteQuery::`_.
.
.
SQLite :
- . SQLite
VDBE (Virtual DataBase Engine - SQLite, )
- ,
.
- . .
, .
, ,
( ),
. ,
.
,
, :
, sql-.
:
- ? - , .
- ? - , .
- $ @ - , .
, , .
, - ::
;
()
= .();
()
.("", );
.("", );
= .("select sum() from where period=: and = :");
.(1, 1);
,
, ,
, ::
;
()
= .();
.("", );
.("select sum() from where period=: and = @");
()
.("@", );
= .();
.(1, 1);
, .
/ SetParam
+++++++++++++++++++++++++++++
.. <chminfo>
<alinks>1sqlite_prep</alinks>
<klinks> </klinks>
<seealso>1sqlite_prep</seealso>
</chminfo>
.. _`SQLiteQuery::`:
**:** (, , [])
**:**
- - : , . sql-,
( 1).
- - : . .
- - : . , 1
. . ` 1 ( )`_.
. 0.
**:** .
**:** sql- .
SQL .
:
- ? - , .
- ? - , .
- $ @ - , .
, .
/ Exec
++++++++++++++++
.. <chminfo>
<alinks>1sqlite_prep</alinks>
<klinks> </klinks>
<seealso>1sqlite_prep</seealso>
</chminfo>
.. _`SQLiteQuery::`:
**:** ([], [])
**:**
- - : . .
. - .
- - : .
. . - .
**:** - **.
**:** sql-.
.
.
. `SQLiteQuery::`_.
/ Substitute
++++++++++++++++++++++++
.. _`SQLiteQuery::`:
**:** (, )
**:**
- - : . , .
- - : . , .
**:** .
**:** .
- ::
:[*~]
SQLite,
.
,
.
(. ` 1 ( )`_)
'*', '~',
( ).
'*' '-1', '~'
.
::
: - 0
:~ - 1
:~~~ - 3
:* - -1
, sql-, ,
, ,
.
.
````````````````````````````````````
.. <chminfo split="0" splitchild="0">
<klinks> </klinks>
</chminfo>
,
. -
.
- 0 1.
4 - 36 , 1 - .
/ Constant
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|Constant.[~]
4 -
36
1 - .
/ ReferenceKind
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|ReferenceKind.[~]
4 -
36
1 - .
/ DocumentKind
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|DocumentKind.[~]
4 -
36
1 - .
/ EnumKind
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|EnumKind.[~]
4 -
36
1 - .
/ PropertyHistory
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|PropertyHistory..[~]
4 -
36
1 - .
/ DocsJournal
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|DocsJournal.[~]
4 -
36
1 - .
/ SelectionColumn
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|SelectionColumn.[~]
4 -
36
1 - .
/ Calendar
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|Calendar.[~]
4 -
36
1 - .
/ Holidays
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|Holidays[~]
4 -
36
1 - .
/ CalcJournalKind
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|CalcJournalKind.[~]
4 -
36
1 - .
/ Algorithm
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|Algorithm.[~]
4 -
36
1 - .
/ EmptyID
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|EmptyID
9 : ' 0 '
13 / EmptyID13
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:13|EmptyID13
13 : ' 0 0 '
/ Enumeration
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|Enumeration..
9 : .
/ SubcKind
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|SubcKind.[~]
4 -
36
1 - .
/ ChartOfAccounts
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
::
:|ChartOfAccounts.[~]
4 -
36
1 - .
~~~~~~~~
.. <chminfo split="0" splitchild="1">
<insert nodes="//common/propsmethods/*"/>
</chminfo>
/ NeedTransaction
++++++++++++++++++++++++++++++++++++++
**:**
**/**
**:** 1 - 1
1, 0 - .
SQLiteQuery 0.
, 1,
1 , ,
, .
, 1,
- 1.
, , ,
.
SQLiteDataProvider
=========================
.. <chminfo splitchild="0">
<insert nodes="//common/propsmethods/*"/>
</chminfo>
1++.
sqlite 1 DBF-.
,
. .
1 , .
~~~~~~
.. <chminfo split="0" splitchild="1">
<insert nodes="//common/propsmethods/*"/>
</chminfo>
/ SetDataBase
++++++++++++++++++++++++++
**:** ([])
**:**
- - : SQLiteBase. ,
. . ,
.
**:** .
**:** , .
/ SetParam
+++++++++++++++++++++++++++++
**:** (, , [])
**:**
- - : . sql-.
- - : . .
- - : . , 1
. . ` 1 ( )`_.
. 0.
**:** .
**:** `SQLiteQuery::`_.
SQL- ,
.
/ Substitute
++++++++++++++++++++++++
**:** (, )
**:**
- - : . , .
- - : . , .
**:** .
**:** `SQLiteQuery::`_.
,
`SQLiteDataProvider::`_ ,
, .
/ SetQueryText
+++++++++++++++++++++++++++++++++++++
.. _`SQLiteDataProvider::`:
**:** (, , [])
**:**
- - : . .
- - : . , .
- - : . ,
. ::. .
**:** .
**:** .
,
, , .
""
, :
- N
- N ,
- N
- N ,
-
- ID- ().
,
. .
,
.
, :
- (select'), ( order by).
- , * .
- - , []
- SQL- ( @),
SQL- '?' .
.
::
("
select
idx_descr,
id [ :.],
descr []
from _
"idx_descr", "");
/ Debug
+++++++++++++++
.. _`SQLiteDataProvider::`:
**:** ()
**:**
- - : . 0 - , 1 - .
**:** .
**:** / .
/ Reread
+++++++++++++++++++
**:** ()
**:** .
**:** .
**:** .
, sql-
. ,
.
, .
/ NoDeleteFields
++++++++++++++++++++++++++++++
.. _`SQLiteDataProvider::`:
**:** ()
**:**
- - : . ,
, .
**:** .
**:** ,
.
ID ,
.
/ QuickSearchFields
++++++++++++++++++++++++++++++++++++++
.. _`SQLiteDataProvider::`:
**:** ()
**:**
- - : . ,
.
**:** .
**:** , .
/ GetQueryText
+++++++++++++++++++++++++++++++++++
.. _`SQLiteDataProvider::`:
**:** ()
**:**
- - : . 0 - ,
, 0 - .
**:** , .
**:** .
, .
, ,
.
1
----------------------------------------------------
1, ,
1 1 ,
- , .
1 :
- 1
- 1
( , 1 ),
,
, .
1 ( )
========================================================================
.. <chminfo splitchild="0">
</chminfo>
, , .
,
1 .
.
, ,
:
- ""
.
- .
- ""
:
"mod=",
, .
"mod=",
, -1. , ""
, ( "", ""),
1. 0.
-1 "",
23 . 0 .
1.
~~~~~~~~~~~~~~~~~~~~~
- 0: .
- 1: ,
1 date_time_iddoc.
- 2: ,
1 date_time_iddoc + ''
- 3: ,
''. sql
.
.
. . ::
= ":~~~";
.("", ":~~~");
.
~~~~~~~~~~~~~~~~~~~
- 0: . sql- ,
, , double.
~~~~~~~~~~~~~~~~~~~
- 0: 'YYYYMMDD', -
- 1: 'YYYYMMDD',
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
- 2: 4 -
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
- 2: 4 -
- 3: 23 - date_time_iddoc
- 4: 24 - date_time_iddoc + ''
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
- 2: 4 -
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
- 2: 4 -
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
- 2: 4 -
~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0: 9 -
- 1: 13 -
- 2: 4 -
1 ( )
========================================================================
.. <chminfo splitchild="0">
</chminfo>
1.
.
:
'$' ':',
.
, . ::
select id [ :.]...
, .
, " " -
, , (double) .
~~~~~~~~~~~~~~~~
::
$|:|String[.]
.
~~~~~~~~~~~~~~~
::
$|:|Number[.[.]]
.
, .
~~~~~~~~~~~~~~
::
$|:|Date
8 ,
'YYYYMMDD', .
~~~~~~~~~~~~~~~~~~~~
::
$|:|Reference[.]
9 -
.
, 13 -
.
~~~~~~~~~~~~~~~~~~
::
$|:|Document[.]
9 -
.
, 13 -
.
9 - ,
, + "_", "_kind",
.
~~~~~~~~~~~~~~~~~~~~~~
::
$|:|DocumentKind
- 4 ,
. - .
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
$|:|DocumentKindPresent
- 4 ,
. - .
~~~~~~~~~~~~~~~~~~~~~
::
$|:|SubcontoKind
- 4 ,
. - .
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
$|:|SubcontoKindPresent
- 4 ,
. - .
~~~~~~~~~~~~~~~~~
::
$|:|KindName
- 4 ,
. - .
~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
$|:|KindPresent
- 4 ,
. - .
~~~~~~~~~~~~~~~~~~~~~~
::
$|:|Enum[.]
9 -
.
, 13 -
.
~~~~~~~~~~~~~~
::
$|:|Account[.]
9 -
.
, 13 -
.
~~~~~~~~~~~~~~~~~~~~~~~~
::
$|:|Undefine
23 .
~~~~~~~~~~~~~~~~~~~~
::
$|:|CalculationKind
13 - ,
4 , .
~~~~~~~~~~~~~~~~~~~
::
$|:|Calendar
13 - .
~~~~~~~~~~~~~~~~~~
::
$|:|Subconto
.
(, , ) .
_ _kind,
( 4 36 ,
). -
, 9 , ,
13 , .
~~~~~~~~~~~~~~~
::
$|:|Time
, 36 ,
1 - ,
10000. 8 -
::.
-------------------
- **1.0.1.1**
- , .
- : : :
- **1.0.1.2**
- .
- **1.0.1.3**
- - .
- **1.0.1.4**
- 1.
- **1.0.1.5**
- ":."
- 3 ` `_
- **1.0.1.6**
- .
- :
- :
- str2id
- id2str
- **1.0.1.7**
- 3 "".
.
- ":" ":".
- ":" ":".
- `SQLiteQuery::`_.
, ,
, ,
(ISQLiteResultLoader).
- **1.0.1.8**
- NULL .
- utf-8
- LIMIT
- ,
- :
:
- :
:
- **1.0.1.9**
- :,
( ) .
- NULL ,
( ) .
- Begin/EndReadSequnce.
, .
- SQLiteQuery::
- SQLiteQuery::
- ,
.
- 1,
.
- 1.
- -
, (
).
- SQLiteDataProvider - 1++
sqlite 1 DBF-.
- **1.0.2.0**
- SQLite 3.6.11
- ,
-
-
(where date <= '091929..' order by date desc)
- 972 .
- 'collate _1C' - 1.
- :
- `SQLiteDataProvider::`_
- `SQLiteDataProvider::`_
- :
- `SQLiteDataProvider::`_
- `SQLiteDataProvider::`_
- `SQLiteDataProvider::`_
- **1.0.2.2**
- SQLite 3.6.18
- **1.0.2.3**
- SQLite 3.6.22
- 1,
- 1, ,
[]. ::
select .id from [.] as
- .