Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Базы";
Текущий архив: 2005.10.09;
Скачать: [xml.tar.bz2];

Вниз

Как правильно закачивать в базу большие объемы данных?   Найти похожие ветки 

 
y-soft ©   (2005-08-05 23:07) [40]

>Defunct ©   (05.08.05 21:21) [39]

при TCP соединении

Если есть возможность работать с базой монопольно, попробуйте локальное соединение - скорость еще увеличится...


 
Джо ©   (2005-08-06 05:44) [41]

Эх, вот жеж мучаются люди с ИБ... А в Постгресе есть даже комманда специальная COPY <tablename> FROM <filename>. Формируешь заранее файл с данными и наслаждаешься - инсертится так, что быстрее только кошки родятся ;0) Жаль только, что в пределах одной транзакции.
Сорри за оффтоп, но уж больно впечатлен был мучениями в этой ветке :0(


 
P.N.P. ©   (2005-08-06 10:56) [42]

>Джо ©   (06.08.05 05:44) [41]
Так в FB тоже есть такое понятие как External File.
Но в данной ситуации это, наверное, неподойдет..


 
3DxFantastika ©   (2005-08-07 20:49) [43]

на MySQL очень помогают вставки типа:

INSERT INTO `pp` VALUES ("3.0.0.0", "4.17.142.255", 50331648, 68259583, "US", "United States"),
("4.17.143.0", "4.17.143.15", 68259584, 68259599, "CA", "Canada"),
("4.17.143.16", "4.18.32.71", 68259600, 68296775, "US", "United States"),
("4.18.32.72", "4.18.32.79", 68296776, 68296783, "MX", "Mexico"),
("4.18.32.80", "4.18.65.255", 68296784, 68305407, "US", "United States");
       


 
Андрей Жук ©   (2005-08-08 10:55) [44]

/*
*    Program type:  API Interface
*
*    Description:
*        This program creates a new database, given an SQL statement
*        string.  The newly created database is accessed after its
*        creation, and a sample table is added.
*
*        The SQLCODE is extracted from the status vector and is used
*        to check whether the database already exists.
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "example.h"
#include <ibase.h>

int pr_error (long *, char *);

static char *create_tbl  = "CREATE TABLE dbinfo (when_created DATE)";
static char *insert_date = "INSERT INTO dbinfo VALUES ("NOW")";

int main (ARG(int, argc), ARG(char **, argv))
ARGLIST(int argc)
ARGLIST(char **argv)
{
   isc_db_handle   newdb = NULL;          /* database handle */
   isc_tr_handle   trans = NULL;          /* transaction handle */
   ISC_STATUS_ARRAY status;               /* status vector */
   long            sqlcode;               /* SQLCODE  */
   char            create_db[160];        /* "create database" statement */
   char            new_dbname[128];

   if (argc > 1)
       strcpy(new_dbname, argv[1]);
   else
       strcpy(new_dbname, "new.fdb");

   /*
    *    Construct a "create database" statement.
    *    The database name could have been passed as a parameter.
    */
   sprintf(create_db, "CREATE DATABASE "%s"", new_dbname);
   
   /*
    *    Create a new database.
    *    The database handle is zero.
    */
   
   if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, create_db, 1,
                                  NULL))
   {
       /* Extract SQLCODE from the status vector. */
       sqlcode = isc_sqlcode(status);

       /* Print a descriptive message based on the SQLCODE. */
       if (sqlcode == -902)
       {
           printf("\nDatabase already exists.\n");
           printf("Remove %s before running this program.\n\n", new_dbname);
       }

       /* In addition, print a standard error message. */
       if (pr_error(status, "create database"))
           return 1;
   }

   isc_commit_transaction(status, &trans);
   printf("Created database "%s".\n\n", new_dbname);

   /*
    *    Connect to the new database and create a sample table.
    */

   /* newdb will be set to null on success */
   isc_detach_database(status, &newdb);

   if (isc_attach_database(status, 0, new_dbname, &newdb, 0, NULL))
       if (pr_error(status, "attach database"))
           return 1;

   /* Create a sample table. */
   isc_start_transaction(status, &trans, 1, &newdb, 0, NULL);
   if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, create_tbl, 1, NULL))
       if (pr_error(status, "create table"))
           return 1;
   isc_commit_transaction(status, &trans);

   /* Insert 1 row into the new table. */
   isc_start_transaction(status, &trans, 1, &newdb, 0, NULL);
   if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, insert_date, 1, NULL))
       if (pr_error(status, "insert into"))
           return 1;
   isc_commit_transaction(status, &trans);

   printf("Successfully accessed the newly created database.\n\n");

   isc_detach_database(status, &newdb);

   return 0;
}            

/*
*    Print the status, the SQLCODE, and exit.
*    Also, indicate which operation the error occured on.
*/
int pr_error (ARG(long *, status), ARG(char *, operation))
ARGLIST(long * status)
ARGLIST(char * operation)                                        
{
   printf("[\n");
   printf("PROBLEM ON \"%s\".\n", operation);

   isc_print_status(status);

   printf("SQLCODE:%d\n", isc_sqlcode(status));

   printf("]\n");

   return 1;
}


 
Anatoly Podgoretsky ©   (2005-08-08 11:07) [45]

Иностранные языки запрещены правилами.


 
Defunct ©   (2005-08-29 00:43) [46]

> 3DxFantastika
> Андрей Жук

Большое спасибо, возьму на вооружение!
Сорри, что тянул с ответом так долго, просто считал задачу решенной, и не заглядывал в эту ветку.



Страницы: 1 2 вся ветка

Форум: "Базы";
Текущий архив: 2005.10.09;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.54 MB
Время: 0.015 c
1-1126797235
Alex Kryuchkov
2005-09-15 19:13
2005.10.09
Программное создание макроса в Экселе


3-1125462043
MadGhost
2005-08-31 08:20
2005.10.09
Как пройтись по записям ADODataSet ?


4-1123414423
ne0n
2005-08-07 15:33
2005.10.09
Монитор Реестра


14-1127240450
QuaziLamo
2005-09-20 22:20
2005.10.09
CSS


14-1126858405
Juice
2005-09-16 12:13
2005.10.09
Опять проблемы с ноутбуком





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский