Гость
Форумы / SQLite [игнор отключен] [закрыт для гостей] / Sqlite odbc driver / 5 сообщений из 5, страница 1 из 1
24.04.2013, 15:52
    #38238465
aduka05adm
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Sqlite odbc driver
Привет всем , ситуация следующая,
использую данный драйвер для доступа к БД SQlite
прочитав в ветке о том что возможен пакетный запрос,стал пробовать но выдает ошибку, насколько понимаю драйвер не позволяет.
Хотя
So far it has been tested with SQLite 2.8.17 and SQLite 3.7.16.1 on Windows NT/2000 in MS Excel 97 (MSQUERY) with SQLite database files created on Linux. Support for Win64 exists for both SQLite 2.x and SQLite 3.x versions of the driver, but this has been only partially tested. It also runs on Linux with unixODBC 2.[0-2].x and with libiodbc 3.[05].x.
написано что версия 3.7.16.1 вроде как работает у данного драйвера.
в соседней ветке прочел что,Множественные VALUES поддерживаются начиная с 3.7.11 .в той же ветке прочел что можно использовать конструкцию
Код: sql
\r\nINSERT INTO DBname\r\nSELECT 1 значение\r\nUNION SELECT 2 значение\r\nUNION SELECT 3 значение\r\nUNION SELECT 4 значение\r\n
\r\n
возможно ли использовать данную конструкцию , если в
Код: sql
\r\nSELECT\r\n
\r\n я буду подставлять готовые данные из Recordset ?
Пример кода
Код: vbnet
\r\nDo While Not Rs.EOF\r\n   comma = ""\r\n   strsqltemp = ""\r\n   For I = 0 To Rs.Fields.Count - 1\r\n       If IsNumeric(Rs.Fields(I)) Then\r\n            strsqltemp = strsqltemp + comma + "\'" + Str(Rs.Fields(I)) + "\'"\r\n       Else\r\n            strsqltemp = strsqltemp + comma + "\'" + Rs.Fields(I) + "\'"\r\n       End If\r\n       comma = ","\r\n    Next I\r\n    strsqltemp2 = strsqltemp2 & strsqltemp3 & " Select ( " & strsqltemp & " ) "\r\n    strsqltemp3 = "UNION"   \r\nRs.MoveNext\r\nLoop\r\n\r\nstrsql = "insert into clients " & strsqltemp2\r\ncommSQlite.CommandText = strsql\r\ncommSQlite.Execute\r\n
\r\n
...
Рейтинг: 0 / 0
24.04.2013, 17:37
    #38238750
pit_alex
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Sqlite odbc driver
aduka05adm,

почему нет? В цикле же просто строка формируется, а только потом выполняется, если строка сформирована правильно то все должно работать
...
Рейтинг: 0 / 0
24.04.2013, 17:45
    #38238777
aduka05adm
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Sqlite odbc driver
в данной конструкции не обязательно наличие?
Код: sql
1.
From tablename


на самом деле проблема решилась , оказывается надо было все занести в транзакцию и скорость записи увеличивается,
http://www.sqlite.org/speed.html Test 1: 1000 INSERTs

CREATE TABLE t1(a INTEGER, b INTEGER, c VARCHAR(100));
INSERT INTO t1 VALUES(1,13153,'thirteen thousand one hundred fifty three');
INSERT INTO t1 VALUES(2,75560,'seventy five thousand five hundred sixty');
... 995 lines omitted
INSERT INTO t1 VALUES(998,66289,'sixty six thousand two hundred eighty nine');
INSERT INTO t1 VALUES(999,24322,'twenty four thousand three hundred twenty two');
INSERT INTO t1 VALUES(1000,94142,'ninety four thousand one hundred forty two');
PostgreSQL: 4.373
MySQL: 0.114
SQLite 2.7.6: 13.061
SQLite 2.7.6 (nosync): 0.223
Because it does not have a central server to coordinate access, SQLite must close and reopen the database file, and thus invalidate its cache, for each transaction. In this test, each SQL statement is a separate transaction so the database file must be opened and closed and the cache must be flushed 1000 times. In spite of this, the asynchronous version of SQLite is still nearly as fast as MySQL. Notice how much slower the synchronous version is, however. SQLite calls fsync() after each synchronous transaction to make sure that all data is safely on the disk surface before continuing. For most of the 13 seconds in the synchronous test, SQLite was sitting idle waiting on disk I/O to complete.

Test 2: 25000 INSERTs in a transaction

BEGIN;
CREATE TABLE t2(a INTEGER, b INTEGER, c VARCHAR(100));
INSERT INTO t2 VALUES(1,59672,'fifty nine thousand six hundred seventy two');
... 24997 lines omitted
INSERT INTO t2 VALUES(24999,89569,'eighty nine thousand five hundred sixty nine');
INSERT INTO t2 VALUES(25000,94666,'ninety four thousand six hundred sixty six');
COMMIT;
PostgreSQL: 4.900
MySQL: 2.184
SQLite 2.7.6: 0.914
SQLite 2.7.6 (nosync): 0.757
When all the INSERTs are put in a transaction, SQLite no longer has to close and reopen the database or invalidate its cache between each statement. It also does not have to do any fsync()s until the very end. When unshackled in this way, SQLite is much faster than either PostgreSQL and MySQL.

да и здесь ребята тоже так советуют делать
...
Рейтинг: 0 / 0
24.04.2013, 18:06
    #38238822
pit_alex
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Sqlite odbc driver
aduka05adm,

авторв данной конструкции не обязательно наличие?

нет SQLite не требует обязательного наличия FROM
...
Рейтинг: 0 / 0
24.04.2013, 19:58
    #38239014
aduka05adm
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Sqlite odbc driver
Почему то ругался у меня на синтаксическую ошибку , попробую еще раз
...
Рейтинг: 0 / 0
Форумы / SQLite [игнор отключен] [закрыт для гостей] / Sqlite odbc driver / 5 сообщений из 5, страница 1 из 1
Целевая тема:
Создать новую тему:
Автор:
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]